github.com/moby/docker@v26.1.3+incompatible/oci/seccomp_test.go (about) 1 //go:build linux 2 3 package oci 4 5 import ( 6 "encoding/json" 7 "os" 8 "testing" 9 10 "github.com/docker/docker/profiles/seccomp" 11 ) 12 13 func TestSeccompLoadProfile(t *testing.T) { 14 profiles := []string{"default.json", "default-old-format.json", "example.json"} 15 16 for _, p := range profiles { 17 t.Run(p, func(t *testing.T) { 18 f, err := os.ReadFile("fixtures/" + p) 19 if err != nil { 20 t.Fatal(err) 21 } 22 rs := DefaultLinuxSpec() 23 if _, err := seccomp.LoadProfile(string(f), &rs); err != nil { 24 t.Fatal(err) 25 } 26 }) 27 } 28 } 29 30 func TestSeccompLoadDefaultProfile(t *testing.T) { 31 b, err := json.Marshal(seccomp.DefaultProfile()) 32 if err != nil { 33 t.Fatal(err) 34 } 35 rs := DefaultLinuxSpec() 36 if _, err := seccomp.LoadProfile(string(b), &rs); err != nil { 37 t.Fatal(err) 38 } 39 }