fix: userspace prebuild test.

This commit is contained in:
Alexandre Pujol 2024-05-30 14:18:57 +01:00
parent cfd4786f76
commit fd46c0de30
Failed to generate hash of commit

View file

@ -7,6 +7,8 @@ package builder
import ( import (
"slices" "slices"
"testing" "testing"
"github.com/roddhjav/apparmor.d/pkg/prebuild/cfg"
) )
func TestBuilder_Apply(t *testing.T) { func TestBuilder_Apply(t *testing.T) {
@ -216,7 +218,7 @@ func TestBuilder_Apply(t *testing.T) {
}`, }`,
}, },
{ {
name: "userspace-1", name: "userspace-2",
b: Builders["userspace"], b: Builders["userspace"],
profile: ` profile: `
profile foo /usr/bin/foo { profile foo /usr/bin/foo {
@ -238,7 +240,7 @@ func TestBuilder_Apply(t *testing.T) {
} }
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {
opt := &Option{} opt := &Option{File: cfg.RootApparmord.Join(tt.name)}
got, err := tt.b.Apply(opt, tt.profile) got, err := tt.b.Apply(opt, tt.profile)
if (err != nil) != tt.wantErr { if (err != nil) != tt.wantErr {
t.Errorf("Builder.Apply() error = %v, wantErr %v", err, tt.wantErr) t.Errorf("Builder.Apply() error = %v, wantErr %v", err, tt.wantErr)
@ -264,7 +266,6 @@ func TestRegister(t *testing.T) {
}, },
} }
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {
Register(tt.names...) Register(tt.names...)
for _, name := range tt.names { for _, name := range tt.names {