@@ -5,15 +5,31 @@ This repository contains the tests for the Cluster Kube API Server Operator for
55These tests run against OpenShift clusters and are meant to be used in the OpenShift CI/CD pipeline.
66They use the framework: https://github.com/openshift-eng/openshift-tests-extension
77
8- ## How to Run the Tests Locally
8+ ## Quick Start
9+ ### Building the Test Extension
10+
11+ From the repository root:
12+ ``` bash
13+ make tests-ext-build
14+ ```
15+
16+ Or from the test extension directory:
17+ ``` bash
18+ cd test/extended/tests-extension
19+ make build
20+ ```
21+
22+ The binary will be located at: ` test/extended/tests-extension/bin/cluster-kube-apiserver-operator-tests-ext `
923
10- | Command | Description |
11- | --------------------------------------------------------------------------------------------| --------------------------------------------------------------------------|
12- | ` make tests-ext-build ` | Builds the test extension binary. |
13- | ` ./cluster-kube-apiserver-operator-tests-ext list ` | Lists all available test cases. |
14- | ` ./cluster-kube-apiserver-operator-tests-ext run-suite <suite-name> ` | Runs a test suite. e.g., ` openshift/cluster-kube-apiserver-operator/conformance/parallel ` |
15- | ` ./cluster-kube-apiserver-operator-tests-ext run <test-name> ` | Runs one specific test. |
24+ ### Running Tests
1625
26+ | Command | Description |
27+ | ----------------------------------------------------------------------------| --------------------------------------------------------------------------|
28+ | ` make tests-ext-build ` | Builds the test extension binary (from root). |
29+ | ` make run-suite SUITE=<suite-name> [JUNIT_DIR=<dir>] ` | Runs a test suite from root (e.g., ` SUITE=openshift/cluster-kube-apiserver-operator/conformance/parallel ` ). |
30+ | ` ./test/extended/tests-extension/bin/cluster-kube-apiserver-operator-tests-ext list ` | Lists all available test cases. |
31+ | ` ./test/extended/tests-extension/bin/cluster-kube-apiserver-operator-tests-ext run-suite <suite-name> ` | Runs a test suite directly. |
32+ | ` ./test/extended/tests-extension/bin/cluster-kube-apiserver-operator-tests-ext run-test <test-name> ` | Runs one specific test. |
1733
1834## How to Run the Tests Locally
1935
@@ -22,7 +38,7 @@ Use the environment variable `KUBECONFIG` to point to your cluster configuration
2238
2339``` shell
2440export KUBECONFIG=path/to/kubeconfig
25- ./cluster-kube-apiserver-operator-tests-ext run < test-name>
41+ ./test/extended/tests-extension/bin/ cluster-kube-apiserver-operator-tests-ext run-test < test-name>
2642```
2743
2844### Local Test using OCP
@@ -48,25 +64,53 @@ export KUBECONFIG=~/.kube/cluster-bot.kubeconfig
4864
4965** Example:**
5066``` shell
51- ./cluster-kube-apiserver-operator-tests-ext run-suite openshift/cluster-kube-apiserver-operator/all
67+ ./test/extended/tests-extension/bin/ cluster-kube-apiserver-operator-tests-ext run-suite openshift/cluster-kube-apiserver-operator/all
5268```
5369
70+ Or using make from the root directory:
71+ ``` shell
72+ make run-suite SUITE=openshift/cluster-kube-apiserver-operator/all JUNIT_DIR=/tmp/junit-results
73+ ```
74+
75+ ## Test Module Structure
76+
77+ The test extension has been isolated into its own Go module to separate test dependencies from production code:
78+
79+ ```
80+ test/extended/tests-extension/
81+ ├── bin/ # Test binaries (gitignored)
82+ ├── cmd/ # Test extension main package
83+ ├── .openshift-tests-extension/ # Test metadata
84+ ├── go.mod # Separate module with test dependencies
85+ ├── go.sum
86+ ├── Makefile # Test-specific build targets
87+ ├── main.go # Ginkgo test specs
88+ └── README.md
89+ ```
90+
91+ ### Key Benefits of Dependency Isolation
92+
93+ - ** Smaller production images** : Test dependencies (ginkgo, gomega, etc.) are not included in production builds
94+ - ** Faster builds** : Production builds don't need to vendor test dependencies (~ 388K+ lines removed from root vendor)
95+ - ** Cleaner dependency management** : Test dependencies isolated in ` test/extended/tests-extension/go.mod `
96+ - ** Better CI performance** : Smaller images, faster pulls, less storage
97+
5498## Writing Tests
5599
56- You can write tests in the ` test/extended/ ` directory.
100+ You can write tests in the ` test/extended/tests-extension/ ` directory.
57101
58102## Development Workflow
59103
60- - Add or update tests in: ` test/extended/ `
104+ - Add or update tests in: ` test/extended/tests-extension/ `
61105- Run ` make build ` to build the operator binary and ` make tests-ext-build ` for the test binary.
62106- You can run the full suite or one test using the commands in the table above.
63107- Before committing your changes:
64- - Run ` make tests-ext-update `
108+ - Run ` make tests-ext-update ` (updates test metadata)
65109 - Run ` make verify ` to check formatting, linting, and validation
66110
67111## How to Rename a Test
68112
69- 1 . Run ` ./cluster-kube-apiserver-operator-tests-ext list ` to see the current test names
113+ 1 . Run ` ./test/extended/tests-extension/bin/ cluster-kube-apiserver-operator-tests-ext list ` to see the current test names
701142 . Find the name of the test you want to rename
711153 . Add a Ginkgo label with the original name, like this:
72116
@@ -84,8 +128,8 @@ It("should pass a renamed sanity check",
84128
85129## How to Delete a Test
86130
87- 1 . Run ` ./cluster-kube-apiserver-operator-tests-ext list ` to find the test name
88- 2 . Add the test name to the ` IgnoreObsoleteTests ` block in ` cmd/cluster-kube-apiserver-operator- tests-ext /main.go` , like this:
131+ 1 . Run ` ./test/extended/tests-extension/bin/ cluster-kube-apiserver-operator-tests-ext list ` to find the test name
132+ 2 . Add the test name to the ` IgnoreObsoleteTests ` block in ` test/extended/ tests-extension/cmd /main.go` , like this:
89133
90134``` go
91135ext.IgnoreObsoleteTests (
@@ -133,42 +177,59 @@ More info: https://docs.ci.openshift.org/docs/architecture/ci-operator/#testing-
133177
134178# # Makefile Commands
135179
180+ # ## Root Makefile (from repository root)
181+
136182| Target | Description |
137183|--------------------------|------------------------------------------------------------------------------|
138184| `make build` | Builds the operator binary. |
139- | `make tests-ext-build` | Builds the test extension binary. |
140- | `make tests-ext-update` | Updates the metadata JSON file and cleans machine-specific codeLocations. |
185+ | `make tests-ext-build` | Builds the test extension binary (delegates to test Makefile). |
186+ | `make tests-ext-update` | Updates test metadata (delegates to test Makefile). |
187+ | `make tests-ext-clean` | Cleans test extension binaries (delegates to test Makefile). |
188+ | `make run-suite SUITE=<name> [JUNIT_DIR=<dir>]` | Runs a test suite (delegates to test Makefile). |
189+ | `make clean` | Cleans both operator and test binaries. |
141190| `make verify` | Runs formatting, vet, and linter. |
142191
143- **Note:** Metadata is stored in: `.openshift-tests-extension/openshift_payload_cluster-kube-apiserver-operator.json`
192+ # ## Test Extension Makefile (from test/extended/tests-extension/)
193+
194+ | Target | Description |
195+ |--------------------------|------------------------------------------------------------------------------|
196+ | `make build` | Builds the test extension binary to `bin/cluster-kube-apiserver-operator-tests-ext`. |
197+ | `make update-metadata` | Builds and updates test metadata JSON file. |
198+ | `make build-update` | Builds binary and updates metadata (cleans machine-specific codeLocations). |
199+ | `make clean` | Removes the `bin/` directory. |
200+ | `make run-suite SUITE=<name> [JUNIT_DIR=<dir>]` | Runs a specific test suite with optional JUnit XML output. |
201+ | `make list-test-names` | Lists all test names. |
202+ | `make verify-metadata` | Verifies metadata is up to date. |
203+
204+ **Note:** Metadata is stored in: `test/extended/tests-extension/.openshift-tests-extension/openshift_payload_cluster-kube-apiserver-operator.json`
144205
145206# # FAQ
146207
147208# ## Why don't we have a Dockerfile for `cluster-kube-apiserver-operator-tests-ext`?
148209
149- We do not provide a Dockerfile for `cluster-kube-apiserver-operator-tests-ext` because building and shipping a
210+ We do not provide a Dockerfile for `cluster-kube-apiserver-operator-tests-ext` because building and shipping a
150211standalone image for this test binary would introduce unnecessary complexity.
151212
152- Technically, it is possible to create a new OpenShift component just for the
153- tests and add a corresponding test image to the payload. However, doing so requires
154- onboarding a new component, setting up build pipelines, and maintaining image promotion
213+ Technically, it is possible to create a new OpenShift component just for the
214+ tests and add a corresponding test image to the payload. However, doing so requires
215+ onboarding a new component, setting up build pipelines, and maintaining image promotion
155216and test configuration — all of which adds overhead.
156217
157218From the OpenShift architecture point of view :
158219
1592201. Tests for payload components are part of the product. Many users (such as storage vendors, or third-party CNIs)
160221rely on these tests to validate that their solutions are compatible and conformant with OpenShift.
161222
162- 2. Adding new images to the payload comes with significant overhead and cost.
163- It is generally preferred to include tests in the same image as the component
223+ 2. Adding new images to the payload comes with significant overhead and cost.
224+ It is generally preferred to include tests in the same image as the component
164225being tested whenever possible.
165226
166227# ## Why do we need to run `make tests-ext-update`?
167228
168229Running `make tests-ext-update` ensures that each test gets a unique and stable **TestID** over time.
169230
170- The TestID is used to identify tests across the OpenShift CI/CD pipeline and reporting tools like Sippy.
171- It helps track test results, detect regressions, and ensures the correct tests are
231+ The TestID is used to identify tests across the OpenShift CI/CD pipeline and reporting tools like Sippy.
232+ It helps track test results, detect regressions, and ensures the correct tests are
172233executed and reported.
173234
174235This step is important whenever you add, rename, or delete a test.
0 commit comments