Documentation
¶
Overview ¶
Command testsupportcheck checks, without Docker, the import, seam and declaration boundary of the repository's test-only code: which packages may import the shared test helpers, which files may read the unit seam, and which declarations may appear in non-test files. It does not exclude that code from ordinary compilation or from any linked binary.
Test-only code lives in _test.go files wherever the Go toolchain lets a test see it. What tests of other packages need lives in helper packages under internal/ (the manifest's test_only_packages), which only _test.go files may import, and which reach unexported cluster state through one registered seam (hookreg.Test, set by ceph/unit_access.go). For each ordinary tag set this command requires, from go list metadata and the syntax of the files the build selects, that:
- every test-only package exists and no package imports it from a non-test file (go list's Imports leave out _test.go files);
- no selected non-test file outside the test-only packages, and none of a harness package (integration test code that several test packages share), declares a function or method whose name starts with Test, or a type of the manifest's forbidden list (the moved test-config and test-state types);
- the seam (hookreg.Test) is read only in the manifest's seam files. The import is resolved by path to its local binding, so a renamed import is caught, a local variable or a different package that happens to be called hookreg is not, and a dot import of the seam package is rejected outright in a non-seam file because its identifiers cannot be attributed without type information;
- no package reports a list error.
The test-only packages stay compiled by go build ./... and go vet ./... : the rule limits who imports them and who reads the seam, it does not remove them from the build. Whether a linked binary contains them is not measured.