gitexectest

package
v0.3.0-20260909180653-... Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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

func Git(t *testing.T) string

Git returns an absolute path to the pinned git binary, failing the test if the target did not supply one.

func Runfile

func Runfile(t *testing.T, name string) string

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL