MCPcopy Create free account
hub / github.com/buildkite/agent-stack-k8s / cleanTestEnv

Function cleanTestEnv

cmd/controller/controller_test.go:571–590  ·  view source on GitHub ↗

cleanTestEnv unsets environment variables that might be set in CI or .envrc which could pollute the test environment.

(t *testing.T)

Source from the content-addressed store, hash-verified

569// cleanTestEnv unsets environment variables that might be set in CI or .envrc
570// which could pollute the test environment.
571func cleanTestEnv(t *testing.T) {
572 t.Helper()
573 for _, env := range []string{
574 "BUILDKITE_TOKEN",
575 "INTEGRATION_TEST_BUILDKITE_TOKEN",
576 "IMAGE",
577 "NAMESPACE",
578 "AGENT_TOKEN_SECRET",
579 "IMAGE_PULL_BACKOFF_GRACE_PERIOD",
580 "CONFIG",
581 "MAX_IN_FLIGHT",
582 "DEBUG",
583 "JOB_TTL",
584 "BUILDKITE_K8S_STACK_CONTROLLER_ID",
585 "RESERVATION_EXPIRY_SECONDS",
586 } {
587 t.Setenv(env, "")
588 os.Unsetenv(env)
589 }
590}
591
592// createTempConfigFile creates a temporary config file with the given content
593// and returns its path. The file is automatically cleaned up after the test.

Calls

no outgoing calls

Tested by

no test coverage detected