File: seccomp_test.go

package info (click to toggle)
golang-github-seccomp-containers-golang 0.3.2-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 148 kB
  • sloc: makefile: 27; sh: 11
file content (40 lines) | stat: -rw-r--r-- 739 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// +build seccomp

package seccomp // import "github.com/seccomp/containers-golang"

import (
	"io/ioutil"
	"testing"

	"github.com/opencontainers/runtime-tools/generate"
)

func TestLoadProfile(t *testing.T) {
	f, err := ioutil.ReadFile("fixtures/example.json")
	if err != nil {
		t.Fatal(err)
	}
	g, err := generate.New("linux")
	if err != nil {
		t.Fatal(err)
	}
	rs := g.Spec()
	if _, err := LoadProfile(string(f), rs); err != nil {
		t.Fatal(err)
	}
}

func TestLoadDefaultProfile(t *testing.T) {
	f, err := ioutil.ReadFile("seccomp.json")
	if err != nil {
		t.Fatal(err)
	}
	g, err := generate.New("linux")
	if err != nil {
		t.Fatal(err)
	}
	rs := g.Spec()
	if _, err := LoadProfile(string(f), rs); err != nil {
		t.Fatal(err)
	}
}