Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software:2222/vole.git

A free and open-source forge that lives in your Git repo.

Turn off the disk reserve for test-spawned runners

c284cb2ca75465d85c5c07657d30c0ad31eb7af2 · Keenan Nemetz · 28m ago · parent 32290114

Turn off the disk reserve for test-spawned runners

The server integration tests start a runner with --dir t.TempDir(), which
lives on /tmp. Inside a CI job /tmp is the runtime's tmpfs, sized by
--container-tmpfs (1G), so a nested runner can never meet the 2G
--disk-reserve default: it stops every job at the first one-second check.
TestKilledRunnerIsRequeued and TestRunLogStreamsWhileTheJobRuns were the two
whose steps outlive that tick, which is why main's test step failed on a
README-only commit.

The reserve bounds a host filesystem; a test's throwaway directory is already
bounded by the tmpfs. runnerCmd builds every runner a test starts with
--disk-reserve 0 so a new test cannot reintroduce the coupling, and
ci/agent/disk_test.go keeps testing the check itself.

Closes 01M71GA6FXJ2QG68SS2WZ3Q7K5

server/integration_test.go +23−11

@@ -3055,7 +3055,7 @@ jobs:
3055 3055 t.Fatal("the workflow blob was not pinned; a later edit could change what runs")
3056 3056 }
3057 3057
3058 cmd := exec.Command(binPath, "runner", "--remote", f.sshBase(), "--once", "--dir", t.TempDir())
3058 cmd := f.runnerCmd(t, "--once", "--dir", t.TempDir())
3059 3059 cmd.Env = f.ciEnv()
3060 3060 if out, err := cmd.CombinedOutput(); err != nil {
3061 3061 t.Fatalf("runner: %v\n%s", err, out)
@@ -3182,7 +3182,7 @@ jobs:
3182 3182 }
3183 3183 f.waitForRun(t, 5*time.Second, func(r *runs.Run) bool { return r.Status == runs.StatusQueued })
3184 3184
3185 cmd := exec.Command(binPath, "runner", "--remote", f.sshBase(), "--once", "--dir", t.TempDir())
3185 cmd := f.runnerCmd(t, "--once", "--dir", t.TempDir())
3186 3186 cmd.Env = f.ciEnv()
3187 3187 if err := cmd.Start(); err != nil {
3188 3188 t.Fatal(err)
@@ -3269,7 +3269,7 @@ jobs:
3269 3269 t.Fatalf("queued image = %+v, want file:go with digest %s", queued, wantSHA)
3270 3270 }
3271 3271
3272 cmd := exec.Command(binPath, "runner", "--remote", f.sshBase(), "--once", "--dir", t.TempDir())
3272 cmd := f.runnerCmd(t, "--once", "--dir", t.TempDir())
3273 3273 cmd.Env = f.ciEnv()
3274 3274 if out, err := cmd.CombinedOutput(); err != nil {
3275 3275 t.Fatalf("runner: %v\n%s", err, out)
@@ -3300,7 +3300,7 @@ func TestARepoFilterOutsideTheGrantIsRefusedAtStartup(t *testing.T) {
3300 3300 f := newFixture(t)
3301 3301 f.publish(f.repo)
3302 3302
3303 cmd := exec.Command(binPath, "runner", "--remote", f.sshBase(), "--once",
3303 cmd := f.runnerCmd(t, "--once",
3304 3304 "--dir", t.TempDir(), "--repos", "some-other-repo")
3305 3305 cmd.Env = f.ciEnv()
3306 3306 out, err := cmd.CombinedOutput()
@@ -3406,7 +3406,7 @@ jobs:
3406 3406 t.Fatalf("push: %s", errs)
3407 3407 }
3408 3408
3409 first := exec.Command(binPath, "runner", "--remote", f.sshBase(), "--dir", t.TempDir())
3409 first := f.runnerCmd(t, "--dir", t.TempDir())
3410 3410 first.Env = f.ciEnv()
3411 3411 first.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
3412 3412 first.Stderr = io.Discard
@@ -3421,7 +3421,7 @@ jobs:
3421 3421 // The lease expires and the janitor puts the job back.
3422 3422 f.waitForRun(t, 30*time.Second, func(r *runs.Run) bool { return r.Status == runs.StatusQueued })
3423 3423
3424 second := exec.Command(binPath, "runner", "--remote", f.sshBase(), "--once", "--dir", t.TempDir())
3424 second := f.runnerCmd(t, "--once", "--dir", t.TempDir())
3425 3425 second.Env = f.ciEnv()
3426 3426 second.Stderr = io.Discard
3427 3427 if err := second.Start(); err != nil {
@@ -3469,7 +3469,7 @@ jobs:
3469 3469 first := f.waitForRun(t, 5*time.Second, func(r *runs.Run) bool { return r.SHA == firstSHA })
3470 3470
3471 3471 // Lease the v1 run and hold it in its step.
3472 held := exec.Command(binPath, "runner", "--remote", f.sshBase(), "--once", "--dir", t.TempDir())
3472 held := f.runnerCmd(t, "--once", "--dir", t.TempDir())
3473 3473 held.Env = f.ciEnv()
3474 3474 held.Stderr = io.Discard
3475 3475 if err := held.Start(); err != nil {
@@ -3527,6 +3527,18 @@ jobs:
3527 3527 }
3528 3528 }
3529 3529
3530 // runnerCmd is exec.Command for a runner a test spawns. Its --dir is a t.TempDir(),
3531 // which lives on this process's temp filesystem: inside a CI job that is the
3532 // runtime's tmpfs, sized by --container-tmpfs (1G) and so permanently below the
3533 // runner's 2G --disk-reserve default. The reserve bounds a host filesystem, so it
3534 // is off for a test's throwaway directory; ci/agent/disk_test.go tests the check.
3535 func (f *fixture) runnerCmd(t *testing.T, args ...string) *exec.Cmd {
3536 t.Helper()
3537 return exec.Command(binPath, append([]string{
3538 "runner", "--remote", f.sshBase(), "--disk-reserve", "0",
3539 }, args...)...)
3540 }
3541
3530 3542 // runOnce executes one queued job with a real agent.
3531 3543 func (f *fixture) runOnce(t *testing.T) { f.runOnceAs(t, f.keyPath) }
3532 3544
@@ -3534,7 +3546,7 @@ func (f *fixture) runOnce(t *testing.T) { f.runOnceAs(t, f.keyPath) }
3534 3546 // gets a result reported by somebody other than the instance's admin.
3535 3547 func (f *fixture) runOnceAs(t *testing.T, keyPath string) {
3536 3548 t.Helper()
3537 cmd := exec.Command(binPath, "runner", "--remote", f.sshBase(), "--once", "--dir", t.TempDir())
3549 cmd := f.runnerCmd(t, "--once", "--dir", t.TempDir())
3538 3550 cmd.Env = f.ciEnvFor(keyPath)
3539 3551 if out, err := cmd.CombinedOutput(); err != nil {
3540 3552 t.Fatalf("runner: %v\n%s", err, out)
@@ -4038,7 +4050,7 @@ jobs:
4038 4050 }
4039 4051
4040 4052 // A one-shot runner carrying only one of the two labels must not take it.
4041 cmd := exec.Command(binPath, "runner", "--remote", f.sshBase(), "--once",
4053 cmd := f.runnerCmd(t, "--once",
4042 4054 "--dir", t.TempDir(), "--label", "linux")
4043 4055 cmd.Env = f.ciEnv()
4044 4056 if out, err := cmd.CombinedOutput(); err != nil {
@@ -4053,7 +4065,7 @@ jobs:
4053 4065 }
4054 4066
4055 4067 // The matching runner builds it.
4056 cmd = exec.Command(binPath, "runner", "--remote", f.sshBase(), "--once",
4068 cmd = f.runnerCmd(t, "--once",
4057 4069 "--dir", t.TempDir(), "--label", "linux", "--label", "fast")
4058 4070 cmd.Env = f.ciEnv()
4059 4071 if out, err := cmd.CombinedOutput(); err != nil {
@@ -4077,7 +4089,7 @@ jobs:
4077 4089 func TestABadRunnerLabelIsRefusedBeforeConnecting(t *testing.T) {
4078 4090 t.Parallel()
4079 4091 f := newFixture(t)
4080 cmd := exec.Command(binPath, "runner", "--remote", f.sshBase(), "--once",
4092 cmd := f.runnerCmd(t, "--once",
4081 4093 "--dir", t.TempDir(), "--label", "Linux")
4082 4094 cmd.Env = f.ciEnv()
4083 4095 out, err := cmd.CombinedOutput()