diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-02-17 14:13:08 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-02-17 14:16:54 +0900 |
| commit | 88d9a6163e9e91b55b6ebe71f335e7617c76b04e (patch) | |
| tree | f52b7da1651409120ee6add658204ea29cde39da /container/dispatcher_test.go | |
| parent | 47860b038750864b8346e4d0594a272ba3fc2b2f (diff) | |
container/initplace: return nil for createTemp error injection
This matches os package behaviour, and avoids adding the cleanup.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'container/dispatcher_test.go')
| -rw-r--r-- | container/dispatcher_test.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/container/dispatcher_test.go b/container/dispatcher_test.go index 5de37fc9..fe0c4dbc 100644 --- a/container/dispatcher_test.go +++ b/container/dispatcher_test.go @@ -238,8 +238,11 @@ func sliceAddr[S any](s []S) *[]S { return &s } func newCheckedFile(t *testing.T, name, wantData string, closeErr error) osFile { f := &checkedOsFile{t: t, name: name, want: wantData, closeErr: closeErr} - // check happens in Close, and cleanup is not guaranteed to run, so relying on it for sloppy implementations will cause sporadic test results - f.cleanup = runtime.AddCleanup(f, func(name string) { f.t.Fatalf("checkedOsFile %s became unreachable without a call to Close", name) }, f.name) + // check happens in Close, and cleanup is not guaranteed to run, so relying + // on it for sloppy implementations will cause sporadic test results + f.cleanup = runtime.AddCleanup(f, func(name string) { + panic("checkedOsFile " + name + " became unreachable without a call to Close") + }, name) return f } |
