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