mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
seccomp: add test for loading old JSON format
Commit 5ff21add06
changed the (JSON) format that's
used for seccomp profiles, but keeping the code backward compatible to allow both
the old or new format.
This patch adds a new test, which loads the old format. It takes the default seccomp
profile before the format was changed.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
ccc1233f37
commit
b8aec34680
2 changed files with 1606 additions and 0 deletions
1593
profiles/seccomp/fixtures/default-old-format.json
Normal file
1593
profiles/seccomp/fixtures/default-old-format.json
Normal file
File diff suppressed because it is too large
Load diff
|
@ -20,6 +20,19 @@ func TestLoadProfile(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// TestLoadLegacyProfile tests loading a seccomp profile in the old format
|
||||
// (before https://github.com/docker/docker/pull/24510)
|
||||
func TestLoadLegacyProfile(t *testing.T) {
|
||||
f, err := ioutil.ReadFile("fixtures/default-old-format.json")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
rs := oci.DefaultSpec()
|
||||
if _, err := LoadProfile(string(f), &rs); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadDefaultProfile(t *testing.T) {
|
||||
f, err := ioutil.ReadFile("default.json")
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue