Skip to content

Commit eaa1fdb

Browse files
committed
Implement FIPS filter in testmain
1 parent 585a32f commit eaa1fdb

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

pkg/testing/define/define.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ func runOrSkip(t *testing.T, req Requirements, local bool, kubernetes bool) *Inf
155155
t.Skipf("sudo requirement %t not matching sudo filter %t. Skipping", req.Sudo, *SudoFilter.value)
156156
}
157157

158+
if FipsFilter.value != nil && req.FIPS != *FipsFilter.value {
159+
t.Skipf("FIPS requirement %t not matching FIPS filter %t. Skipping.", req.FIPS, *FipsFilter.value)
160+
}
161+
158162
// record autodiscover after filtering by group and sudo and before validating against the actual environment
159163
if AutoDiscover {
160164
discoverTest(t, req)

pkg/testing/define/define_flags.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ var (
5050
GroupsFilter stringArrayFlag
5151
PlatformsFilter stringArrayFlag
5252
SudoFilter optionalBoolFlag
53+
FipsFilter optionalBoolFlag
5354
AutoDiscover bool
5455
AutoDiscoveryOutput string
5556
)
@@ -59,6 +60,7 @@ func RegisterFlags(prefix string, set *flag.FlagSet) {
5960
set.Var(&GroupsFilter, prefix+"groups", "test groups, comma-separated")
6061
set.Var(&PlatformsFilter, prefix+"platforms", "test platforms, comma-separated")
6162
set.Var(&SudoFilter, prefix+"sudo", "Filter tests by sudo requirements")
63+
set.Var(&FipsFilter, prefix+"fips", "Filter tests by FIPS requirement")
6264
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")
6365
set.StringVar(&AutoDiscoveryOutput, prefix+"autodiscoveryoutput", "discovered_tests.yaml", "Set the file location where the structured output for the discovered tests will be stored")
6466
}

0 commit comments

Comments
 (0)