test: align namespace fixtures with executable pinning
1 file changed,
+19
−2
internal/runner/containment/linux_test.go+19 −2
diff --git a/internal/runner/containment/linux_test.go b/internal/runner/containment/linux_test.go| index 3962ff8c..03bc1929 100644 |
| --- a/internal/runner/containment/linux_test.go |
| +++ b/internal/runner/containment/linux_test.go |
| @@ -423,7 +423,12 @@ func TestNamespaceStartupFailure(t *testing.T) { |
| m, l := fixture(t) |
| // The helper cannot acknowledge PID 1, so no process is returned and no |
| // harness side effect is possible. The incomplete intent remains durable. |
| - m.cfg.RunnerBinary = "/usr/bin/true" |
| + cfg := m.cfg |
| + cfg.RunnerBinary = "/usr/bin/true" |
| + m, err := New(cfg) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| p, e := m.Start(context.Background(), l, []string{"/usr/bin/touch", "/workspace/prompt-sent"}) |
| if e == nil || p != nil { |
| t.Fatal("missing readiness accepted") |
| @@ -803,6 +808,10 @@ func TestNamespaceDirectPolicyAdmission(t *testing.T) { |
| } |
| reached := false |
| m.beforePin = func() { reached = true } |
| + before, err := os.ReadDir(m.cfg.ScratchRoot) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| p, e := m.Start(context.Background(), l, argv) |
| if e == nil { |
| p.(*process).kill() |
| @@ -812,9 +821,17 @@ func TestNamespaceDirectPolicyAdmission(t *testing.T) { |
| p.Stderr().Close() |
| t.Fatal("changed direct launch accepted") |
| } |
| - if reached { |
| + if kind == "runner" { |
| + if !reached || e != errStartup { |
| + t.Fatalf("changed namespace executable bypassed pinned digest check: reached=%v err=%v", reached, e) |
| + } |
| + } else if reached { |
| t.Fatal("changed direct launch passed attestation") |
| } |
| + entries, err := os.ReadDir(m.cfg.ScratchRoot) |
| + if err != nil || len(entries) != len(before) { |
| + t.Fatalf("changed direct launch created attempt state: %v %v", entries, err) |
| + } |
| }) |
| } |
| } |