aboutsummaryrefslogtreecommitdiffhomepage
path: root/container/mount_test.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-08-21 21:59:07 +0900
committerOphestra <cat@gensokyo.uk>2025-08-22 19:27:31 +0900
commit09d284498109b847da0da1e2c5f883268a7f2d46 (patch)
tree3784dee4b4e4ec97a95cb222c70d05463ae640ef /container/mount_test.go
parentd500d6e55917e12a3f98b39cf0d29b6c96de9667 (diff)
container/init: wrap syscall helper functions
This allows tests to stub all kernel behaviour, enabling measurement of all function call arguments and error injection. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'container/mount_test.go')
-rw-r--r--container/mount_test.go83
1 files changed, 0 insertions, 83 deletions
diff --git a/container/mount_test.go b/container/mount_test.go
index 64cac282..eb904774 100644
--- a/container/mount_test.go
+++ b/container/mount_test.go
@@ -2,7 +2,6 @@ package container
import (
"os"
- "slices"
"testing"
)
@@ -48,85 +47,3 @@ func TestEscapeOverlayDataSegment(t *testing.T) {
})
}
}
-
-type opValidTestCase struct {
- name string
- op Op
- want bool
-}
-
-func checkOpsValid(t *testing.T, testCases []opValidTestCase) {
- t.Run("valid", func(t *testing.T) {
- for _, tc := range testCases {
- t.Run(tc.name, func(t *testing.T) {
- if got := tc.op.Valid(); got != tc.want {
- t.Errorf("Valid: %v, want %v", got, tc.want)
- }
- })
- }
- })
-}
-
-type opsBuilderTestCase struct {
- name string
- ops *Ops
- want Ops
-}
-
-func checkOpsBuilder(t *testing.T, testCases []opsBuilderTestCase) {
- t.Run("build", func(t *testing.T) {
- for _, tc := range testCases {
- t.Run(tc.name, func(t *testing.T) {
- if !slices.EqualFunc(*tc.ops, tc.want, func(op Op, v Op) bool { return op.Is(v) }) {
- t.Errorf("Ops: %#v, want %#v", tc.ops, tc.want)
- }
- })
- }
- })
-}
-
-type opIsTestCase struct {
- name string
- op, v Op
- want bool
-}
-
-func checkOpIs(t *testing.T, testCases []opIsTestCase) {
- t.Run("is", func(t *testing.T) {
- for _, tc := range testCases {
- t.Run(tc.name, func(t *testing.T) {
- if got := tc.op.Is(tc.v); got != tc.want {
- t.Errorf("Is: %v, want %v", got, tc.want)
- }
- })
- }
- })
-}
-
-type opMetaTestCase struct {
- name string
- op Op
-
- wantPrefix string
- wantString string
-}
-
-func checkOpMeta(t *testing.T, testCases []opMetaTestCase) {
- t.Run("meta", func(t *testing.T) {
- for _, tc := range testCases {
- t.Run(tc.name, func(t *testing.T) {
- t.Run("prefix", func(t *testing.T) {
- if got := tc.op.prefix(); got != tc.wantPrefix {
- t.Errorf("prefix: %q, want %q", got, tc.wantPrefix)
- }
- })
-
- t.Run("string", func(t *testing.T) {
- if got := tc.op.String(); got != tc.wantString {
- t.Errorf("String: %s, want %s", got, tc.wantString)
- }
- })
- })
- }
- })
-}