diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-03-02 23:23:04 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-03-02 23:23:04 +0900 |
| commit | 0bd9b9e8fe61a96d7c63ec85c190cd32636fa659 (patch) | |
| tree | 22af611c64ac75a94294b510b206df80ad2e85ed /test/sandbox/mount_test.go | |
| parent | 39e32799b3ae889bfb05cead2708c82137eb795a (diff) | |
test/sandbox: assert filesystem json
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'test/sandbox/mount_test.go')
| -rw-r--r-- | test/sandbox/mount_test.go | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/test/sandbox/mount_test.go b/test/sandbox/mount_test.go index 74074121..47df2103 100644 --- a/test/sandbox/mount_test.go +++ b/test/sandbox/mount_test.go @@ -1,7 +1,6 @@ package sandbox_test import ( - "encoding/json" "os" "path" "testing" @@ -113,21 +112,7 @@ overlay /.fortify/sbin/fortify overlay ro,nosuid,nodev,relatime,lowerdir=/mnt-ro t.Run(tc.name+" assert", func(t *testing.T) { oldFatal := sandbox.SwapFatal(t.Fatalf) t.Cleanup(func() { sandbox.SwapFatal(oldFatal) }) - - wantFile := path.Join(t.TempDir(), "want.json") - if f, err := os.OpenFile(wantFile, os.O_CREATE|os.O_WRONLY, 0400); err != nil { - t.Fatalf("cannot create %q: %v", wantFile, err) - } else if err = json.NewEncoder(f).Encode(tc.want); err != nil { - t.Fatalf("cannot encode to %q: %v", wantFile, err) - } else if err = f.Close(); err != nil { - t.Fatalf("cannot close %q: %v", wantFile, err) - } - - sandbox.MustAssertMounts(name, name, wantFile) - - if err := os.Remove(wantFile); err != nil { - t.Fatalf("cannot remove %q: %v", wantFile, err) - } + sandbox.MustAssertMounts(name, name, sandbox.MustWantFile(t, tc.want)) }) if err := os.Remove(name); err != nil { |
