test: add more profile sorting test.
This commit is contained in:
parent
c0bc903101
commit
95c322d62a
2 changed files with 16 additions and 7 deletions
|
|
@ -5,6 +5,13 @@
|
||||||
package aa
|
package aa
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
// Include
|
||||||
|
includeLocal1 = &Include{
|
||||||
|
IfExists: true,
|
||||||
|
IsMagic: true,
|
||||||
|
Path: "local/foo",
|
||||||
|
}
|
||||||
|
|
||||||
// Capability
|
// Capability
|
||||||
capability1Log = map[string]string{
|
capability1Log = map[string]string{
|
||||||
"apparmor": "ALLOWED",
|
"apparmor": "ALLOWED",
|
||||||
|
|
|
||||||
|
|
@ -155,11 +155,7 @@ func TestAppArmorProfile_String(t *testing.T) {
|
||||||
Path: "@{sys}/devices/pci[0-9]*/**/class",
|
Path: "@{sys}/devices/pci[0-9]*/**/class",
|
||||||
Access: "r",
|
Access: "r",
|
||||||
},
|
},
|
||||||
&Include{
|
includeLocal1,
|
||||||
IfExists: true,
|
|
||||||
IsMagic: true,
|
|
||||||
Path: "local/foo",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -276,12 +272,18 @@ func TestAppArmorProfile_Sort(t *testing.T) {
|
||||||
name: "all",
|
name: "all",
|
||||||
origin: &AppArmorProfile{
|
origin: &AppArmorProfile{
|
||||||
Profile: Profile{
|
Profile: Profile{
|
||||||
Rules: []ApparmorRule{file2, network1, dbus2, signal1, ptrace1, capability2, file1, dbus1, unix2, signal2, mount2},
|
Rules: []ApparmorRule{
|
||||||
|
file2, network1, includeLocal1, dbus2, signal1, ptrace1,
|
||||||
|
capability2, file1, dbus1, unix2, signal2, mount2,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
want: &AppArmorProfile{
|
want: &AppArmorProfile{
|
||||||
Profile: Profile{
|
Profile: Profile{
|
||||||
Rules: []ApparmorRule{capability2, network1, mount2, signal1, signal2, ptrace1, unix2, dbus2, dbus1, file2, file1},
|
Rules: []ApparmorRule{
|
||||||
|
capability2, network1, mount2, signal1, signal2, ptrace1,
|
||||||
|
unix2, dbus2, dbus1, file1, file2, includeLocal1,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue