|
| 1 | +// windows-machine-config-operator-tests-ext is the OTE (OpenShift Tests Extension) |
| 2 | +// binary for Windows Containers tests. Tests are registered as plain Go functions |
| 3 | +// using upstream Ginkgo, without the OpenShift Ginkgo fork. |
| 4 | +// |
| 5 | +// References: |
| 6 | +// - OTE Integration Guide: https://github.com/openshift-eng/openshift-tests-extension |
| 7 | +package main |
| 8 | + |
| 9 | +import ( |
| 10 | + "context" |
| 11 | + "os" |
| 12 | + |
| 13 | + "github.com/spf13/cobra" |
| 14 | + |
| 15 | + otecmd "github.com/openshift-eng/openshift-tests-extension/pkg/cmd" |
| 16 | + e "github.com/openshift-eng/openshift-tests-extension/pkg/extension" |
| 17 | + et "github.com/openshift-eng/openshift-tests-extension/pkg/extension/extensiontests" |
| 18 | + |
| 19 | + "github.com/openshift/windows-machine-config-operator/test/extended" |
| 20 | + "github.com/openshift/windows-machine-config-operator/test/extended/utils" |
| 21 | +) |
| 22 | + |
| 23 | +func main() { |
| 24 | + registry := e.NewRegistry() |
| 25 | + ext := e.NewExtension("openshift", "payload", "windows-machine-config-operator") |
| 26 | + |
| 27 | + // All WINC tests - used for full runs and informing jobs. |
| 28 | + ext.AddSuite(e.Suite{ |
| 29 | + Name: "windows/all", |
| 30 | + Qualifiers: []string{ |
| 31 | + `name.contains("[sig-windows]")`, |
| 32 | + }, |
| 33 | + }) |
| 34 | + |
| 35 | + // Parallel subset: non-Serial, non-Slow, non-Disruptive tests. |
| 36 | + ext.AddSuite(e.Suite{ |
| 37 | + Name: "windows/parallel", |
| 38 | + Qualifiers: []string{ |
| 39 | + `name.contains("[sig-windows]") && !name.contains("[Serial]") && !name.contains("[Slow]") && !name.contains("[Disruptive]")`, |
| 40 | + }, |
| 41 | + }) |
| 42 | + |
| 43 | + // Serial subset: tests that must run in isolation. |
| 44 | + ext.AddSuite(e.Suite{ |
| 45 | + Name: "windows/serial", |
| 46 | + Qualifiers: []string{ |
| 47 | + `name.contains("[sig-windows]") && name.contains("[Serial]")`, |
| 48 | + }, |
| 49 | + }) |
| 50 | + |
| 51 | + // Storage-specific tests. |
| 52 | + ext.AddSuite(e.Suite{ |
| 53 | + Name: "windows/storage", |
| 54 | + Qualifiers: []string{ |
| 55 | + `name.contains("[sig-windows]") && name.contains("storage")`, |
| 56 | + }, |
| 57 | + }) |
| 58 | + |
| 59 | + // Register test specs manually — no OpenShift Ginkgo fork required. |
| 60 | + specs := et.ExtensionTestSpecs{ |
| 61 | + { |
| 62 | + Name: "[sig-windows] Windows_Containers Author:rrasouli-Smokerun-Medium-37362-[wmco] wmco using correct golang version [OTP]", |
| 63 | + Run: func(ctx context.Context) *et.ExtensionTestResult { |
| 64 | + if err := extended.CheckWmcoGolangVersion(ctx, utils.NewCLIWithoutNamespace()); err != nil { |
| 65 | + return &et.ExtensionTestResult{Result: et.ResultFailed, Output: err.Error()} |
| 66 | + } |
| 67 | + return &et.ExtensionTestResult{Result: et.ResultPassed} |
| 68 | + }, |
| 69 | + }, |
| 70 | + } |
| 71 | + |
| 72 | + ext.AddSpecs(specs) |
| 73 | + registry.Register(ext) |
| 74 | + |
| 75 | + root := &cobra.Command{ |
| 76 | + Use: "windows-machine-config-operator-tests-ext", |
| 77 | + Short: "OpenShift Windows Containers test extension (OTE)", |
| 78 | + Long: "Runs the WINC test suite as an OpenShift Tests Extension binary.", |
| 79 | + } |
| 80 | + |
| 81 | + root.AddCommand(otecmd.DefaultExtensionCommands(registry)...) |
| 82 | + |
| 83 | + if err := root.Execute(); err != nil { |
| 84 | + os.Exit(1) |
| 85 | + } |
| 86 | +} |
0 commit comments