mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
seccomp: add test for unmarshal default profile
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
97535c6c2b
commit
a692823413
1 changed files with 23 additions and 0 deletions
|
@ -3,10 +3,12 @@
|
|||
package seccomp // import "github.com/docker/docker/profiles/seccomp"
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"testing"
|
||||
|
||||
"github.com/opencontainers/runtime-spec/specs-go"
|
||||
"gotest.tools/v3/assert"
|
||||
)
|
||||
|
||||
func TestLoadProfile(t *testing.T) {
|
||||
|
@ -44,6 +46,27 @@ func TestLoadDefaultProfile(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestUnmarshalDefaultProfile(t *testing.T) {
|
||||
expected := DefaultProfile()
|
||||
if expected == nil {
|
||||
t.Skip("seccomp not supported")
|
||||
}
|
||||
|
||||
f, err := ioutil.ReadFile("default.json")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var profile Seccomp
|
||||
err = json.Unmarshal(f, &profile)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
assert.DeepEqual(t, expected.Architectures, profile.Architectures)
|
||||
assert.DeepEqual(t, expected.ArchMap, profile.ArchMap)
|
||||
assert.DeepEqual(t, expected.DefaultAction, profile.DefaultAction)
|
||||
assert.DeepEqual(t, expected.Syscalls, profile.Syscalls)
|
||||
}
|
||||
|
||||
func TestLoadConditional(t *testing.T) {
|
||||
f, err := ioutil.ReadFile("fixtures/conditional_include.json")
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Reference in a new issue