Skip to content

Commit 6bd6d4d

Browse files
committed
[WINC-1777] Use upstream Ginkgo by manually registering OTE specs
Switch from BuildExtensionTestSpecsFromOpenShiftGinkgoSuite() (which requires the OpenShift Ginkgo fork) to manually registering ExtensionTestSpecs with plain Go functions. Changes: - cmd/main.go: register specs manually via et.ExtensionTestSpecs, remove import of OTE ginkgo helper package - test/extended/winc.go: rewrite OCP-37362 as a plain Go function CheckWmcoGolangVersion() returning error instead of using Ginkgo g.It - test/extended/suite_test.go: removed (no longer needed) - go.mod: remove OpenShift ginkgo fork replace directive; upstream github.com/onsi/ginkgo/v2 v2.22.2 is used directly - vendor: cleaned up ~250 files from the ginkgo fork and its transitive deps This avoids adding the OpenShift Ginkgo fork to WMCO's dependency tree, keeping the operator's go.mod clean as requested. Jira: WINC-1777
1 parent 67aa255 commit 6bd6d4d

254 files changed

Lines changed: 64 additions & 190182 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 18 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,23 @@
11
// windows-machine-config-operator-tests-ext is the OTE (OpenShift Tests Extension)
2-
// binary for Windows Containers tests. It wraps WINC Ginkgo tests and exposes them
3-
// through the standardized OTE interface (info / list / run-test / run-suite).
2+
// binary for Windows Containers tests. Tests are registered as plain Go functions
3+
// using upstream Ginkgo, without the OpenShift Ginkgo fork.
44
//
55
// References:
66
// - OTE Integration Guide: https://github.com/openshift-eng/openshift-tests-extension
7-
// - Similar implementation (NTO): https://github.com/openshift/cluster-node-tuning-operator/blob/main/cmd/cluster-node-tuning-operator-test-ext/main.go
8-
// - Similar implementation (MCO): https://github.com/openshift/machine-config-operator/blob/master/cmd/machine-config-tests-ext/main.go
97
package main
108

119
import (
12-
"fmt"
10+
"context"
1311
"os"
14-
"strings"
12+
13+
"github.com/spf13/cobra"
1514

1615
otecmd "github.com/openshift-eng/openshift-tests-extension/pkg/cmd"
1716
e "github.com/openshift-eng/openshift-tests-extension/pkg/extension"
1817
et "github.com/openshift-eng/openshift-tests-extension/pkg/extension/extensiontests"
19-
g "github.com/openshift-eng/openshift-tests-extension/pkg/ginkgo"
20-
"github.com/spf13/cobra"
2118

22-
_ "github.com/openshift/windows-machine-config-operator/test/extended"
23-
// Register WINC Ginkgo tests.
19+
"github.com/openshift/windows-machine-config-operator/test/extended"
20+
"github.com/openshift/windows-machine-config-operator/test/extended/utils"
2421
)
2522

2623
func main() {
@@ -36,9 +33,6 @@ func main() {
3633
})
3734

