diff --git a/pkg/testing/define/define.go b/pkg/testing/define/define.go index 989f12d2feb..a1d7f6c2b4b 100644 --- a/pkg/testing/define/define.go +++ b/pkg/testing/define/define.go @@ -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) diff --git a/pkg/testing/define/define_flags.go b/pkg/testing/define/define_flags.go index 841acba8934..1bea5b3a896 100644 --- a/pkg/testing/define/define_flags.go +++ b/pkg/testing/define/define_flags.go @@ -50,6 +50,7 @@ var ( GroupsFilter stringArrayFlag PlatformsFilter stringArrayFlag SudoFilter optionalBoolFlag + FipsFilter optionalBoolFlag AutoDiscover bool AutoDiscoveryOutput string ) @@ -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") } diff --git a/pkg/testing/define/requirements.go b/pkg/testing/define/requirements.go index 952212e1dd4..8a5d9d06d83 100644 --- a/pkg/testing/define/requirements.go +++ b/pkg/testing/define/requirements.go @@ -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.