-
Notifications
You must be signed in to change notification settings - Fork 139
CNTRLPLANE-1275:Refactor OTE to single-module architecture #891
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,5 +3,4 @@ | |
| .idea/ | ||
| _output | ||
| telepresence.log | ||
| .openshift-tests-extension/openshift_payload_*.json | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,105 +1,53 @@ | ||
| package main | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "context" | ||
| "os" | ||
| "strings" | ||
|
|
||
| "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/spf13/cobra" | ||
| "k8s.io/component-base/cli" | ||
|
|
||
| otecmd "github.com/openshift-eng/openshift-tests-extension/pkg/cmd" | ||
| oteextension "github.com/openshift-eng/openshift-tests-extension/pkg/extension" | ||
| "github.com/openshift/cluster-kube-controller-manager-operator/pkg/version" | ||
|
|
||
| // The import below is necessary to ensure that the kube controller manager operator tests are registered with the extension. | ||
| _ "github.com/openshift/cluster-kube-controller-manager-operator/test/extended" | ||
| "k8s.io/klog/v2" | ||
| ) | ||
|
|
||
| func main() { | ||
| registry := e.NewRegistry() | ||
| ext := e.NewExtension("openshift", "payload", "cluster-kube-controller-manager-operator") | ||
| command := newOperatorTestCommand(context.Background()) | ||
| code := cli.Run(command) | ||
| os.Exit(code) | ||
| } | ||
|
|
||
| // Suite: conformance/parallel (fast, parallel-safe) | ||
| ext.AddSuite(e.Suite{ | ||
| Name: "openshift/cluster-kube-controller-manager-operator/conformance/parallel", | ||
| Parents: []string{"openshift/conformance/parallel"}, | ||
| Qualifiers: []string{ | ||
| `!(name.contains("[Serial]") || name.contains("[Slow]"))`, | ||
| }, | ||
| }) | ||
| func newOperatorTestCommand(ctx context.Context) *cobra.Command { | ||
| registry := prepareOperatorTestsRegistry() | ||
|
|
||
| // Suite: conformance/serial (explicitly serial tests) | ||
| ext.AddSuite(e.Suite{ | ||
| Name: "openshift/cluster-kube-controller-manager-operator/conformance/serial", | ||
| Parents: []string{"openshift/conformance/serial"}, | ||
| Qualifiers: []string{ | ||
| `name.contains("[Serial]")`, | ||
| }, | ||
| }) | ||
|
|
||
| // Suite: optional/slow (long-running tests) | ||
| ext.AddSuite(e.Suite{ | ||
| Name: "openshift/cluster-kube-controller-manager-operator/optional/slow", | ||
| Parents: []string{"openshift/optional/slow"}, | ||
| Qualifiers: []string{ | ||
| `name.contains("[Slow]")`, | ||
| cmd := &cobra.Command{ | ||
| Use: "cluster-kube-controller-manager-operator-tests-ext", | ||
| Short: "A binary used to run cluster-kube-controller-manager-operator tests as part of OTE.", | ||
| Run: func(cmd *cobra.Command, args []string) { | ||
| if err := cmd.Help(); err != nil { | ||
| klog.Fatal(err) | ||
| } | ||
| }, | ||
| }) | ||
|
|
||
| // Suite: all (includes everything) | ||
| ext.AddSuite(e.Suite{ | ||
| Name: "openshift/cluster-kube-controller-manager-operator/all", | ||
| }) | ||
|
|
||
| specs, err := g.BuildExtensionTestSpecsFromOpenShiftGinkgoSuite() | ||
| if err != nil { | ||
| panic(fmt.Sprintf("couldn't build extension test specs from ginkgo: %+v", err.Error())) | ||
| } | ||
|
|
||
| // Ensure [Disruptive] tests are also [Serial] (for any future tests that might need this) | ||
| specs = specs.Walk(func(spec *et.ExtensionTestSpec) { | ||
| if strings.Contains(spec.Name, "[Disruptive]") && !strings.Contains(spec.Name, "[Serial]") { | ||
| spec.Name = strings.ReplaceAll( | ||
| spec.Name, | ||
| "[Disruptive]", | ||
| "[Serial][Disruptive]", | ||
| ) | ||
| } | ||
| }) | ||
|
|
||
| // Preserve original-name labels for renamed tests | ||
| specs = specs.Walk(func(spec *et.ExtensionTestSpec) { | ||
| for label := range spec.Labels { | ||
| if strings.HasPrefix(label, "original-name:") { | ||
| parts := strings.SplitN(label, "original-name:", 2) | ||
| if len(parts) > 1 { | ||
| spec.OriginalName = parts[1] | ||
| } | ||
| } | ||
| } | ||
| }) | ||
|
|
||
| // Ignore obsolete tests | ||
| ext.IgnoreObsoleteTests( | ||
| // "[sig-kube-controller-manager] <test name here>", | ||
| ) | ||
|
|
||
| // Initialize environment before running any tests | ||
| specs.AddBeforeAll(func() { | ||
| // do stuff | ||
| }) | ||
| if v := version.Get().String(); len(v) == 0 { | ||
| cmd.Version = "<unknown>" | ||
| } else { | ||
| cmd.Version = v | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. who are the consumers of this version?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ack, so for now it is just for convenience. |
||
| } | ||
|
|
||
| ext.AddSpecs(specs) | ||
| registry.Register(ext) | ||
| cmd.AddCommand(otecmd.DefaultExtensionCommands(registry)...) | ||
|
|
||
| root := &cobra.Command{ | ||
| Long: "Cluster Kube Controller Manager Operator Tests Extension", | ||
| } | ||
| return cmd | ||
| } | ||
|
|
||
| root.AddCommand(cmd.DefaultExtensionCommands(registry)...) | ||
| func prepareOperatorTestsRegistry() *oteextension.Registry { | ||
| registry := oteextension.NewRegistry() | ||
| extension := oteextension.NewExtension("openshift", "payload", "cluster-kube-controller-manager-operator") | ||
|
|
||
| if err := root.Execute(); err != nil { | ||
| os.Exit(1) | ||
| } | ||
| registry.Register(extension) | ||
| return registry | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| reviewers: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add QE team members.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added |
||
| - atiratree | ||
| - deads2k | ||
| - ingvagabund | ||
| - gangwgr | ||
| - zhouying7780 | ||
| approvers: | ||
| - atiratree | ||
| - deads2k | ||
| - ingvagabund | ||
| - gangwgr | ||
| - zhouying7780 | ||
| component: "kube-controller-manager" | ||
|
|
||
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.
Could we please add a new target called cluster-kube-controller-manager-operator to have the ability to simply build just the operator binary (e.g. for a development) withouth building the tests?
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.
@atiratree Earlier we are have separate target, but Lukas suggested to use single target. We are following same standard in all control-plane repos
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.
Yeah. that is fine, but having the ability to compile just the binary is also useful sometimes. Anyway, we can do that later I guess.