Commit 7da0d08800
7da0d088004c5729bd52239e0f4ca3ba714cbb05
parent: 3398f2216b
Verified · cmc
cmc <hello@cleberg.net> · 2026-09-09 03:48 UTC
e2e: runners get their own config dir, and the unattached poll is tested
Every runner the suite starts now runs with XDG_CONFIG_HOME set to a
temp dir, so a developer's own ~/.config/gitbay-runner is not injected
into the test's remote, identity and repo scope.
TestAttachedRunnerBuildsOwnRepo polls once before the attach and asserts
the build is still pending, which is what its comment claimed.
Ref #184
e2e/build_cancel_test.go
+1 −1
| @@ -124,7 +124,7 @@ func TestBuildCancelRunning(t *testing.T) { |
| 124 | 124 | runner := exec.Command(inst.runner, "-once", "-remote", "git@127.0.0.1", "-ssh-opts", opts, |
| 125 | 125 | "-isolation", "none", |
| 126 | 126 | "-clone-base", fmt.Sprintf("ssh://git@127.0.0.1:%d", inst.port), "-workdir", t.TempDir()) |
| 127 | | runner.Env = append(os.Environ(), "GIT_CONFIG_NOSYSTEM=1", "GIT_CONFIG_GLOBAL=/dev/null") |
| 127 | runner.Env = append(os.Environ(), "XDG_CONFIG_HOME="+t.TempDir(), "GIT_CONFIG_NOSYSTEM=1", "GIT_CONFIG_GLOBAL=/dev/null") |
| 128 | 128 | var runnerOut strings.Builder |
| 129 | 129 | runner.Stdout, runner.Stderr = &runnerOut, &runnerOut |
| 130 | 130 | if err := runner.Start(); err != nil { |
e2e/ci_test.go
+2 −2
| @@ -39,7 +39,7 @@ func (i *instance) runnerOnce(t *testing.T, key string, extra ...string) string |
| 39 | 39 | "-workdir", t.TempDir()} |
| 40 | 40 | args = append(args, extra...) |
| 41 | 41 | cmd := exec.Command(i.runner, args...) |
| 42 | | cmd.Env = append(os.Environ(), "GIT_CONFIG_NOSYSTEM=1", "GIT_CONFIG_GLOBAL=/dev/null") |
| 42 | cmd.Env = append(os.Environ(), "XDG_CONFIG_HOME="+t.TempDir(), "GIT_CONFIG_NOSYSTEM=1", "GIT_CONFIG_GLOBAL=/dev/null") |
| 43 | 43 | out, err := cmd.CombinedOutput() |
| 44 | 44 | if err != nil { |
| 45 | 45 | t.Fatalf("runner: %v\n%s", err, out) |
| @@ -293,7 +293,7 @@ func (i *instance) runnerJobs(t *testing.T, key, repo string, jobs int) string { |
| 293 | 293 | "-ssh-opts", opts, |
| 294 | 294 | "-clone-base", fmt.Sprintf("ssh://git@127.0.0.1:%d", i.port), |
| 295 | 295 | "-workdir", t.TempDir()) |
| 296 | | cmd.Env = append(os.Environ(), "GIT_CONFIG_NOSYSTEM=1", "GIT_CONFIG_GLOBAL=/dev/null") |
| 296 | cmd.Env = append(os.Environ(), "XDG_CONFIG_HOME="+t.TempDir(), "GIT_CONFIG_NOSYSTEM=1", "GIT_CONFIG_GLOBAL=/dev/null") |
| 297 | 297 | var buf bytes.Buffer |
| 298 | 298 | cmd.Stdout, cmd.Stderr = &buf, &buf |
| 299 | 299 | if err := cmd.Start(); err != nil { |
e2e/isolation_podman_test.go
+1 −1
| @@ -182,7 +182,7 @@ func runnerPodmanOnce(t *testing.T, inst *instance, key string) { |
| 182 | 182 | "-image", "localhost/gitbay-ci:1", |
| 183 | 183 | "-clone-base", fmt.Sprintf("ssh://git@127.0.0.1:%d", inst.port), |
| 184 | 184 | "-workdir", t.TempDir()) |
| 185 | | cmd.Env = append(os.Environ(), "GIT_CONFIG_NOSYSTEM=1", "GIT_CONFIG_GLOBAL=/dev/null") |
| 185 | cmd.Env = append(os.Environ(), "XDG_CONFIG_HOME="+t.TempDir(), "GIT_CONFIG_NOSYSTEM=1", "GIT_CONFIG_GLOBAL=/dev/null") |
| 186 | 186 | if out, err := cmd.CombinedOutput(); err != nil { |
| 187 | 187 | t.Fatalf("runner: %v\n%s", err, out) |
| 188 | 188 | } |
e2e/runnerattach_test.go
+4
| @@ -74,6 +74,10 @@ func TestAttachedRunnerBuildsOwnRepo(t *testing.T) { |
| 74 | 74 | if out, _, _ := inst.ssh(t, aliceKey, "", "build", "list", "alice/app"); !strings.Contains(out, "unit\tpending") { |
| 75 | 75 | t.Fatalf("build not pending before attach: %s", out) |
| 76 | 76 | } |
| 77 | run() |
| 78 | if out, _, _ := inst.ssh(t, aliceKey, "", "build", "list", "alice/app"); !strings.Contains(out, "unit\tpending") { |
| 79 | t.Fatalf("unattached runner claimed the build: %s", out) |
| 80 | } |
| 77 | 81 | |
| 78 | 82 | // Attach with the printed key. |
| 79 | 83 | if _, errOut, code := inst.ssh(t, aliceKey, string(pub), "repo", "runner", "add", "alice/app"); code != 0 { |
e2e/runnerstop_test.go
+1 −1
| @@ -81,7 +81,7 @@ func (i *instance) buildStatus(t *testing.T, key string) string { |
| 81 | 81 | func TestRunnerDrainsOnSIGTERM(t *testing.T) { |
| 82 | 82 | inst, key := stopFixture(t) |
| 83 | 83 | cmd := exec.Command(inst.runner, inst.runnerArgs(t, key)...) |
| 84 | | cmd.Env = append(os.Environ(), "GIT_CONFIG_NOSYSTEM=1", "GIT_CONFIG_GLOBAL=/dev/null") |
| 84 | cmd.Env = append(os.Environ(), "XDG_CONFIG_HOME="+t.TempDir(), "GIT_CONFIG_NOSYSTEM=1", "GIT_CONFIG_GLOBAL=/dev/null") |
| 85 | 85 | var buf bytes.Buffer |
| 86 | 86 | cmd.Stdout, cmd.Stderr = &buf, &buf |
| 87 | 87 | if err := cmd.Start(); err != nil { |