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/inittmpfs_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'container/inittmpfs_test.go') diff --git a/container/inittmpfs_test.go b/container/inittmpfs_test.go index c36820cd..c9245869 100644 --- a/container/inittmpfs_test.go +++ b/container/inittmpfs_test.go @@ -6,6 +6,14 @@ import ( ) func TestMountTmpfsOp(t *testing.T) { + checkOpsValid(t, []opValidTestCase{ + {"nil", (*MountTmpfsOp)(nil), false}, + {"zero", new(MountTmpfsOp), false}, + {"nil path", &MountTmpfsOp{FSName: "tmpfs"}, false}, + {"zero fsname", &MountTmpfsOp{Path: MustAbs("/tmp/")}, false}, + {"valid", &MountTmpfsOp{FSName: "tmpfs", Path: MustAbs("/tmp/")}, true}, + }) + checkOpsBuilder(t, []opsBuilderTestCase{ {"runtime", new(Ops).Tmpfs( MustAbs("/run/user"), -- cgit v1.3.1