Documentation
¶
Overview ¶
Package functional is the machine behind cmd/nova-ci's `functional` verb: which of a change's packages carry functional tests, and which tests those are. A functional test is one in a _test.go file that builds only under the `functional` build tag (docs/TESTING.md: unit tests mock; functional tests carry the tag and run per stream merge, in ci.yml's functional job). The unit tier never builds those files, and the functional tier runs only them: `go test -tags functional` alone would run every unit test of the package a second time.
It reads Go source with go/build and go/parser and nothing else: no process, no network, no clock.
Index ¶
Constants ¶
const Tag = "functional"
Tag is the build tag that makes a test file functional.
Variables ¶
This section is empty.
Functions ¶
func Expand ¶
Expand turns `dir/...` patterns into every directory under dir, the way go list reads them (testdata, vendor and names starting with . or _ are not packages); any other argument is kept as given.
func RunPattern ¶
RunPattern is one `go test -run` pattern naming exactly the given tests: ^(A|B)$, each name quoted, so a test named like a prefix of another never drags the longer one in.
func Unmatched ¶
Unmatched returns one clause per pattern that matches no package, in the order given: a directory that does not exist, a path that is not a directory, or a directory (for `dir/...`, a tree) holding no .go file at all, the cases where `go list` would list nothing for it. A typo in CI's package list must be a refusal, never a functional tier that silently runs nothing. It reads the file system only; build constraints are not applied, so a package whose files build only on another GOOS still matches, as go list lists it.
Types ¶
type Package ¶
Package is one package directory with functional tests, and their names.
func Select ¶
Select returns, in the order given, the package directories that hold at least one test file built only under Tag, with the top-level Test functions those files declare (TestMain excluded: go test calls it, -run does not select it). A directory with no Go files is skipped, not an error: a deleted package can still be in a diff's list.