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:
Sebastiaan van Stijn 2020-09-28 09:50:03 +02:00
parent ccc1233f37
commit b8aec34680
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
2 changed files with 1606 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -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 {