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.
|
4e3759da
Keenan Nemetz
4h ago
|
1 | package agent |
| 2 | ||
| 3 | import "testing" | |
| 4 | ||
| 5 | // The reserve is the only bound a job tree has: it is a host bind mount, so the | |
| 6 | // runtime cannot quota it. What the runner promises is that it notices before the | |
| 7 | // machine fills, and this is the comparison that decides it. | |
| 8 | func TestDiskLowComparesFreeSpaceWithTheReserve(t *testing.T) { | |
| 9 | t.Parallel() | |
| 10 | dir := t.TempDir() | |
| 11 | free, err := freeBytes(dir) | |
| 12 | if err != nil { | |
| 13 | t.Fatal(err) | |
| 14 | } | |
| 15 | if free <= 0 { | |
| 16 | t.Fatalf("freeBytes(%q) = %d, want a positive count", dir, free) | |
| 17 | } | |
| 18 | ||
| 19 | if _, low, err := diskLow(dir, free/4); err != nil || low { | |
| 20 | t.Fatalf("diskLow with a reserve below the free space = %v, %v; want not low", low, err) | |
| 21 | } | |
| 22 | // A reserve larger than the filesystem is low, which is the state a full runner | |
| 23 | // reaches: the numbers are compared, not guessed. | |
| 24 | if _, low, err := diskLow(dir, free+(1<<40)); err != nil || !low { | |
| 25 | t.Fatalf("diskLow with a reserve above the free space = %v, %v; want low", low, err) | |
| 26 | } | |
| 27 | // Zero disables the check, for a runner whose --dir is on its own sized filesystem. | |
| 28 | if _, low, err := diskLow(dir, 0); err != nil || low { | |
| 29 | t.Fatalf("diskLow with the reserve off = %v, %v; want not low", low, err) | |
| 30 | } | |
| 31 | } |