Documentation
¶
Overview ¶
Package gitexectest resolves the Bazel-pinned git a test target supplies.
Tests that shell out to git run against the same pinned build the services use, rather than whatever the host happens to have, so a developer's git version cannot change what a test proves. A target opts in by depending on the binary and naming it in the environment:
go_test(
data = ["@git"],
env = {"SUBMITQUEUE_TEST_GIT": "$(location @git//:git)"},
)
The indirection through an environment variable is Bazel's: rules_go expands $(location) to an execroot-relative path, which for an external output has to be re-rooted under the runfiles tree the test actually runs from.
Index ¶
Constants ¶
const GitEnv = "SUBMITQUEUE_TEST_GIT"
GitEnv is the variable a test target sets to the pinned git binary.
Variables ¶
This section is empty.
Functions ¶
func Git ¶
Git returns an absolute path to the pinned git binary, failing the test if the target did not supply one.
func Runfile ¶
Runfile resolves the $(location)-expanded path held by the named environment variable, failing the test if it is unset or does not resolve.
A path that is already usable is returned as-is, which is what happens under `bazel run`, where the process already starts inside the runfiles tree.
Types ¶
This section is empty.