From 5d8a2199b6c8dc5f75b529a39d196c6cb14c98c2 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Thu, 21 Aug 2025 00:18:50 +0900 Subject: container/init: op interface valid method Check ops early and eliminate duplicate checks. Signed-off-by: Ophestra --- container/mount_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'container/mount_test.go') diff --git a/container/mount_test.go b/container/mount_test.go index 4c598b3f..64cac282 100644 --- a/container/mount_test.go +++ b/container/mount_test.go @@ -49,6 +49,24 @@ 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 -- cgit v1.3.1