-
Notifications
You must be signed in to change notification settings - Fork 74
WINC-1966: OTE Migration Batch 1 - Node Basics & Validation #4279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rrasouli
wants to merge
1
commit into
openshift:master
Choose a base branch
from
rrasouli:winc-1966-ote-batch1-node-basics
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| reviewers: | ||
| - rrasouli | ||
| - weinliu | ||
| - jrvaldes | ||
| - mansikulkarni96 | ||
| approvers: | ||
| - rrasouli | ||
| - weinliu | ||
| - jrvaldes | ||
| - mansikulkarni96 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,83 +1,128 @@ | ||
| // windows-machine-config-operator-tests-ext is the OTE (OpenShift Tests Extension) | ||
| // binary for Windows Containers tests. Tests are registered as plain Go functions | ||
| // using upstream Ginkgo, without the OpenShift Ginkgo fork. | ||
|
mansikulkarni96 marked this conversation as resolved.
|
||
| // wmco-tests-ext is the OTE (OpenShift Tests Extension) binary for WMCO. | ||
| // Tests are standard Ginkgo g.Describe/g.It blocks under ote/test/e2e/. | ||
| // BuildExtensionTestSpecsFromOpenShiftGinkgoSuite() discovers them automatically, | ||
| // so adding a new test only requires a new g.It block -- no registration code needed. | ||
| // | ||
| // References: | ||
| // - OTE Integration Guide: https://github.com/openshift-eng/openshift-tests-extension | ||
| // - OTE framework: https://github.com/openshift-eng/openshift-tests-extension | ||
| // - Migration epic: https://issues.redhat.com/browse/WINC-1536 | ||
| package main | ||
|
|
||
| import ( | ||
| "context" | ||
| "fmt" | ||
| "os" | ||
| "regexp" | ||
| "strings" | ||
|
|
||
| otecmd "github.com/openshift-eng/openshift-tests-extension/pkg/cmd" | ||
| "github.com/openshift-eng/openshift-tests-extension/pkg/cmd" | ||
| e "github.com/openshift-eng/openshift-tests-extension/pkg/extension" | ||
| et "github.com/openshift-eng/openshift-tests-extension/pkg/extension/extensiontests" | ||
| g "github.com/openshift-eng/openshift-tests-extension/pkg/ginkgo" | ||
| "github.com/openshift/origin/test/extended/util" | ||
| compat_otp "github.com/openshift/origin/test/extended/util/compat_otp" | ||
| "github.com/spf13/cobra" | ||
| "k8s.io/component-base/logs" | ||
|
mansikulkarni96 marked this conversation as resolved.
|
||
| framework "k8s.io/kubernetes/test/e2e/framework" | ||
|
|
||
| "github.com/openshift/windows-machine-config-operator/ote/test/extended" | ||
| "github.com/openshift/windows-machine-config-operator/ote/test/extended/cli" | ||
| _ "github.com/openshift/windows-machine-config-operator/ote/test/e2e" | ||
| ) | ||
|
|
||
| func main() { | ||
| util.InitStandardFlags() | ||
| framework.AfterReadingAllFlags(&framework.TestContext) | ||
|
|
||
| logs.InitLogs() | ||
| defer logs.FlushLogs() | ||
|
|
||
| registry := e.NewRegistry() | ||
| ext := e.NewExtension("openshift", "payload", "windows-machine-config-operator") | ||
|
|
||
| // All WINC tests - used for full runs and informing jobs. | ||
| // No qualifier needed: all tests in this binary are WINC tests. | ||
| ext.AddSuite(e.Suite{ | ||
| Name: "windows/all", | ||
| }) | ||
| registerSuites(ext) | ||
|
|
||
| // Parallel subset: non-Serial, non-Slow, non-Disruptive tests. | ||
| ext.AddSuite(e.Suite{ | ||
| Name: "windows/parallel", | ||
| Qualifiers: []string{ | ||
| `!name.contains("[Serial]") && !name.contains("[Slow]") && !name.contains("[Disruptive]")`, | ||
| }, | ||
| }) | ||
| allSpecs, err := g.BuildExtensionTestSpecsFromOpenShiftGinkgoSuite() | ||
| if err != nil { | ||
| panic(fmt.Sprintf("couldn't build extension test specs from ginkgo: %+v", err.Error())) | ||
| } | ||
|
|
||
| // Serial subset: tests that must run in isolation. | ||
| ext.AddSuite(e.Suite{ | ||
| Name: "windows/serial", | ||
| Qualifiers: []string{ | ||
| `name.contains("[Serial]")`, | ||
| }, | ||
| componentSpecs := allSpecs.Select(func(spec *et.ExtensionTestSpec) bool { | ||
| for _, loc := range spec.CodeLocations { | ||
| if strings.Contains(loc, "/test/e2e/") && | ||
| !strings.Contains(loc, "/go/pkg/mod/") && | ||
| !strings.Contains(loc, "/vendor/") { | ||
| return true | ||
| } | ||
| } | ||
| return false | ||
| }) | ||
|
|
||
| // Storage-specific tests. | ||
| ext.AddSuite(e.Suite{ | ||
| Name: "windows/storage", | ||
| Qualifiers: []string{ | ||
| `name.contains("storage")`, | ||
| }, | ||
| componentSpecs.AddBeforeAll(func() { | ||
| if err := compat_otp.InitTest(false); err != nil { | ||
| panic(err) | ||
| } | ||
| util.WithCleanup(func() {}) | ||
| }) | ||
|
|
||
| // Register test specs manually — no OpenShift Ginkgo fork required. | ||
| specs := et.ExtensionTestSpecs{ | ||
| { | ||
| Name: "[sig-windows] Windows_Containers Author:rrasouli-Smokerun-Medium-37362-[wmco] wmco using correct golang version [OTP]", | ||
| Run: func(ctx context.Context) *et.ExtensionTestResult { | ||
| if err := extended.CheckWmcoGolangVersion(ctx, cli.NewCLIWithoutNamespace()); err != nil { | ||
| return &et.ExtensionTestResult{Result: et.ResultFailed, Output: err.Error()} | ||
| } | ||
| return &et.ExtensionTestResult{Result: et.ResultPassed} | ||
| }, | ||
| }, | ||
| } | ||
| componentSpecs.Walk(func(spec *et.ExtensionTestSpec) { | ||
| for label := range spec.Labels { | ||
| if strings.HasPrefix(label, "Platform:") { | ||
| platformName := strings.TrimPrefix(label, "Platform:") | ||
| spec.Include(et.PlatformEquals(platformName)) | ||
| } | ||
| } | ||
| re := regexp.MustCompile(`\[platform:([a-z]+)\]`) | ||
| if match := re.FindStringSubmatch(spec.Name); match != nil { | ||
| spec.Include(et.PlatformEquals(match[1])) | ||
| } | ||
| spec.Lifecycle = et.LifecycleInforming | ||
| }) | ||
|
|
||
| ext.AddSpecs(specs) | ||
| ext.AddSpecs(componentSpecs) | ||
| registry.Register(ext) | ||
|
|
||
| root := &cobra.Command{ | ||
| Use: "windows-machine-config-operator-tests-ext", | ||
| Short: "OpenShift Windows Containers test extension (OTE)", | ||
| Long: "Runs the WINC test suite as an OpenShift Tests Extension binary.", | ||
| Use: "wmco-tests-ext", | ||
| Short: "WMCO OpenShift Tests Extension (OTE) binary", | ||
| Long: "Windows Machine Config Operator Tests", | ||
| } | ||
| root.AddCommand(cmd.DefaultExtensionCommands(registry)...) | ||
|
|
||
| root.AddCommand(otecmd.DefaultExtensionCommands(registry)...) | ||
|
|
||
| if err := root.Execute(); err != nil { | ||
| if err := func() error { | ||
| return root.Execute() | ||
| }(); err != nil { | ||
| os.Exit(1) | ||
| } | ||
| } | ||
|
|
||
| func registerSuites(ext *e.Extension) { | ||
| suites := []e.Suite{ | ||
| { | ||
| Name: "windows-machine-config-operator/conformance/parallel", | ||
| Parents: []string{"openshift/conformance/parallel"}, | ||
| Qualifiers: []string{ | ||
| `name.contains("[Level0]") && !(name.contains("[Serial]") || name.contains("[Disruptive]"))`, | ||
| }, | ||
| }, | ||
| { | ||
| Name: "windows-machine-config-operator/conformance/serial", | ||
| Parents: []string{"openshift/conformance/serial"}, | ||
| Qualifiers: []string{ | ||
| `name.contains("[Level0]") && name.contains("[Serial]") && !name.contains("[Disruptive]")`, | ||
| }, | ||
| }, | ||
| { | ||
| Name: "windows-machine-config-operator/disruptive", | ||
| Parents: []string{"openshift/disruptive"}, | ||
| Qualifiers: []string{`name.contains("[Disruptive]")`}, | ||
| }, | ||
| { | ||
| Name: "windows-machine-config-operator/non-disruptive", | ||
| Qualifiers: []string{`!name.contains("[Disruptive]")`}, | ||
| }, | ||
| { | ||
| Name: "windows-machine-config-operator/all", | ||
| }, | ||
| } | ||
| for _, suite := range suites { | ||
| ext.AddSuite(suite) | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.