3835
// Parallel subset: non-Serial, non-Slow, non-Disruptive tests.
39-
// Renamed from windows/conformance/parallel until tests carry an explicit
40-
// conformance marker and achieve >=99% pass rate, at which point Parents
41-
// pointing to openshift/conformance/parallel will be added.
4236
ext.AddSuite(e.Suite{
4337
Name: "windows/parallel",
4438
Qualifiers: []string{
@@ -47,7 +41,6 @@ func main() {
4741
})
4842

4943
// Serial subset: tests that must run in isolation.
50-
// Renamed from windows/conformance/serial for the same reason as above.
5144
ext.AddSuite(e.Suite{
5245
Name: "windows/serial",
5346
Qualifiers: []string{
@@ -63,13 +56,19 @@ func main() {
6356
},
6457
})
6558

66-
specs, err := g.BuildExtensionTestSpecsFromOpenShiftGinkgoSuite()
67-
if err != nil {
68-
panic(fmt.Sprintf("couldn't build extension test specs from ginkgo: %v", err))
59+
// Register test specs manually — no OpenShift Ginkgo fork required.
60+
specs := et.ExtensionTestSpecs{
61+
{
62+
Name: "[sig-windows] Windows_Containers Author:rrasouli-Smokerun-Medium-37362-[wmco] wmco using correct golang version [OTP]",
63+
Run: func(ctx context.Context) *et.ExtensionTestResult {
64+
if err := extended.CheckWmcoGolangVersion(ctx, utils.NewCLIWithoutNamespace()); err != nil {
65+
return &et.ExtensionTestResult{Result: et.ResultFailed, Output: err.Error()}
66+
}
67+
return &et.ExtensionTestResult{Result: et.ResultPassed}
68+
},
69+
},
6970
}
7071

71-
applyPlatformFilters(specs)
72-
7372
ext.AddSpecs(specs)
7473
registry.Register(ext)
7574

@@ -85,21 +84,3 @@ func main() {
8584
os.Exit(1)
8685
}
8786
}
88-
89-
// applyPlatformFilters converts "Platform:<name>" and "NoPlatform:<name>" Ginkgo
90-
// labels into OTE include/exclude constraints so that openshift-tests can filter
91-
// tests before execution rather than relying on g.Skip() inside the test body.
92-
func applyPlatformFilters(specs et.ExtensionTestSpecs) {
93-
specs.Walk(func(spec *et.ExtensionTestSpec) {
94-
for label := range spec.Labels {
95-
if strings.HasPrefix(label, "Platform:") {
96-
platform := strings.TrimPrefix(label, "Platform:")
97-
spec.Include(et.PlatformEquals(platform))
98-
}
99-
if strings.HasPrefix(label, "NoPlatform:") {
100-
platform := strings.TrimPrefix(label, "NoPlatform:")
101-
spec.Exclude(et.PlatformEquals(platform))
102-
}
103-
}
104-
})
105-
}

go.mod

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ replace (
88
// fix CVE-2025-30204 transitive deps still using older v4. Remove once `go mod graph` shows only 4.5.2 or higher
99
github.com/golang-jwt/jwt/v4 => github.com/golang-jwt/jwt/v4 v4.5.2
1010
github.com/golang-jwt/jwt/v5 => github.com/golang-jwt/jwt/v5 v5.2.2
11-
// Required for openshift-tests-extension compatibility (uses OpenShift's ginkgo fork).
12-
// TODO: confirm with Mansi whether this can be avoided with upstream Ginkgo.
13-
github.com/onsi/ginkgo/v2 => github.com/openshift/onsi-ginkgo/v2 v2.6.1-0.20241205171354-8006f302fd12
1411
)
1512

1613
require (
@@ -19,8 +16,6 @@ require (
1916
github.com/coreos/ignition/v2 v2.23.0
2017
github.com/go-imports-organizer/goio v1.5.0
2118
github.com/go-logr/logr v1.4.3
22-
github.com/onsi/ginkgo/v2 v2.22.2
23-
github.com/onsi/gomega v1.36.2
2419
github.com/openshift-eng/openshift-tests-extension v0.0.0-20260127124016-0fed2b824818
2520
github.com/openshift/api v0.0.0-20260213204242-d34f11c515b3
2621
github.com/openshift/client-go v0.0.0-20260213141500-06efc6dce93b
@@ -92,13 +87,11 @@ require (
9287
github.com/go-openapi/swag/stringutils v0.25.4 // indirect
9388
github.com/go-openapi/swag/typeutils v0.25.4 // indirect
9489
github.com/go-openapi/swag/yamlutils v0.25.4 // indirect
95-
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
9690
github.com/gogo/protobuf v1.3.2 // indirect
9791
github.com/google/btree v1.1.3 // indirect
9892
github.com/google/cel-go v0.26.0 // indirect
9993
github.com/google/gnostic-models v0.7.1 // indirect
10094
github.com/google/go-cmp v0.7.0 // indirect
101-
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad // indirect
10295
github.com/google/uuid v1.6.0 // indirect
10396
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // indirect
10497
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
@@ -117,6 +110,8 @@ require (
117110
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
118111
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
119112
github.com/onsi/ginkgo v1.16.5 // indirect
113+
github.com/onsi/ginkgo/v2 v2.22.2 // indirect
114+
github.com/onsi/gomega v1.36.2 // indirect
120115
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
121116
github.com/pkg/errors v0.9.1 // indirect
122117
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
@@ -150,7 +145,6 @@ require (
150145
golang.org/x/term v0.40.0 // indirect
151146
golang.org/x/text v0.34.0 // indirect
152147
golang.org/x/time v0.14.0 // indirect
153-
golang.org/x/tools v0.41.0 // indirect
154148
gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect
155149
google.golang.org/genproto/googleapis/api v0.0.0-20250721164621-a45f3dfb1074 // indirect
156150
google.golang.org/genproto/googleapis/rpc v0.0.0-20250721164621-a45f3dfb1074 // indirect

go.sum

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ github.com/go-openapi/validate v0.19.5/go.mod h1:8DJv2CVJQ6kGNpFW6eV9N3JviE1C85n
275275
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
276276
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
277277
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
278+
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I=
278279
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
279280
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
280281
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
@@ -504,6 +505,8 @@ github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108
504505
github.com/onsi/ginkgo v1.14.1/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=
505506
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
506507
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
508+
github.com/onsi/ginkgo/v2 v2.22.2 h1:/3X8Panh8/WwhU/3Ssa6rCKqPLuAkVY2I0RoyDLySlU=
509+
github.com/onsi/ginkgo/v2 v2.22.2/go.mod h1:oeMosUL+8LtarXBHu/c0bx2D/K9zyQ6uX3cTyztHwsk=
507510
github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
508511
github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
509512
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
@@ -520,8 +523,6 @@ github.com/openshift/client-go v0.0.0-20260213141500-06efc6dce93b h1:7rTnxq+haKr
520523
github.com/openshift/client-go v0.0.0-20260213141500-06efc6dce93b/go.mod h1:V3s8weD4bKXGXaN7d9g3V1QS2gmlYBRI2i/lfIwmroM=
521524
github.com/openshift/library-go v0.0.0-20260213153706-03f1709971c5 h1:9Pe6iVOMjt9CdA/vaKBNUSoEIjIe1po5Ha3ABRYXLJI=
522525
github.com/openshift/library-go v0.0.0-20260213153706-03f1709971c5/go.mod h1:K3FoNLgNBFYbFuG+Kr8usAnQxj1w84XogyUp2M8rK8k=
523-
github.com/openshift/onsi-ginkgo/v2 v2.6.1-0.20241205171354-8006f302fd12 h1:AKx/w1qpS8We43bsRgf8Nll3CGlDHpr/WAXvuedTNZI=
524-
github.com/openshift/onsi-ginkgo/v2 v2.6.1-0.20241205171354-8006f302fd12/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo=
525526
github.com/operator-framework/api v0.5.2/go.mod h1:L7IvLd/ckxJEJg/t4oTTlnHKAJIP/p51AvEslW3wYdY=
526527
github.com/operator-framework/api v0.16.0 h1:swUOhVv7QDszxBTwYM8QAtyeqI4EQHNVAiKMS+xjakY=
527528
github.com/operator-framework/api v0.16.0/go.mod h1:kk8xJahHJR3bKqrA+A+1VIrhOTmyV76k+ARv+iV+u1Q=

test/extended/suite_test.go

Lines changed: 0 additions & 13 deletions
This file was deleted.

test/extended/winc.go

Lines changed: 40 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,53 @@
11
package extended
22

33
import (
4+
"context"
45
"encoding/json"
6+
"fmt"
57
"strings"
68

7-
g "github.com/onsi/ginkgo/v2"
8-
o "github.com/onsi/gomega"
9-
109
"github.com/openshift/windows-machine-config-operator/test/extended/utils"
1110
)
1211

1312
const (
1413
wmcoNamespace = "openshift-windows-machine-config-operator"
1514
)
1615

17-
var _ = g.Describe("[sig-windows] Windows_Containers", func() {
18-
var oc = utils.NewCLIWithoutNamespace()
19-
20-
// author: rrasouli@redhat.com
21-
// OCP-37362 - Pilot case for OTE migration to WMCO
22-
g.It("Author:rrasouli-Smokerun-Medium-37362-[wmco] wmco using correct golang version [OTP]", func() {
23-
g.By("Fetch the correct golang version from cluster")
24-
serverVersion, err := oc.AsAdmin().Output("get", "--raw", "/version")
25-
o.Expect(err).NotTo(o.HaveOccurred())
26-
27-
// Unmarshal the version response to extract goVersion safely.
28-
var versionInfo struct {
29-
GoVersion string `json:"goVersion"`
30-
}
31-
o.Expect(json.Unmarshal([]byte(serverVersion), &versionInfo)).To(o.Succeed(),
32-
"failed to parse /version JSON response")
33-
o.Expect(versionInfo.GoVersion).NotTo(o.BeEmpty(), "goVersion not found in /version response")
34-
35-
// Truncate to major.minor (e.g. "go1.24.6" -> "go1.24")
36-
parts := strings.Split(versionInfo.GoVersion, ".")
37-
o.Expect(len(parts)).To(o.BeNumerically(">=", 2), "unexpected golang version format: %s", versionInfo.GoVersion)
38-
truncated := strings.Join(parts[:2], ".")
39-
g.GinkgoWriter.Printf("Golang version: %s, truncated: %s\n", versionInfo.GoVersion, truncated)
40-
41-
g.By("Compare with golang version in WMCO logs")
42-
logs, err := oc.AsAdmin().Output("logs",
43-
"deployment.apps/windows-machine-config-operator",
44-
"-n", wmcoNamespace,
45-
)
46-
o.Expect(err).NotTo(o.HaveOccurred())
47-
o.Expect(logs).To(o.ContainSubstring(truncated),
48-
"WMCO logs do not contain expected golang version %s", truncated)
49-
})
50-
})
16+
// CheckWmcoGolangVersion verifies that the golang version reported by the cluster
17+
// matches the version used to build the WMCO binary (OCP-37362).
18+
func CheckWmcoGolangVersion(_ context.Context, oc *utils.CLI) error {
19+
serverVersion, err := oc.AsAdmin().Output("get", "--raw", "/version")
20+
if err != nil {
21+
return fmt.Errorf("failed to get cluster version: %w", err)
22+
}
23+
24+
var versionInfo struct {
25+
GoVersion string `json:"goVersion"`
26+
}
27+
if err := json.Unmarshal([]byte(serverVersion), &versionInfo); err != nil {
28+
return fmt.Errorf("failed to parse /version JSON: %w", err)
29+
}
30+
if versionInfo.GoVersion == "" {
31+
return fmt.Errorf("goVersion not found in /version response")
32+
}
33+
34+
parts := strings.Split(versionInfo.GoVersion, ".")
35+
if len(parts) < 2 {
36+
return fmt.Errorf("unexpected golang version format: %s", versionInfo.GoVersion)
37+
}
38+
truncated := strings.Join(parts[:2], ".")
39+
40+
logs, err := oc.AsAdmin().Output("logs",
41+
"deployment.apps/windows-machine-config-operator",
42+
"-n", wmcoNamespace,
43+
)
44+
if err != nil {
45+
return fmt.Errorf("failed to get WMCO logs: %w", err)
46+
}
47+
48+
if !strings.Contains(logs, truncated) {
49+
return fmt.Errorf("WMCO logs do not contain expected golang version %s (full: %s)",
50+
truncated, versionInfo.GoVersion)
51+
}
52+
return nil
53+
}

vendor/github.com/go-task/slim-sprig/v3/.editorconfig

Lines changed: 0 additions & 14 deletions
This file was deleted.

vendor/github.com/go-task/slim-sprig/v3/.gitattributes

Lines changed: 0 additions & 1 deletion
This file was deleted.

vendor/github.com/go-task/slim-sprig/v3/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)