Loading
test: isolate unit tests from CI and glab environment variables
What does this MR do?
make test and make test-race now unset CI, GL_HOST, and every GITLAB_*, GLAB_* and CI_* variable before running tests, keeping CI_PROJECT_PATH (which the targets set). test-changed goes through make test, so it is covered too. integration-test-race is unchanged because it needs GITLAB_TOKEN_TEST and GITLAB_TEST_HOST.
Variables are unset rather than set to empty, so code using os.LookupEnv sees them as absent. AGENTS.md is updated to match.
Verification
go test ./...on unmodifiedmainwith CI-like variables exported (GITLAB_CI,CI_JOB_TOKEN,CI_SERVER_*,CI_DEFAULT_BRANCH,GITLAB_HOST,GL_HOST,GITLAB_ACCESS_TOKEN,GLAB_ENABLE_CI_AUTOLOGIN, ...): 15 packages fail, includingcmd/glab,cmdutils,config,api,auth/*,orbit,glrepo.make testwith the same variables exported: 7326 tests, 9 skipped, all pass.env -i ... make test: 7326 tests, 9 skipped, which matches.
No test relied on an ambient value, so no t.Setenv changes were needed.
Closes #8712 (closed)
Edited by Jay McCure