From 9d427c377b14a6a5297d596189b1422cc01dbee2 Mon Sep 17 00:00:00 2001 From: Nikolai Emil Damm Date: Tue, 3 Nov 2026 02:08:05 +0100 Subject: [PATCH] fix(storage): separate admission proof build and execution budgets Part of #5665. Hosted run 41551806702 exhausted the old four-minute wrapper during cold Kubernetes dependency compilation. Build the unchanged native proof separately within a bounded setup phase, retain its two-minute test timeout, and cap both phases below the existing twenty-minute package deadline. --- .../native_test.go | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/scripts/tests/longhorn-benchmark-delete-guard/native_test.go b/scripts/tests/longhorn-benchmark-delete-guard/native_test.go index ec1bb4f546..b76b2b2ff1 100644 --- a/scripts/tests/longhorn-benchmark-delete-guard/native_test.go +++ b/scripts/tests/longhorn-benchmark-delete-guard/native_test.go @@ -10,19 +10,35 @@ import ( ) func TestNativeBenchmarkDeletionGuard(t *testing.T) { - ctx, cancel := context.WithTimeout(context.Background(), 4*time.Minute) - defer cancel() - render := exec.CommandContext(ctx, "kubectl", "kustomize", "../../../k8s/providers/hetzner/infrastructure/controllers/longhorn") + // Hosted runners compile the Kubernetes admission dependencies from a cold + // cache. Keep that setup separate from the native proof's execution budget; + // both phases together remain below CI's 20-minute per-package deadline. + buildCtx, cancelBuild := context.WithTimeout(context.Background(), 15*time.Minute) + defer cancelBuild() + render := exec.CommandContext(buildCtx, "kubectl", "kustomize", "../../../k8s/providers/hetzner/infrastructure/controllers/longhorn") raw, err := render.Output() if err != nil { t.Fatal("production Longhorn controller profile could not be rendered") } - profile := filepath.Join(t.TempDir(), "profile.yaml") + work := t.TempDir() + profile := filepath.Join(work, "profile.yaml") if err := os.WriteFile(profile, raw, 0600); err != nil { t.Fatal(err) } - command := exec.CommandContext(ctx, "go", "test", "-mod=readonly", "-count=1", "-timeout=2m", ".") - command.Dir = "testdata/native-proof" + binary := filepath.Join(work, "native-proof.test") + build := exec.CommandContext(buildCtx, "go", "test", "-c", "-mod=readonly", "-o", binary, ".") + build.Dir = "testdata/native-proof" + build.WaitDelay = 10 * time.Second + if output, err := build.CombinedOutput(); err != nil { + t.Fatalf("native Kubernetes admission proof build failed: %v: %s", err, output) + } + cancelBuild() + + ctx, cancel := context.WithTimeout(context.Background(), 4*time.Minute) + defer cancel() + command := exec.CommandContext(ctx, binary, "-test.count=1", "-test.timeout=2m") + command.Dir = build.Dir + command.WaitDelay = 10 * time.Second command.Env = append(os.Environ(), "LONGHORN_GUARD_RENDER_PATH="+profile) if output, err := command.CombinedOutput(); err != nil { t.Fatalf("native Kubernetes admission proof failed: %v: %s", err, output)