Skip to content

Commit a4ceaba

Browse files
committed
NO-JIRA: Clarify test names in OTE
This pull add a section to clarify test names in OTE. It modifies `make update` to with a knob to opt into deleting the existing metadata.
1 parent 420e6d0 commit a4ceaba

File tree

3 files changed

+53
-4
lines changed

3 files changed

+53
-4
lines changed

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ integration-test:
2929
.PHONY: integration-test
3030

3131
update: build
32-
hack/update-test-metadata.sh
32+
DELETE_EXISTING=TRUE hack/update-test-metadata.sh
3333
.PHONY: update
3434

3535
format:
@@ -43,7 +43,8 @@ verify-yaml:
4343
hack/verify-yaml.sh
4444
.PHONY: verify-yaml
4545

46-
verify-update: update
46+
verify-update:
47+
hack/update-test-metadata.sh
4748
git diff --exit-code HEAD
4849
.PHONY: verify-update
4950

cmd/cluster-version-operator-tests/README.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,40 @@ After [installing-ginkgo](https://onsi.github.io/ginkgo/#installing-ginkgo):
2121
$ ginkgo ./test/...
2222
```
2323

24-
The output looks nicer this way.
24+
The output looks nicer this way.
25+
26+
27+
## Test Names
28+
29+
### Test labels
30+
31+
See [docs](https://github.com/openshift/origin/tree/main/test/extended#test-labels) for details.
32+
33+
### Ownership
34+
35+
* A `[Jira:"Component"]` tag in the test name (e.g., [Jira:"Cluster Version Operator"]) is preferred to claim the ownership of the test. The component comes from [the list of components of Jira Project OCPBUGS](https://issues.redhat.com/projects/OCPBUGS?selectedItem=com.atlassian.jira.jira-projects-plugin:components-page). See [here](https://github.com/openshift/origin/blob/6b584254d53cdd1b5cd6471b69cb7c22f3e28ecd/test/extended/apiserver/rollout.go#L36) for example.
36+
37+
* Or an entry in the [ci-test-mapping](https://github.com/openshift-eng/ci-test-mapping) repository, which maps tests to owning components. See [here](https://github.com/openshift-eng/ci-test-mapping/tree/main/pkg/components/clusterversionoperator) for example.
38+
39+
### Renaming
40+
41+
If a test is renamed, claim it with [specs.Walk](https://pkg.go.dev/github.com/openshift-eng/[email protected]/pkg/extension/extensiontests#ExtensionTestSpecs.Walk):
42+
43+
```go
44+
specs = specs.Walk(func(spec *et.ExtensionTestSpec) {
45+
if orig, ok := renamedTests[spec.Name]; ok {
46+
spec.OriginalName = orig
47+
}
48+
})
49+
```
50+
51+
### Deleting
52+
53+
If a test is renamed, claim it with [ext.IgnoreObsoleteTests](https://pkg.go.dev/github.com/openshift-eng/[email protected]/pkg/extension#Extension.IgnoreObsoleteTests)
54+
55+
```go
56+
ext.IgnoreObsoleteTests(
57+
"[sig-abc] My removed test",
58+
// Add more removed test names below
59+
)
60+
```

hack/update-test-metadata.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,17 @@ set -eu
44

55
source hack/build-info.sh
66

7+
readonly METADATA_FILE=".openshift-tests-extension/openshift_payload_cluster-version-operator.json"
8+
DELETE_EXISTING="${DELETE_EXISTING:-false}"
9+
10+
if [[ "${DELETE_EXISTING,,}" == "true" ]] && [[ -f "${METADATA_FILE}" ]] ; then
11+
echo "Removing ${METADATA_FILE}"
12+
rm .openshift-tests-extension/openshift_payload_cluster-version-operator.json
13+
fi
14+
715
# Update test metadata
8-
eval "${BIN_PATH}/cluster-version-operator-tests" "update"
16+
if ! "${BIN_PATH}/cluster-version-operator-tests" "update"; then
17+
>&2 echo "run 'make update' to fix the metadata
18+
See https://github.com/openshift/cluster-version-operator/blob/main/cmd/cluster-version-operator-tests/README.md#test-names for details."
19+
exit 1
20+
fi

0 commit comments

Comments
 (0)