diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-08-31 23:11:25 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-08-31 23:11:25 +0900 |
| commit | 49600a6f46d99ff35d883381670548de1f01846e (patch) | |
| tree | 9c4a8067f2155eca36a29c6bb99f82ecb81c2495 /container/errors_test.go | |
| parent | b489a3bba15bc6d808d7cc9c17f74dd833d32b9e (diff) | |
container/stub: export stub helpers
These are very useful in many packages containing relatively large amount of code making calls to difficult or impossible to stub functions.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'container/errors_test.go')
| -rw-r--r-- | container/errors_test.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/container/errors_test.go b/container/errors_test.go index 45a5fcde..fd774a42 100644 --- a/container/errors_test.go +++ b/container/errors_test.go @@ -8,6 +8,7 @@ import ( "syscall" "testing" + "hakurei.app/container/stub" "hakurei.app/container/vfs" ) @@ -30,8 +31,8 @@ func TestMessageFromError(t *testing.T) { {"path", &os.PathError{ Op: "mount", Path: "/sysroot", - Err: errUnique, - }, "cannot mount /sysroot: unique error injected by the test suite", true}, + Err: stub.UniqueError(0xdeadbeef), + }, "cannot mount /sysroot: unique error 3735928559 injected by the test suite", true}, {"absolute", &AbsoluteError{"etc/mtab"}, `path "etc/mtab" is not absolute`, true}, @@ -48,7 +49,7 @@ func TestMessageFromError(t *testing.T) { {"tmpfs", TmpfsSizeError(-1), "tmpfs size -1 out of bounds", true}, - {"unsupported", errUnique, zeroString, false}, + {"unsupported", stub.UniqueError(0xdeadbeef), zeroString, false}, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { @@ -144,10 +145,10 @@ func TestErrnoFallback(t *testing.T) { Err: syscall.ETIMEDOUT, }, syscall.ETIMEDOUT, nil}, - {"fallback", errUnique, 0, &os.PathError{ + {"fallback", stub.UniqueError(0xcafebabe), 0, &os.PathError{ Op: "fallback", Path: "/proc/nonexistent", - Err: errUnique, + Err: stub.UniqueError(0xcafebabe), }}, } for _, tc := range testCases { |
