From 7638a44fa613f23434318bdf136723aa010e8638 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Mon, 13 Oct 2025 04:38:48 +0900 Subject: treewide: parallel tests Most tests already had no global state, however parallel was never enabled. This change enables it for all applicable tests. Signed-off-by: Ophestra --- container/seccomp/libseccomp_test.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'container/seccomp/libseccomp_test.go') diff --git a/container/seccomp/libseccomp_test.go b/container/seccomp/libseccomp_test.go index 81f52511..d947105c 100644 --- a/container/seccomp/libseccomp_test.go +++ b/container/seccomp/libseccomp_test.go @@ -13,6 +13,8 @@ import ( ) func TestExport(t *testing.T) { + t.Parallel() + testCases := []struct { name string flags ExportFlag @@ -32,14 +34,15 @@ func TestExport(t *testing.T) { {"hakurei tty", 0, PresetExt | PresetDenyNS | PresetDenyDevel, false}, } - buf := make([]byte, 8) for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { + t.Parallel() + e := New(Preset(tc.presets, tc.flags), tc.flags) want := bpfExpected[bpfPreset{tc.flags, tc.presets}] digest := sha512.New() - if _, err := io.CopyBuffer(digest, e, buf); (err != nil) != tc.wantErr { + if _, err := io.Copy(digest, e); (err != nil) != tc.wantErr { t.Errorf("Exporter: error = %v, wantErr %v", err, tc.wantErr) return } @@ -47,7 +50,7 @@ func TestExport(t *testing.T) { t.Errorf("Close: error = %v", err) } if got := digest.Sum(nil); !slices.Equal(got, want) { - t.Fatalf("Export() hash = %x, want %x", + t.Fatalf("Export: hash = %x, want %x", got, want) return } -- cgit v1.3.1