test(integration): update the test suite.

This commit is contained in:
Alexandre Pujol 2023-09-30 18:15:55 +01:00
parent 0068c1b9a3
commit 2cc7627879
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
3 changed files with 55 additions and 26 deletions

View file

@ -14,11 +14,6 @@ import (
"github.com/roddhjav/apparmor.d/pkg/util"
)
var (
Ignore []string // Do not run some scenarios
Arguments map[string]string // Common arguments used across all scenarios
)
type Tldr struct {
Url string // Tldr download url
Dir *paths.Path // Tldr cache directory
@ -58,7 +53,7 @@ func (t Tldr) Download() error {
}
// Parse the tldr pages and return a list of scenarios
func (t Tldr) Parse(profiles paths.PathList) (*TestSuite, error) {
func (t Tldr) Parse() (*TestSuite, error) {
testSuite := NewTestSuite()
files, _ := t.Dir.ReadDirRecursiveFiltered(nil, paths.FilterOutDirectories())
for _, path := range files {
@ -69,12 +64,10 @@ func (t Tldr) Parse(profiles paths.PathList) (*TestSuite, error) {
raw := string(content)
t := &Test{
Name: strings.TrimSuffix(path.Base(), ".md"),
Profiled: false,
Root: false,
Arguments: map[string]string{},
Commands: []Command{},
}
t.Profiled = t.hasProfile(profiles)
if strings.Contains(raw, "sudo") {
t.Root = true
}