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/git/vole.git

Write over SSH with a registered key:

git clone ssh://git@0.0.0.0:2222/vole.git

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

Code

392 commit(s) on main

Merge change request 01M70WES5ZZDJ6RP226WB11BBZ: Let people rename and remove their own passkeys keenan · 24m ago 4b8c9e1d
history blame raw 1.2 KiB
1package agent
2
3import "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.
8func 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}
32