aboutsummaryrefslogtreecommitdiffhomepage
path: root/container/seccomp/libseccomp_test.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-10-13 04:38:48 +0900
committerOphestra <cat@gensokyo.uk>2025-10-13 04:38:48 +0900
commit7638a44fa613f23434318bdf136723aa010e8638 (patch)
tree7b5270ed4e9b6d7f1ee0f28c58d8077aa1d18005 /container/seccomp/libseccomp_test.go
parenta14b6535a66cb7ac0fc4827f767ffaee0ce04b57 (diff)
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 <cat@gensokyo.uk>
Diffstat (limited to 'container/seccomp/libseccomp_test.go')
-rw-r--r--container/seccomp/libseccomp_test.go9
1 files changed, 6 insertions, 3 deletions
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
}