Skip to content

Commit

Permalink
testing: use env var for configuring debugaddress for tests
Browse files Browse the repository at this point in the history
Unix socket support for --debugaddr was added later what means the
test suite can not be used to test old versions of releases anymore.
This makes debug address configurable via env variable so that old
versions can just ignore it without crashing.

Signed-off-by: Tonis Tiigi <[email protected]>
  • Loading branch information
tonistiigi committed Jan 15, 2025
1 parent dd06922 commit 95ac501
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions cmd/buildkitd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,10 @@ func main() {
Value: groupValue(defaultConf.GRPC.GID),
},
cli.StringFlag{
Name: "debugaddr",
Usage: "debugging address (eg. 0.0.0.0:6060)",
Value: defaultConf.GRPC.DebugAddress,
Name: "debugaddr",
Usage: "debugging address (eg. 0.0.0.0:6060)",
Value: defaultConf.GRPC.DebugAddress,
EnvVar: "BUILDKITD_DEBUGADDR",
},
cli.StringFlag{
Name: "tlscert",
Expand Down
3 changes: 2 additions & 1 deletion util/testutil/workers/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,13 @@ func runBuildkitd(
address := getBuildkitdAddr(tmpdir)
debugAddress := getBuildkitdDebugAddr(tmpdir)

args = append(args, "--root", tmpdir, "--addr", address, "--debugaddr", debugAddress, "--debug")
args = append(args, "--root", tmpdir, "--addr", address, "--debug")
cmd := exec.Command(args[0], args[1:]...) //nolint:gosec // test utility
cmd.Env = append(
os.Environ(),
"BUILDKIT_DEBUG_EXEC_OUTPUT=1",
"BUILDKIT_DEBUG_PANIC_ON_ERROR=1",
"BUILDKITD_DEBUGADDR="+debugAddress,
"TMPDIR="+filepath.Join(tmpdir, "tmp"))
if v := os.Getenv("GO_TEST_COVERPROFILE"); v != "" {
coverDir := filepath.Join(filepath.Dir(v), "helpers")
Expand Down

0 comments on commit 95ac501

Please sign in to comment.