diff --git a/apparmor.d/tunables/home.d/apparmor.d b/apparmor.d/tunables/home.d/apparmor.d index 963e4bc8..c23a8d95 100644 --- a/apparmor.d/tunables/home.d/apparmor.d +++ b/apparmor.d/tunables/home.d/apparmor.d @@ -67,4 +67,4 @@ @{user_torrents_dirs}=@{HOME}/@{XDG_TORRENTS_DIR} @{MOUNTS}/@{XDG_TORRENTS_DIR} @{user_vm_dirs}=@{HOME}/@{XDG_VM_DIR} @{MOUNTS}/@{XDG_VM_DIR} -# vim:syntax=apparmor \ No newline at end of file +# vim:syntax=apparmor diff --git a/pkg/aa/apparmor_test.go b/pkg/aa/apparmor_test.go index a580e7e5..ffdf107d 100644 --- a/pkg/aa/apparmor_test.go +++ b/pkg/aa/apparmor_test.go @@ -6,6 +6,7 @@ package aa import ( "reflect" + "strings" "testing" "github.com/roddhjav/apparmor.d/pkg/paths" @@ -17,6 +18,13 @@ var ( intData = paths.New("../../apparmor.d") ) +// mustReadProfileFile read a file and return its content as a slice of string. +// It panics if an error occurs. It removes the last comment line. +func mustReadProfileFile(path *paths.Path) string { + res := strings.Split(util.MustReadFile(path), "\n") + return strings.Join(res[:len(res)-2], "\n") +} + func TestAppArmorProfileFile_String(t *testing.T) { tests := []struct { name string @@ -230,7 +238,7 @@ func TestAppArmorProfileFile_Integration(t *testing.T) { }, }}, }, - want: util.MustReadFile(intData.Join("profiles-a-f/aa-status")), + want: mustReadProfileFile(intData.Join("profiles-a-f/aa-status")), }, } for _, tt := range tests {