refractor(aa): move some test resource to the testdata dir.

This commit is contained in:
Alexandre Pujol 2024-05-30 20:10:45 +01:00
parent 89abbae6bd
commit 4282fb336e
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
8 changed files with 25 additions and 15 deletions

View file

@ -5,10 +5,15 @@
package logs
import (
"path/filepath"
"reflect"
"testing"
)
var (
testdata = "../../tests/testdata/logs"
)
func TestGetJournalctlLogs(t *testing.T) {
tests := []struct {
name string
@ -19,7 +24,7 @@ func TestGetJournalctlLogs(t *testing.T) {
{
name: "gsd-xsettings",
useFile: true,
path: "../../tests/systemd.log",
path: filepath.Join(testdata, "systemd.log"),
want: AppArmorLogs{
{
"apparmor": "ALLOWED",
@ -60,8 +65,8 @@ func TestSelectLogFile(t *testing.T) {
}{
{
name: "Get audit.log",
path: "../../tests/audit.log",
want: "../../tests/audit.log",
path: filepath.Join(testdata, "audit.log"),
want: filepath.Join(testdata, "audit.log"),
},
{
name: "Get /var/log/audit/audit.log.1",

View file

@ -188,7 +188,7 @@ func TestNewApparmorLogs(t *testing.T) {
}{
{
name: "dnsmasq",
path: "../../tests/audit.log",
path: filepath.Join(testdata, "audit.log"),
want: AppArmorLogs{
{
"apparmor": "DENIED",
@ -233,17 +233,17 @@ func TestNewApparmorLogs(t *testing.T) {
},
{
name: "kmod",
path: "../../tests/audit.log",
path: filepath.Join(testdata, "audit.log"),
want: refKmod,
},
{
name: "man",
path: "../../tests/audit.log",
path: filepath.Join(testdata, "audit.log"),
want: refMan,
},
{
name: "power-profiles-daemon",
path: "../../tests/audit.log",
path: filepath.Join(testdata, "audit.log"),
want: refPowerProfiles,
},
}