diff options
author | Valentin Rothberg <vrothberg@suse.com> | 2018-08-13 14:41:10 +0200 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-08-14 14:25:14 +0000 |
commit | 31e0dea5a020af9f1bf4d5d3a8e40fc1b2882474 (patch) | |
tree | 79359553e5b1043362e1633702be1cbaa9a60410 /pkg/apparmor/apparmor_linux_test.go | |
parent | 70b44848119def655b836efa47dbfebde32e1bcb (diff) | |
download | podman-31e0dea5a020af9f1bf4d5d3a8e40fc1b2882474.tar.gz podman-31e0dea5a020af9f1bf4d5d3a8e40fc1b2882474.tar.bz2 podman-31e0dea5a020af9f1bf4d5d3a8e40fc1b2882474.zip |
pkg/apparmor: move all linux-code into apparmor_linux*
For easier maintenance and clearer structure of the code.
Signed-off-by: Valentin Rothberg <vrothberg@suse.com>
Closes: #1262
Approved by: mheon
Diffstat (limited to 'pkg/apparmor/apparmor_linux_test.go')
-rw-r--r-- | pkg/apparmor/apparmor_linux_test.go | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/pkg/apparmor/apparmor_linux_test.go b/pkg/apparmor/apparmor_linux_test.go new file mode 100644 index 000000000..4aa3753d9 --- /dev/null +++ b/pkg/apparmor/apparmor_linux_test.go @@ -0,0 +1,78 @@ +// +build linux,apparmor + +package apparmor + +import ( + "testing" +) + +type versionExpected struct { + output string + version int +} + +func TestParseAAParserVersion(t *testing.T) { + if !IsEnabled() { + t.Skip("AppArmor disabled: skipping tests") + } + versions := []versionExpected{ + { + output: `AppArmor parser version 2.10 +Copyright (C) 1999-2008 Novell Inc. +Copyright 2009-2012 Canonical Ltd. + +`, + version: 210000, + }, + { + output: `AppArmor parser version 2.8 +Copyright (C) 1999-2008 Novell Inc. +Copyright 2009-2012 Canonical Ltd. + +`, + version: 208000, + }, + { + output: `AppArmor parser version 2.20 +Copyright (C) 1999-2008 Novell Inc. +Copyright 2009-2012 Canonical Ltd. + +`, + version: 220000, + }, + { + output: `AppArmor parser version 2.05 +Copyright (C) 1999-2008 Novell Inc. +Copyright 2009-2012 Canonical Ltd. + +`, + version: 205000, + }, + { + output: `AppArmor parser version 2.9.95 +Copyright (C) 1999-2008 Novell Inc. +Copyright 2009-2012 Canonical Ltd. + +`, + version: 209095, + }, + { + output: `AppArmor parser version 3.14.159 +Copyright (C) 1999-2008 Novell Inc. +Copyright 2009-2012 Canonical Ltd. + +`, + version: 314159, + }, + } + + for _, v := range versions { + version, err := parseAAParserVersion(v.output) + if err != nil { + t.Fatalf("expected error to be nil for %#v, got: %v", v, err) + } + if version != v.version { + t.Fatalf("expected version to be %d, was %d, for: %#v\n", v.version, version, v) + } + } +} |