Skip to content

Commit 0ee969b

Browse files
committed
Add an always passing test case
1 parent ee8b5ef commit 0ee969b

File tree

4 files changed

+64
-2
lines changed

4 files changed

+64
-2
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# cluster-version-operator-tests
2+
3+
It integrates [openshift-tests-extension](https://github.com/openshift-eng/openshift-tests-extension) to
4+
cluster-version-operator which allows openshift components to contribute tests to openshift-tests' suites with
5+
extension binaries.
6+
7+
8+
## Run the tests locally
9+
10+
## Using the framework
11+
```console
12+
$ hack/build-go.sh
13+
$ _output/<OS>/<ARCH>/cluster-version-operator-tests run-suite cluster-version-operator
14+
```
15+
16+
## Using ginko-cli
17+
18+
After [installing-ginkgo](https://onsi.github.io/ginkgo/#installing-ginkgo):
19+
20+
```console
21+
$ ginkgo ./test/...
22+
```
23+
24+
The output looks nicer this way.

cmd/cluster-version-operator-tests/main.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,31 @@
11
package main
22

33
import (
4+
"fmt"
45
"os"
56

67
"github.com/spf13/cobra"
78

89
"github.com/openshift-eng/openshift-tests-extension/pkg/cmd"
910
"github.com/openshift-eng/openshift-tests-extension/pkg/extension"
10-
"github.com/openshift-eng/openshift-tests-extension/pkg/extension/extensiontests"
11+
g "github.com/openshift-eng/openshift-tests-extension/pkg/ginkgo"
12+
13+
_ "github.com/openshift/cluster-version-operator/test/cvo"
1114
)
1215

1316
func main() {
1417
registry := extension.NewRegistry()
1518
ext := extension.NewExtension("openshift", "payload", "cluster-version-operator")
1619

17-
var specs extensiontests.ExtensionTestSpecs
20+
ext.AddSuite(extension.Suite{
21+
Name: "cluster-version-operator",
22+
})
23+
24+
specs, err := g.BuildExtensionTestSpecsFromOpenShiftGinkgoSuite()
25+
if err != nil {
26+
panic(fmt.Sprintf("couldn't build extension test specs from ginkgo: %+v", err.Error()))
27+
}
28+
1829
ext.AddSpecs(specs)
1930
registry.Register(ext)
2031

test/cvo/cvo.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package cvo
2+
3+
import (
4+
. "github.com/onsi/ginkgo/v2"
5+
. "github.com/onsi/gomega"
6+
)
7+
8+
var _ = Describe("[cvo-testing] cluster-version-operator-tests", func() {
9+
It("should support passing tests", func() {
10+
Expect(true).To(BeTrue())
11+
})
12+
})

test/cvo/cvo_suite_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// This file is to support running tests with ginkgo-cli:
2+
// ginkgo ./test/...
3+
package cvo
4+
5+
import (
6+
"testing"
7+
8+
. "github.com/onsi/ginkgo/v2"
9+
. "github.com/onsi/gomega"
10+
)
11+
12+
func TestGinkgo(t *testing.T) {
13+
RegisterFailHandler(Fail)
14+
RunSpecs(t, "CVO Suite")
15+
}

0 commit comments

Comments
 (0)