Skip to content

Commit

Permalink
adm upgrade status: add fixture test
Browse files Browse the repository at this point in the history
  • Loading branch information
petr-muller committed Nov 9, 2023
1 parent b6558a1 commit 57e9844
Show file tree
Hide file tree
Showing 5 changed files with 3,011 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pkg/cli/admin/upgrade/status/examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Examples for `oc adm upgrade status`

Each example consists of two inputs and one output, matched by a common substring:
1. `TESTCASE-cv.yaml`(input): ClusterVersion object (created by `oc get clusterversion version -o yaml`)
2. `TESTCASE-co.yaml`(input): list of ClusterOperators (created by `oc get clusteroperators -o yaml`)
3. `TESTCASE.out`(output): expected output of `oc adm upgrade status` for the two outputs

The `TestExamples` test in `examples_test.go` file above validates all examples. When the testcase
is executed with a non-empty `UPDATE` environmental variable, it will update the `TESTCASE.out`
fixture:

```console
$ UPDATE=yes go test -v ./pkg/cli/admin/upgrade/status/...
```

You can also pass the inputs to the `oc adm upgrade status` directly:

```
$ oc adm upgrade status --mock-clusterversion=not-upgrading-cv.yaml --mock-clusteroperators=not-upgrading-co.yaml
```
Loading

0 comments on commit 57e9844

Please sign in to comment.