-
Notifications
You must be signed in to change notification settings - Fork 159
[OCPERT-210] Add OpenShift Tests Extension (OTE) integration by using the automated migration OTE tool #959
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
ming1013
wants to merge
5
commits into
openshift:master
Choose a base branch
from
ming1013:minl_testv2
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
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4299f88
Add OpenShift Tests Extension (OTE) integration by using the automate…
ming1013 9bdcb8c
Remove migration tool from PR
ming1013 0dbed89
Add test/e2e module with OTE dependencies
ming1013 9dd8211
Migrate CCO tests with [OTP] and [Level0] annotations
ming1013 6f473bd
Add OTE integration: extension binary and build infrastructure
ming1013 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
The diff you're trying to view is too large. We only load the first 3000 changed files.
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 |
|---|---|---|
|
|
@@ -5,4 +5,4 @@ | |
| .idea/ | ||
| coverage.out | ||
| /cloud-credential-tests-ext | ||
|
|
||
| /cloud-credential-operator-tests-ext | ||
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
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 |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| package main | ||
|
|
||
| import ( | ||
| "context" | ||
| "fmt" | ||
| "os" | ||
| "regexp" | ||
| "strings" | ||
|
|
||
| "github.com/spf13/cobra" | ||
|
|
||
| "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" | ||
|
|
||
| // Import test framework packages for initialization | ||
| "github.com/openshift/origin/test/extended/util" | ||
| "k8s.io/kubernetes/test/e2e/framework" | ||
|
|
||
| // Import test packages from test module | ||
| _ "github.com/openshift/cloud-credential-operator/test/e2e" | ||
| ) | ||
|
|
||
| func main() { | ||
| // Initialize test framework | ||
| // This sets TestContext.KubeConfig from KUBECONFIG env var and initializes the cloud provider | ||
| util.InitStandardFlags() | ||
| if err := util.InitTest(false); err != nil { | ||
| panic(fmt.Sprintf("couldn't initialize test framework: %+v", err.Error())) | ||
| } | ||
| framework.AfterReadingAllFlags(&framework.TestContext) | ||
|
|
||
| registry := e.NewRegistry() | ||
| ext := e.NewExtension("openshift", "payload", "cco") | ||
|
|
||
| // Add main test suite | ||
| ext.AddSuite(e.Suite{ | ||
| Name: "openshift/cloud-credential-operator/tests", | ||
| Parents: []string{"openshift/conformance/parallel"}, | ||
| }) | ||
|
|
||
| // Build test specs from Ginkgo | ||
| allSpecs, err := g.BuildExtensionTestSpecsFromOpenShiftGinkgoSuite() | ||
| if err != nil { | ||
| panic(fmt.Sprintf("couldn't build extension test specs from ginkgo: %+v", err.Error())) | ||
| } | ||
|
|
||
| // Filter to only include CCO-specific tests (tests with [sig-cco] in name) | ||
| var filteredSpecs []*et.ExtensionTestSpec | ||
| allSpecs.Walk(func(spec *et.ExtensionTestSpec) { | ||
| if strings.Contains(spec.Name, "[sig-cco]") { | ||
| filteredSpecs = append(filteredSpecs, spec) | ||
| } | ||
| }) | ||
| specs := et.ExtensionTestSpecs(filteredSpecs) | ||
|
|
||
| // Apply platform filters based on Platform: labels | ||
| specs.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)) | ||
| } | ||
| } | ||
| }) | ||
|
|
||
| // Apply platform filters based on [platform:xxx] in test names | ||
| specs.Walk(func(spec *et.ExtensionTestSpec) { | ||
| re := regexp.MustCompile(`\[platform:([a-z]+)\]`) | ||
| if match := re.FindStringSubmatch(spec.Name); match != nil { | ||
| platform := match[1] | ||
| spec.Include(et.PlatformEquals(platform)) | ||
| } | ||
| }) | ||
|
|
||
| // Wrap test execution with cleanup handler | ||
| // This marks tests as started and ensures proper cleanup | ||
| specs.Walk(func(spec *et.ExtensionTestSpec) { | ||
| originalRun := spec.Run | ||
| spec.Run = func(ctx context.Context) *et.ExtensionTestResult { | ||
| var result *et.ExtensionTestResult | ||
| util.WithCleanup(func() { | ||
| result = originalRun(ctx) | ||
| }) | ||
| return result | ||
| } | ||
| }) | ||
|
|
||
| ext.AddSpecs(specs) | ||
| registry.Register(ext) | ||
|
|
||
| root := &cobra.Command{ | ||
| Long: "Cloud Credential Operator Tests", | ||
| } | ||
|
|
||
| root.AddCommand(cmd.DefaultExtensionCommands(registry)...) | ||
|
|
||
| if err := func() error { | ||
| return root.Execute() | ||
| }(); err != nil { | ||
| os.Exit(1) | ||
| } | ||
| } | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The OTE test framework has already been added to CCO, so this addition may be redundant.
Perhaps the prompt could be adjusted here to check whether the OTE test framework already exists and whether any update is needed.