Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Predicate ¶
type Predicate func(tests *models.SubCategory, params string) *models.SubCategory
Predicate filter audit tests cmd criteria
var Basic Predicate = func(tests *models.SubCategory, params string) *models.SubCategory {
return tests
}
Basic filter by specific audit tests as set in command
var ExcludeAudit Predicate = func(tests *models.SubCategory, params string) *models.SubCategory { sat := make([]*models.AuditBench, 0) spt := utils.GetAuditTestsList("e", params) for _, sp := range spt { if strings.HasPrefix(tests.Name, sp) { return &models.SubCategory{Name: tests.Name, AuditTests: []*models.AuditBench{}} } } for _, at := range tests.AuditTests { var skipTest bool for _, sp := range spt { if strings.HasPrefix(at.Name, sp) { skipTest = true } } if skipTest { continue } sat = append(sat, at) } return &models.SubCategory{Name: tests.Name, AuditTests: sat} }
ExcludeAudit audit test from been executed
var IncludeAudit Predicate = func(tests *models.SubCategory, params string) *models.SubCategory { sat := make([]*models.AuditBench, 0) spt := utils.GetAuditTestsList("i", params) for _, sp := range spt { if strings.HasPrefix(tests.Name, sp) { return tests } } for _, at := range tests.AuditTests { for _, sp := range spt { if strings.HasPrefix(at.Name, sp) { sat = append(sat, at) } } } if len(sat) == 0 { return &models.SubCategory{Name: tests.Name, AuditTests: make([]*models.AuditBench, 0)} } return &models.SubCategory{Name: tests.Name, AuditTests: sat} }
IncludeAudit include audit tests , only included tests will be executed
var NodeAudit Predicate = func(tests *models.SubCategory, params string) *models.SubCategory { sat := make([]*models.AuditBench, 0) spt := utils.GetAuditTestsList("n", params) for _, at := range tests.AuditTests { for _, sp := range spt { if strings.ToLower(at.ProfileApplicability) == sp { sat = append(sat, at) } } } if len(sat) == 0 { return &models.SubCategory{Name: tests.Name, AuditTests: make([]*models.AuditBench, 0)} } return &models.SubCategory{Name: tests.Name, AuditTests: sat} }
NodeAudit audit test from been executed
Click to show internal directories.
Click to hide internal directories.