diff --git a/pkg/aa/rules_test.go b/pkg/aa/rules_test.go index 70a13a1e..931e90e0 100644 --- a/pkg/aa/rules_test.go +++ b/pkg/aa/rules_test.go @@ -87,6 +87,42 @@ func TestRule_Less(t *testing.T) { other ApparmorRule want bool }{ + { + name: "include1", + rule: include1, + other: includeLocal1, + want: true, + }, + { + name: "include2", + rule: include1, + other: include2, + want: true, + }, + { + name: "include3", + rule: include1, + other: include3, + want: false, + }, + { + name: "rlimit", + rule: rlimit1, + other: rlimit2, + want: false, + }, + { + name: "rlimit2", + rule: rlimit2, + other: rlimit2, + want: false, + }, + { + name: "rlimit3", + rule: rlimit1, + other: rlimit3, + want: false, + }, { name: "capability", rule: capability1, @@ -105,6 +141,18 @@ func TestRule_Less(t *testing.T) { other: mount2, want: false, }, + { + name: "change_profile1", + rule: changeprofile1, + other: changeprofile2, + want: false, + }, + { + name: "change_profile2", + rule: changeprofile1, + other: changeprofile3, + want: true, + }, { name: "signal", rule: signal1, @@ -135,6 +183,12 @@ func TestRule_Less(t *testing.T) { other: dbus1, want: false, }, + { + name: "dbus2", + rule: dbus2, + other: dbus3, + want: false, + }, { name: "file", rule: file1, @@ -157,7 +211,7 @@ func TestRule_Less(t *testing.T) { name: "file/owner", rule: &File{Path: "/usr/share/poppler/cMap/Identity-H", Qualifier: Qualifier{Owner: true}}, other: &File{Path: "/usr/share/poppler/cMap/Identity-H"}, - want: true, + want: false, }, { name: "file/access", @@ -189,6 +243,18 @@ func TestRule_Equals(t *testing.T) { other ApparmorRule want bool }{ + { + name: "include1", + rule: include1, + other: includeLocal1, + want: false, + }, + { + name: "rlimit", + rule: rlimit1, + other: rlimit1, + want: true, + }, { name: "capability/equal", rule: capability1, @@ -207,6 +273,12 @@ func TestRule_Equals(t *testing.T) { other: mount1, want: true, }, + { + name: "change_profile", + rule: changeprofile1, + other: changeprofile2, + want: false, + }, { name: "signal1/equal", rule: signal1,