Skip to content

Commit ffeee2c

Browse files
committed
Add the placeholder for the first test
1 parent 6eaf72f commit ffeee2c

File tree

4 files changed

+68
-2
lines changed

4 files changed

+68
-2
lines changed
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

+16-2
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,34 @@
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+
// BuildExtensionTestSpecsFromOpenShiftGinkgoSuite is currently available only in the openshift fork of ginkgo
25+
// See the "replace" directive in go.mod copied from
26+
// https://github.com/openshift-eng/openshift-tests-extension/blob/8ef37c67e666954f9b95e52320c9c20d6b53d241/go.mod#L37
27+
specs, err := g.BuildExtensionTestSpecsFromOpenShiftGinkgoSuite()
28+
if err != nil {
29+
panic(fmt.Sprintf("couldn't build extension test specs from ginkgo: %+v", err.Error()))
30+
}
31+
1832
ext.AddSpecs(specs)
1933
registry.Register(ext)
2034

test/cvo/cvo.go

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package cvo
2+
3+
import (
4+
. "github.com/onsi/ginkgo/v2"
5+
. "github.com/onsi/gomega"
6+
)
7+
8+
// TODO this is a placeholder for the first test
9+
var _ = Describe("[cvo-testing] cluster-version-operator-tests", func() {
10+
It("should support passing tests", func() {
11+
Expect(true).To(BeTrue())
12+
})
13+
})

test/cvo/cvo_suite_test.go

+15
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)