build: improve attachments resolution.

This commit is contained in:
Alexandre Pujol 2023-04-24 12:51:16 +01:00
parent 38d310c62a
commit 7a70252e26
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
2 changed files with 30 additions and 7 deletions

View file

@ -93,6 +93,34 @@ func TestAppArmorProfile_ParseVariables(t *testing.T) {
}
}
func TestAppArmorProfile_resolve(t *testing.T) {
tests := []struct {
name string
variables map[string][]string
input string
want []string
}{
{
name: "empty",
variables: Tunables,
input: "@{}",
want: []string{"@{}"},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
p := &AppArmorProfile{
Content: "",
Variables: tt.variables,
Attachments: []string{},
}
if got := p.resolve(tt.input); !reflect.DeepEqual(got, tt.want) {
t.Errorf("AppArmorProfile.resolve() = %v, want %v", got, tt.want)
}
})
}
}
func TestAppArmorProfile_ResolveAttachments(t *testing.T) {
tests := []struct {
name string