feat(prebuild): make prebuild available as an external package.
Usefull for downstream repo.
This commit is contained in:
parent
538da05696
commit
913ac3131c
13 changed files with 304 additions and 214 deletions
|
|
@ -8,6 +8,8 @@ import (
|
|||
"os"
|
||||
"os/exec"
|
||||
"testing"
|
||||
|
||||
"github.com/roddhjav/apparmor.d/pkg/prebuild"
|
||||
)
|
||||
|
||||
func chdirGitRoot() {
|
||||
|
|
@ -22,7 +24,7 @@ func chdirGitRoot() {
|
|||
}
|
||||
}
|
||||
|
||||
func Test_aaPrebuild(t *testing.T) {
|
||||
func Test_AAPrebuild(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
wantErr bool
|
||||
|
|
@ -58,20 +60,24 @@ func Test_aaPrebuild(t *testing.T) {
|
|||
complain: true,
|
||||
dist: "opensuse",
|
||||
},
|
||||
{
|
||||
name: "Build for Fedora",
|
||||
wantErr: true,
|
||||
full: false,
|
||||
complain: false,
|
||||
dist: "fedora",
|
||||
},
|
||||
// {
|
||||
// name: "Build for Fedora",
|
||||
// wantErr: true,
|
||||
// full: false,
|
||||
// complain: false,
|
||||
// dist: "fedora",
|
||||
// },
|
||||
}
|
||||
chdirGitRoot()
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
Distribution = tt.dist
|
||||
Complain = tt.complain
|
||||
Full = tt.full
|
||||
prebuild.Distribution = tt.dist
|
||||
if tt.full {
|
||||
prebuild.Prepares = append(prebuild.Prepares, prebuild.SetFullSystemPolicy)
|
||||
}
|
||||
if tt.complain {
|
||||
prebuild.Builds = append(prebuild.Builds, prebuild.BuildComplain)
|
||||
}
|
||||
if err := aaPrebuild(); (err != nil) != tt.wantErr {
|
||||
t.Errorf("aaPrebuild() error = %v, wantErr %v", err, tt.wantErr)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue