test(aa): cleanup unit tests.

This commit is contained in:
Alexandre Pujol 2024-05-04 23:45:36 +01:00
parent f763d31a07
commit 5943e9a24d
Failed to generate hash of commit
2 changed files with 8 additions and 12 deletions

View file

@ -49,7 +49,7 @@ func TestAppArmorProfileFile_String(t *testing.T) {
Attributes: map[string]string{"security.tagged": "allowed"}, Attributes: map[string]string{"security.tagged": "allowed"},
Flags: []string{"complain", "attach_disconnected"}, Flags: []string{"complain", "attach_disconnected"},
}, },
Rules: []Rule{ Rules: Rules{
&Include{IsMagic: true, Path: "abstractions/base"}, &Include{IsMagic: true, Path: "abstractions/base"},
&Include{IsMagic: true, Path: "abstractions/nameservice-strict"}, &Include{IsMagic: true, Path: "abstractions/nameservice-strict"},
rlimit1, rlimit1,
@ -58,7 +58,7 @@ func TestAppArmorProfileFile_String(t *testing.T) {
&Network{Domain: "inet", Type: "stream"}, &Network{Domain: "inet", Type: "stream"},
&Network{Domain: "inet6", Type: "stream"}, &Network{Domain: "inet6", Type: "stream"},
&Mount{ &Mount{
RuleBase: RuleBase{Comment: "failed perms check"}, RuleBase: RuleBase{Comment: " failed perms check"},
MountConditions: MountConditions{ MountConditions: MountConditions{
FsType: "fuse.portal", FsType: "fuse.portal",
Options: []string{"rw", "rbind"}, Options: []string{"rw", "rbind"},
@ -83,11 +83,7 @@ func TestAppArmorProfileFile_String(t *testing.T) {
PeerLabel: "gnome-shell", PeerLabel: "gnome-shell",
PeerAddr: "none", PeerAddr: "none",
}, },
&Dbus{ &Dbus{Access: []string{"bind"}, Bus: "session", Name: "org.gnome.*"},
Access: []string{"bind"},
Bus: "session",
Name: "org.gnome.*",
},
&Dbus{ &Dbus{
Access: []string{"receive"}, Access: []string{"receive"},
Bus: "system", Bus: "system",

View file

@ -9,7 +9,7 @@ import (
"testing" "testing"
) )
func TestRule_FromLog(t *testing.T) { func TestRules_FromLog(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
fromLog func(map[string]string) Rule fromLog func(map[string]string) Rule
@ -98,7 +98,7 @@ func TestRule_FromLog(t *testing.T) {
} }
} }
func TestRule_Less(t *testing.T) { func TestRules_Less(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
rule Rule rule Rule
@ -272,7 +272,7 @@ func TestRule_Less(t *testing.T) {
} }
} }
func TestRule_Equals(t *testing.T) { func TestRules_Equals(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
rule Rule rule Rule
@ -368,7 +368,7 @@ func TestRule_Equals(t *testing.T) {
} }
} }
func TestRule_String(t *testing.T) { func TestRules_String(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
rule Rule rule Rule
@ -417,7 +417,7 @@ func TestRule_String(t *testing.T) {
{ {
name: "mount", name: "mount",
rule: mount1, rule: mount1,
want: "mount fstype=overlay overlay -> /var/lib/docker/overlay2/opaque-bug-check1209538631/merged/, # failed perms check", want: "mount fstype=overlay overlay -> /var/lib/docker/overlay2/opaque-bug-check1209538631/merged/, #failed perms check",
}, },
{ {
name: "pivot_root", name: "pivot_root",