Skip to content

Commit 09edded

Browse files
Merge pull request #1172 from hongkailiu/pr1168
OTA-1403: Add an always passing test case
2 parents d949cfe + 1302999 commit 09edded

File tree

299 files changed

+211001
-5
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

299 files changed

+211001
-5
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

go.mod

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ require (
1010
github.com/ghodss/yaml v1.0.0
1111
github.com/google/go-cmp v0.6.0
1212
github.com/google/uuid v1.6.0
13+
github.com/onsi/ginkgo/v2 v2.21.0
14+
github.com/onsi/gomega v1.35.1
1315
github.com/openshift-eng/openshift-tests-extension v0.0.0-20250220212757-b9c4d98a0c45
1416
github.com/openshift/api v0.0.0-20250207102212-9e59a77ed2e0
1517
github.com/openshift/client-go v0.0.0-20250131180035-f7ec47e2d87a
@@ -45,11 +47,13 @@ require (
4547
github.com/go-openapi/jsonpointer v0.21.0 // indirect
4648
github.com/go-openapi/jsonreference v0.20.2 // indirect
4749
github.com/go-openapi/swag v0.23.0 // indirect
50+
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
4851
github.com/gogo/protobuf v1.3.2 // indirect
4952
github.com/golang/protobuf v1.5.4 // indirect
5053
github.com/google/cel-go v0.22.0 // indirect
5154
github.com/google/gnostic-models v0.6.8 // indirect
5255
github.com/google/gofuzz v1.2.0 // indirect
56+
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db // indirect
5357
github.com/inconshreveable/mousetrap v1.1.0 // indirect
5458
github.com/josharian/intern v1.0.0 // indirect
5559
github.com/jpillora/backoff v1.0.0 // indirect
@@ -69,6 +73,7 @@ require (
6973
golang.org/x/sys v0.27.0 // indirect
7074
golang.org/x/term v0.26.0 // indirect
7175
golang.org/x/text v0.20.0 // indirect
76+
golang.org/x/tools v0.26.0 // indirect
7277
google.golang.org/genproto/googleapis/api v0.0.0-20240826202546-f6391c0de4c7 // indirect
7378
google.golang.org/genproto/googleapis/rpc v0.0.0-20240924160255-9d4c2d233b61 // indirect
7479
google.golang.org/protobuf v1.35.1 // indirect
@@ -83,3 +88,5 @@ require (
8388
sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect
8489
sigs.k8s.io/yaml v1.4.0 // indirect
8590
)
91+
92+
replace github.com/onsi/ginkgo/v2 => github.com/openshift/onsi-ginkgo/v2 v2.6.1-0.20241205171354-8006f302fd12

go.sum

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En
3232
github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
3333
github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE=
3434
github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ=
35-
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I=
3635
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
3736
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
3837
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
@@ -85,8 +84,6 @@ github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
8584
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
8685
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
8786
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
88-
github.com/onsi/ginkgo/v2 v2.21.0 h1:7rg/4f3rB88pb5obDgNZrNHrQ4e6WpjonchcpuBRnZM=
89-
github.com/onsi/ginkgo/v2 v2.21.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo=
9087
github.com/onsi/gomega v1.35.1 h1:Cwbd75ZBPxFSuZ6T+rN/WCb/gOc6YgFBXLlZLhC7Ds4=
9188
github.com/onsi/gomega v1.35.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog=
9289
github.com/openshift-eng/openshift-tests-extension v0.0.0-20250220212757-b9c4d98a0c45 h1:hXpbYtP3iTh8oy/RKwKkcMziwchY3fIk95ciczf7cOA=
@@ -97,6 +94,8 @@ github.com/openshift/client-go v0.0.0-20250131180035-f7ec47e2d87a h1:duO3JMrUOqV
9794
github.com/openshift/client-go v0.0.0-20250131180035-f7ec47e2d87a/go.mod h1:Qw3ThpzVZ0bfTILpBNYg4LGyjtNxfyCiGh/uDLOOTP8=
9895
github.com/openshift/library-go v0.0.0-20250203131244-80620876b7c2 h1:LaJmI+EeFnpbxs5H4Y6KOiNXhtPjldqvNzVfPpNM+dI=
9996
github.com/openshift/library-go v0.0.0-20250203131244-80620876b7c2/go.mod h1:GHwvopE5KXXCz4ULHp871sTPLLW+FB+hu/RIzlNwxx8=
97+
github.com/openshift/onsi-ginkgo/v2 v2.6.1-0.20241205171354-8006f302fd12 h1:AKx/w1qpS8We43bsRgf8Nll3CGlDHpr/WAXvuedTNZI=
98+
github.com/openshift/onsi-ginkgo/v2 v2.6.1-0.20241205171354-8006f302fd12/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo=
10099
github.com/operator-framework/api v0.17.1 h1:J/6+Xj4IEV8C7hcirqUFwOiZAU3PbnJhWvB0/bB51c4=
101100
github.com/operator-framework/api v0.17.1/go.mod h1:kk8xJahHJR3bKqrA+A+1VIrhOTmyV76k+ARv+iV+u1Q=
102101
github.com/operator-framework/operator-lifecycle-manager v0.22.0 h1:7DEWOq24HQ0l5xPOXMhn17XaJACgwoipz+JfQ7QCXZw=

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)