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

View file

@ -9,7 +9,7 @@ import (
"testing"
)
func TestRule_FromLog(t *testing.T) {
func TestRules_FromLog(t *testing.T) {
tests := []struct {
name string
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 {
name string
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 {
name string
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 {
name string
rule Rule
@ -417,7 +417,7 @@ func TestRule_String(t *testing.T) {
{
name: "mount",
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",