77 "time"
88
99 "github.com/openshift-eng/openshift-tests-extension/pkg/cmd"
10+ et "github.com/openshift-eng/openshift-tests-extension/pkg/extension/extensiontests"
1011 v "github.com/openshift-eng/openshift-tests-extension/pkg/version"
1112 "github.com/openshift/machine-config-operator/pkg/version"
1213 exutil "github.com/openshift/machine-config-operator/test/extended-priv/util"
@@ -20,6 +21,37 @@ import (
2021 _ "github.com/openshift/machine-config-operator/test/extended-priv"
2122)
2223
24+ func applyLabelFilters (specs et.ExtensionTestSpecs ) {
25+ // Apply Platform label filters: tests with Platform:platformname only run on that platform
26+ specs .Walk (func (spec * et.ExtensionTestSpec ) {
27+ for label := range spec .Labels {
28+ if strings .HasPrefix (label , "Platform:" ) {
29+ platformName := strings .TrimPrefix (label , "Platform:" )
30+ spec .Include (et .PlatformEquals (platformName ))
31+ }
32+ }
33+ })
34+
35+ // Apply NoPlatform label filters: tests with NoPlatform:platformname excluded from that platform
36+ specs .Walk (func (spec * et.ExtensionTestSpec ) {
37+ for label := range spec .Labels {
38+ if strings .HasPrefix (label , "NoPlatform:" ) {
39+ platformName := strings .TrimPrefix (label , "NoPlatform:" )
40+ spec .Exclude (et .PlatformEquals (platformName ))
41+ }
42+ }
43+ })
44+
45+ // Exclude tests with "Exclude:REASON" labels
46+ specs .Walk (func (spec * et.ExtensionTestSpec ) {
47+ for label := range spec .Labels {
48+ if strings .HasPrefix (label , "Exclude:" ) {
49+ spec .Exclude ("true" )
50+ }
51+ }
52+ })
53+ }
54+
2355func main () {
2456 // Extension registry
2557 registry := e .NewRegistry ()
@@ -48,6 +80,8 @@ func main() {
4880 panic (fmt .Sprintf ("couldn't build extension test specs from ginkgo: %+v" , err .Error ()))
4981 }
5082
83+ applyLabelFilters (specs )
84+
5185 ext .AddSpecs (specs )
5286 registry .Register (ext )
5387
0 commit comments