Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkg/testing/define/define.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ func runOrSkip(t *testing.T, req Requirements, local bool, kubernetes bool) *Inf
t.Skipf("sudo requirement %t not matching sudo filter %t. Skipping", req.Sudo, *SudoFilter.value)
}

if FipsFilter.value != nil && req.FIPS != *FipsFilter.value {
t.Skipf("FIPS requirement %t not matching FIPS filter %t. Skipping.", req.FIPS, *FipsFilter.value)
}

// record autodiscover after filtering by group and sudo and before validating against the actual environment
if AutoDiscover {
discoverTest(t, req)
Expand Down
2 changes: 2 additions & 0 deletions pkg/testing/define/define_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ var (
GroupsFilter stringArrayFlag
PlatformsFilter stringArrayFlag
SudoFilter optionalBoolFlag
FipsFilter optionalBoolFlag
AutoDiscover bool
AutoDiscoveryOutput string
)
Expand All @@ -59,6 +60,7 @@ func RegisterFlags(prefix string, set *flag.FlagSet) {
set.Var(&GroupsFilter, prefix+"groups", "test groups, comma-separated")
set.Var(&PlatformsFilter, prefix+"platforms", "test platforms, comma-separated")
set.Var(&SudoFilter, prefix+"sudo", "Filter tests by sudo requirements")
set.Var(&FipsFilter, prefix+"fips", "Filter tests by FIPS requirement")
set.BoolVar(&AutoDiscover, prefix+"autodiscover", false, "Auto discover tests (should be used together with -dry-run). Output will be a file that can be set with -autodiscoveryoutput")
set.StringVar(&AutoDiscoveryOutput, prefix+"autodiscoveryoutput", "discovered_tests.yaml", "Set the file location where the structured output for the discovered tests will be stored")
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/testing/define/requirements.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ type Requirements struct {
// Sudo defines that this test must run under superuser permissions. On Mac and Linux the
// test gets executed under sudo and on Windows it gets run under Administrator.
Sudo bool `json:"sudo"`

// FIPS defines that this test must be run in an environment that is configured for FIPS,
// e.g. a Linux VM with OpenSSL configured with the FIPS provider.
FIPS bool `json:"fips"`
}

// Validate returns an error if not valid.
Expand Down