|
| 1 | +# Cluster Version Operator Tests |
| 2 | + |
| 3 | +We hold all e2e tests and related common methods in this folder. |
| 4 | +Test script are using client-go, here is the document: https://pkg.go.dev/k8s.io/client-go |
| 5 | + |
| 6 | +## Prerequisites |
| 7 | +- Install golang, the version should match it in go.mod. Here is the how-to doc https://go.dev/doc/install |
| 8 | +- Have the environment variable `KUBECONFIG` set pointing to your cluster. |
| 9 | + |
| 10 | +## Compile the executable binary |
| 11 | +In root folder, run below command to build executable binary: |
| 12 | +``` |
| 13 | +$ make update |
| 14 | +``` |
| 15 | +The executable binary can be found in ${BIN_PATH} folder, BIN_PATH is set in hack/build-info.sh, in linux it is _output/linux/amd64/ folder. |
| 16 | + |
| 17 | +## Run test case |
| 18 | + |
| 19 | +- Run below command to list all available tests: |
| 20 | +``` |
| 21 | +$ _output/linux/amd64/cluster-version-operator-tests list |
| 22 | +``` |
| 23 | +Output: |
| 24 | +``` |
| 25 | +[jianl@jianl-thinkpadt14gen4 cluster-version-operator]$ _output/linux/amd64/cluster-version-operator-tests list |
| 26 | +[ |
| 27 | + { |
| 28 | + "name": "[Jira:Cluster Version Operator] cluster-version-operator-tests Author:jianl-High-42543-the removed resources are not created in a fresh installed cluster", |
| 29 | + "labels": { |
| 30 | + "42543": {}, |
| 31 | + "High": {}, |
| 32 | + "cvo": {} |
| 33 | + }, |
| 34 | + "resources": { |
| 35 | + "isolation": {} |
| 36 | + }, |
| 37 | + "source": "openshift:payload:cluster-version-operator", |
| 38 | + "lifecycle": "blocking", |
| 39 | + "environmentSelector": {} |
| 40 | + } |
| 41 | +] |
| 42 | +[jianl@jianl-thinkpadt14gen4 cluster-version-operator]$ |
| 43 | +``` |
| 44 | +- Run below command to execute a test case |
| 45 | +``` |
| 46 | +$ _output/linux/amd64/cluster-version-operator-tests run-test <test case name> |
| 47 | +``` |
| 48 | +or run test case in one line: |
| 49 | + |
| 50 | +``` |
| 51 | +$ _output/linux/amd64/cluster-version-operator-tests list | jq '.[] | select(.name | contains("42543")) | .name' | xargs _output/linux/amd64/cluster-version-operator-tests run-test |
| 52 | +``` |
| 53 | +Output: |
| 54 | +``` |
| 55 | +[jianl@jianl-thinkpadt14gen4 cluster-version-operator]$ _output/linux/amd64/cluster-version-operator-tests list | jq '.[] | select(.name | contains("42543")) | .name' | xargs _output/linux/amd64/cluster-version-operator-tests run-test |
| 56 | + Running Suite: - /home/jianl/1_code/cluster-version-operator |
| 57 | + ============================================================= |
| 58 | + Random Seed: 1761292866 - will randomize all specs |
| 59 | +
|
| 60 | + Will run 1 of 1 specs |
| 61 | + ------------------------------ |
| 62 | + [Jira:Cluster Version Operator] cluster-version-operator-tests Author:jianl-High-42543-the removed resources are not created in a fresh installed cluster [cvo, High, 42543] |
| 63 | + /home/jianl/1_code/cluster-version-operator/test/cvo/cvo.go:22 |
| 64 | + STEP: Validate resource with 'release.openshift.io/delete: "true"' annotation is not installed @ 10/24/25 16:01:06.862 |
| 65 | + • [1.428 seconds] |
| 66 | + ------------------------------ |
| 67 | +
|
| 68 | + Ran 1 of 1 Specs in 1.428 seconds |
| 69 | + SUCCESS! -- 1 Passed | 0 Failed | 0 Pending | 0 Skipped |
| 70 | +[ |
| 71 | + { |
| 72 | + "name": "[Jira:Cluster Version Operator] cluster-version-operator-tests Author:jianl-High-42543-the removed resources are not created in a fresh installed cluster", |
| 73 | + "lifecycle": "blocking", |
| 74 | + "duration": 1428, |
| 75 | + "startTime": "2025-10-24 08:01:06.858981 UTC", |
| 76 | + "endTime": "2025-10-24 08:01:08.287644 UTC", |
| 77 | + "result": "passed", |
| 78 | + "output": " STEP: Validate resource with 'release.openshift.io/delete: \"true\"' annotation is not installed @ 10/24/25 16:01:06.862\n" |
| 79 | + } |
| 80 | +] |
| 81 | +[jianl@jianl-thinkpadt14gen4 cluster-version-operator]$ |
| 82 | +``` |
0 commit comments