Documentation ¶
Index ¶
- Variables
- func AddAllMessages(at *models.AuditBench, isSucceeded bool) []*models.AuditBench
- func AddFailedMessages(at *models.AuditBench, isSucceeded bool) []*models.AuditBench
- func FilterAuditTests(predicates []filters.Predicate, predicateParams []string, ...) *models.SubCategory
- func RunPredicateChain(predicates []filters.Predicate, predicateParams []string, size int, ...) *models.SubCategory
- type AuditTestLoader
- type CmdEvaluator
- type OpenshiftAudit
- type ResultProcessor
- type TestLoader
Constants ¶
This section is empty.
Variables ¶
var ClassicOutputGenerator ui.OutputGenerator = func(at []*models.SubCategory, log *logger.OsOrdealLogger) { grandTotal := make([]models.AuditTestTotals, 0) for _, a := range at { log.Console(fmt.Sprintf("%s %s\n", "[Category]", a.Name)) categoryTotal := printClassicTestResults(a.AuditTests, log) grandTotal = append(grandTotal, categoryTotal) } log.Console(printFinalResults(grandTotal)) }
ClassicOutputGenerator print audit tests to stdout in classic view
var ConsoleOutputGenerator ui.OutputGenerator = func(at []*models.SubCategory, log *logger.OsOrdealLogger) { grandTotal := make([]models.AuditTestTotals, 0) table := tablewriter.NewWriter(os.Stdout) table.SetHeader([]string{"Category", "Status", "Type", "Audit Test Description"}) table.SetAutoWrapText(false) table.SetBorder(true) for _, a := range at { categoryTotal := printTestResults(a.AuditTests, table, a.Name) grandTotal = append(grandTotal, categoryTotal) } table.SetAutoMergeCellsByColumnIndex([]int{0}) table.SetRowLine(true) table.Render() log.Console(printFinalResults(grandTotal)) }
ConsoleOutputGenerator print audit tests to stdout
var ReportOutputGenerator ui.OutputGenerator = func(at []*models.SubCategory, log *logger.OsOrdealLogger) { for _, a := range at { log.Table(reports.GenerateAuditReport(a.AuditTests)) } }
ReportOutputGenerator print failed audit test to human report
Functions ¶
func AddAllMessages ¶
func AddAllMessages(at *models.AuditBench, isSucceeded bool) []*models.AuditBench
AddAllMessages add all audit test to report data
func AddFailedMessages ¶
func AddFailedMessages(at *models.AuditBench, isSucceeded bool) []*models.AuditBench
AddFailedMessages add failed audit test to report data
func FilterAuditTests ¶
func FilterAuditTests(predicates []filters.Predicate, predicateParams []string, at *models.SubCategory) *models.SubCategory
FilterAuditTests filter audit tests by predicate chain
func RunPredicateChain ¶
func RunPredicateChain(predicates []filters.Predicate, predicateParams []string, size int, at *models.SubCategory) *models.SubCategory
RunPredicateChain call every predicate in chain and filter tests
Types ¶
type AuditTestLoader ¶
type AuditTestLoader struct { }
AuditTestLoader object
func (AuditTestLoader) LoadAuditTests ¶
func (tl AuditTestLoader) LoadAuditTests(auditFiles []utils.FilesInfo) []*models.SubCategory
LoadAuditTests load audit test from benchmark folder
type CmdEvaluator ¶
type CmdEvaluator interface { EvalCommand(commands []string, evalExpr string) eval.CmdEvalResult EvalCommandPolicy(commands []string, evalExpr string, policy string) eval.CmdEvalResult }
CmdEvaluator interface expose one method to evaluate command with evalExpr openshift-audit.go
type OpenshiftAudit ¶
type OpenshiftAudit struct { ResultProcessor ResultProcessor OutputGenerator ui.OutputGenerator FileLoader TestLoader PredicateChain []filters.Predicate PredicateParams []string PlChan chan m2.OpenshiftAuditResults CompletedChan chan bool FilesInfo []utils.FilesInfo Evaluator eval.CmdEvaluator // contains filtered or unexported fields }
OpenshiftAudit openshift benchmark object
func NewopenshiftAudit ¶
func NewopenshiftAudit(filters []string, plChan chan m2.OpenshiftAuditResults, completedChan chan bool, fi []utils.FilesInfo, evaluator CmdEvaluator) *OpenshiftAudit
NewopenshiftAudit new audit object
func (OpenshiftAudit) Help ¶
func (ldx OpenshiftAudit) Help() string
Help return benchmark command help
func (*OpenshiftAudit) Run ¶
func (ldx *OpenshiftAudit) Run(args []string) int
Run execute the full openshift benchmark
type ResultProcessor ¶
type ResultProcessor func(at *models.AuditBench, isSucceeded bool) []*models.AuditBench
ResultProcessor process audit results
func GetResultProcessingFunction ¶
func GetResultProcessingFunction(args []string) ResultProcessor
GetResultProcessingFunction return processing function by specificTests
type TestLoader ¶
type TestLoader interface {
LoadAuditTests(fi []utils.FilesInfo) []*models.SubCategory
}
TestLoader load tests from filesystem command-helper.go