-
Notifications
You must be signed in to change notification settings - Fork 147
CNTRLPLANE-1315:Refactor OTE to single-module architecture #1510
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
base: main
Are you sure you want to change the base?
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 |
|---|---|---|
|
|
@@ -68,3 +68,40 @@ topk(100, instance:etcd_mvcc_db_total_size_in_use_in_bytes:sum) | |
| ```console | ||
| sum without (_id) (quantile by (_id)(0.5, instance:etcd_disk_backend_commit_duration_seconds:histogram_quantile{quantile="0.99"}) + on(_id) group_left(provider) (topk by (_id) (1, id_provider*0))) | ||
| ``` | ||
|
|
||
| ## Tests | ||
|
|
||
| This repository is compatible with the [OpenShift Tests Extension (OTE)](https://github.com/openshift-eng/openshift-tests-extension) framework. | ||
|
|
||
| ### Building the test binary | ||
|
|
||
| ```bash | ||
| make build | ||
| ``` | ||
|
|
||
| ### Running test suites and tests | ||
|
|
||
| ```bash | ||
| # Run a specific test suite or test | ||
| ./cluster-etcd-operator-tests-ext run-suite openshift/cluster-etcd-operator/all | ||
| ./cluster-etcd-operator-tests-ext run-test "test-name" | ||
|
|
||
| # Run with JUnit output | ||
| ./cluster-etcd-operator-tests-ext run-suite openshift/cluster-etcd-operator/all --junit-path=/tmp/junit-results/junit.xml | ||
|
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. For junit report: https://github.com/openshift/cluster-kube-apiserver-operator/blob/main/README.md?plain=1#L200 we used
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. no that is wrong see old readme ./cluster-etcd-operator-tests-ext run-suite openshift/cluster-etcd-operator/conformance/parallel --junit-path
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. |
||
| ./cluster-etcd-operator-tests-ext run-test "test-name" --junit-path=/tmp/junit-results/junit.xml | ||
| ``` | ||
|
|
||
| ### Listing available tests and suites | ||
|
|
||
| ```bash | ||
| # List all test suites | ||
| ./cluster-etcd-operator-tests-ext list suites | ||
|
|
||
| # List tests in a suite | ||
| ./cluster-etcd-operator-tests-ext list tests --suite=openshift/cluster-etcd-operator/all | ||
|
|
||
| #for concurrency | ||
| ./cluster-etcd-operator-tests-ext run-suite openshift/cluster-etcd-operator/all -c 1 | ||
| ``` | ||
|
|
||
| For more information about the OTE framework, see the [openshift-tests-extension documentation](https://github.com/openshift-eng/openshift-tests-extension). | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,105 +1,66 @@ | ||
| /* | ||
| This command is used to run the Cluster Etcd Operator tests extension for OpenShift. | ||
| It registers the Cluster Etcd Operator tests with the OpenShift Tests Extension framework | ||
| and provides a command-line interface to execute them. | ||
| For further information, please refer to the documentation at: | ||
| https://github.com/openshift-eng/openshift-tests-extension/blob/main/cmd/example-tests/main.go | ||
| */ | ||
| 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-etcd-operator/pkg/version" | ||
|
|
||
| // The import below is necessary to ensure that the cluster etcd operator tests are registered with the extension. | ||
| _ "github.com/openshift/cluster-etcd-operator/test/extended" | ||
| "k8s.io/klog/v2" | ||
| ) | ||
|
|
||
| func main() { | ||
| registry := e.NewRegistry() | ||
| ext := e.NewExtension("openshift", "payload", "cluster-etcd-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-etcd-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-etcd-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-etcd-operator/optional/slow", | ||
| Parents: []string{"openshift/optional/slow"}, | ||
| Qualifiers: []string{ | ||
| `name.contains("[Slow]")`, | ||
| cmd := &cobra.Command{ | ||
| Use: "cluster-etcd-operator-tests", | ||
| Short: "A binary used to run cluster-etcd-operator tests as part of OTE.", | ||
| Run: func(cmd *cobra.Command, args []string) { | ||
| // no-op, logic is provided by the OTE framework | ||
| if err := cmd.Help(); err != nil { | ||
| klog.Fatal(err) | ||
| } | ||
| }, | ||
| }) | ||
|
|
||
| // Suite: all (includes everything) | ||
| ext.AddSuite(e.Suite{ | ||
| Name: "openshift/cluster-etcd-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-etcd] <test name here>", | ||
| ) | ||
|
|
||
| // Initialize environment before running any tests | ||
| specs.AddBeforeAll(func() { | ||
| // do stuff | ||
| }) | ||
|
|
||
| ext.AddSpecs(specs) | ||
| registry.Register(ext) | ||
|
|
||
| root := &cobra.Command{ | ||
| Long: "Cluster Etcd Operator Tests Extension", | ||
| if v := version.Get().String(); len(v) == 0 { | ||
| cmd.Version = "<unknown>" | ||
| } else { | ||
| cmd.Version = v | ||
| } | ||
|
|
||
| root.AddCommand(cmd.DefaultExtensionCommands(registry)...) | ||
| cmd.AddCommand(otecmd.DefaultExtensionCommands(registry)...) | ||
|
|
||
| if err := root.Execute(); err != nil { | ||
| os.Exit(1) | ||
| } | ||
| return cmd | ||
| } | ||
|
|
||
| // prepareOperatorTestsRegistry creates the OTE registry for this operator. | ||
| // | ||
| // Note: | ||
| // | ||
| // This method must be called before adding the registry to the OTE framework. | ||
| func prepareOperatorTestsRegistry() *oteextension.Registry { | ||
| registry := oteextension.NewRegistry() | ||
| extension := oteextension.NewExtension("openshift", "payload", "cluster-etcd-operator") | ||
|
|
||
| registry.Register(extension) | ||
| return registry | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| reviewers: | ||
| - dusk125 | ||
| - ironcladlou | ||
| - hasbro17 | ||
| - tjungblu | ||
| - jubittajohn | ||
| - wangke19 | ||
|
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 etcd qe
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. updated |
||
| - gangwgr | ||
| - geliu2016 | ||
| - sandeepknd | ||
| approvers: | ||
| - deads2k | ||
| - hasbro17 | ||
| - dusk125 | ||
| - tjungblu | ||
| - wangke19 | ||
| - gangwgr | ||
| - geliu2016 | ||
| - sandeepknd | ||
| component: "Etcd" | ||
|
|
||
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.
line 15 has the same. why is
cluster-etcd-operator-tests-ext.gzremoved?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.
https://github.com/openshift/cluster-kube-apiserver-operator/blob/main/.gitignore#L10
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.
It never zip on local no need