Skip to content

Commit 01b66a6

Browse files
authored
Update sdk-go so we can support executor test for cloudevent (#1182)
Signed-off-by: Jian Qiu <[email protected]>
1 parent 6d4561c commit 01b66a6

File tree

10 files changed

+65
-30
lines changed

10 files changed

+65
-30
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ require (
4141
k8s.io/utils v0.0.0-20241210054802-24370beab758
4242
open-cluster-management.io/addon-framework v1.0.1-0.20250811135502-4bae358d84c6
4343
open-cluster-management.io/api v1.0.1-0.20250903073454-c6702adf44cc
44-
open-cluster-management.io/sdk-go v1.0.1-0.20250905083121-3fc951c340cc
44+
open-cluster-management.io/sdk-go v1.0.1-0.20250911065113-bff262df709b
4545
sigs.k8s.io/about-api v0.0.0-20250131010323-518069c31c03
4646
sigs.k8s.io/cluster-inventory-api v0.0.0-20240730014211-ef0154379848
4747
sigs.k8s.io/controller-runtime v0.21.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,8 +559,8 @@ open-cluster-management.io/addon-framework v1.0.1-0.20250811135502-4bae358d84c6
559559
open-cluster-management.io/addon-framework v1.0.1-0.20250811135502-4bae358d84c6/go.mod h1:fOPWaRyo6upgHFskcL18Al1kI2Ua9HzrS8uothWEe84=
560560
open-cluster-management.io/api v1.0.1-0.20250903073454-c6702adf44cc h1:U8O6RhHjp088oWuQsGx6pwwFpOFgWo1gl9qhgIGgDpk=
561561
open-cluster-management.io/api v1.0.1-0.20250903073454-c6702adf44cc/go.mod h1:lEc5Wkc9ON5ym/qAtIqNgrE7NW7IEOCOC611iQMlnKM=
562-
open-cluster-management.io/sdk-go v1.0.1-0.20250905083121-3fc951c340cc h1:wi6w+Gi7MhGepfDFNN71JGc5jIsWWJOtcXJFQfHripM=
563-
open-cluster-management.io/sdk-go v1.0.1-0.20250905083121-3fc951c340cc/go.mod h1:JVQupKu0xVcuVP4IUJF7hjvrXK8plZiwGPZcdqngjXk=
562+
open-cluster-management.io/sdk-go v1.0.1-0.20250911065113-bff262df709b h1:tzgcM+yJJBgMwYYbjfzW4kL8p7bsHnScE5lS/69lksE=
563+
open-cluster-management.io/sdk-go v1.0.1-0.20250911065113-bff262df709b/go.mod h1:JVQupKu0xVcuVP4IUJF7hjvrXK8plZiwGPZcdqngjXk=
564564
sigs.k8s.io/about-api v0.0.0-20250131010323-518069c31c03 h1:1ShFiMjGQOR/8jTBkmZrk1gORxnvMwm1nOy2/DbHg4U=
565565
sigs.k8s.io/about-api v0.0.0-20250131010323-518069c31c03/go.mod h1:F1pT4mK53U6F16/zuaPSYpBaR7x5Kjym6aKJJC0/DHU=
566566
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 h1:jpcvIRr3GLoUoEKRkHKSmGjxb6lWwrBlJsXc+eUYQHM=

test/integration-test.mk

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,24 +54,20 @@ test-addon-integration: ensure-kubebuilder-tools
5454
.PHONY: test-addon-integration
5555

5656
# In the cloud events scenario, skip the following tests
57-
# - executor_test.go, this feature is not supported yet by cloud events work client
5857
# - unmanaged_appliedwork_test.go, this test mainly focus on switching the hub kube-apiserver
5958
# - manifestworkreplicaset_test.go, this test needs to update the work status with the hub work client,
6059
# cloud events work client does not support it. (TODO) may add e2e to for mwrs.
6160
test-cloudevents-work-mqtt-integration: ensure-kubebuilder-tools build-work-integration
6261
./work-integration.test -ginkgo.slow-spec-threshold=15s -ginkgo.v -ginkgo.fail-fast \
6362
-ginkgo.skip-file manifestworkreplicaset_test.go \
64-
-ginkgo.skip-file executor_test.go \
6563
-ginkgo.skip-file unmanaged_appliedwork_test.go \
6664
-test.driver=mqtt \
6765
-v=4 ${ARGS}
6866
.PHONY: test-cloudevents-work-mqtt-integration
6967

7068
# In the cloud events scenario, skip the following tests
71-
# - executor_test.go, this feature is not supported yet since the executor field is not in the manifestbundle.
7269
test-cloudevents-work-grpc-integration: ensure-kubebuilder-tools build-work-integration
7370
./work-integration.test -ginkgo.slow-spec-threshold=15s -ginkgo.v -ginkgo.fail-fast \
74-
-ginkgo.skip-file executor_test.go \
7571
-test.driver=grpc \
7672
-v=4 ${ARGS}
7773
.PHONY: test-cloudevents-work-grpc-integration

test/integration/work/executor_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package work
33
import (
44
"context"
55
"encoding/json"
6+
"fmt"
67

78
jsonpatch "github.com/evanphx/json-patch"
89
"github.com/onsi/ginkgo/v2"
@@ -58,8 +59,8 @@ var _ = ginkgo.Describe("ManifestWork Executor Subject", func() {
5859
})
5960

6061
ginkgo.JustBeforeEach(func() {
61-
work = util.NewManifestWork(clusterName, "", manifests)
62-
gomega.Expect(err).ToNot(gomega.HaveOccurred())
62+
workName := fmt.Sprintf("executor-work-%s", utilrand.String(5))
63+
work = util.NewManifestWork(clusterName, workName, manifests)
6364
work.Spec.Executor = executor
6465
})
6566

test/integration/work/suite_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ var _ = ginkgo.BeforeSuite(func() {
129129

130130
// start hub controller
131131
go func() {
132+
defer ginkgo.GinkgoRecover()
132133
opts := hub.NewWorkHubManagerOptions()
133134
opts.WorkDriver = "kube"
134135
opts.WorkDriverConfig = sourceConfigFileName
@@ -172,6 +173,7 @@ var _ = ginkgo.BeforeSuite(func() {
172173

173174
// start hub controller
174175
go func() {
176+
defer ginkgo.GinkgoRecover()
175177
// in grpc driver, hub controller still calls hub kube-apiserver.
176178
sourceKubeConfigFileName := path.Join(tempDir, "kubeconfig")
177179
err = util.CreateKubeconfigFile(cfg, sourceKubeConfigFileName)
@@ -223,6 +225,7 @@ type agentOptionsDecorator func(opt *spoke.WorkloadAgentOptions, commonOpt *comm
223225
*spoke.WorkloadAgentOptions, *commonoptions.AgentOptions)
224226

225227
func startWorkAgent(ctx context.Context, clusterName string, decorators ...agentOptionsDecorator) {
228+
defer ginkgo.GinkgoRecover()
226229
o := spoke.NewWorkloadAgentOptions()
227230
o.StatusSyncInterval = 3 * time.Second
228231
o.WorkloadSourceDriver = sourceDriver
@@ -261,7 +264,10 @@ func startGRPCServer(ctx context.Context, temp string, cfg *rest.Config) (string
261264

262265
hook, err := util.NewGRPCServerWorkHook(cfg)
263266
gomega.Expect(err).NotTo(gomega.HaveOccurred())
264-
go hook.Run(ctx)
267+
go func() {
268+
defer ginkgo.GinkgoRecover()
269+
hook.Run(ctx)
270+
}()
265271

266272
grpcEventServer := cloudeventsgrpc.NewGRPCBroker()
267273
grpcEventServer.RegisterService(payload.ManifestBundleEventDataType,
@@ -277,6 +283,7 @@ func startGRPCServer(ctx context.Context, temp string, cfg *rest.Config) (string
277283
WithExtraMetrics(cemetrics.CloudEventsGRPCMetrics()...)
278284

279285
go func() {
286+
defer ginkgo.GinkgoRecover()
280287
err := server.Run(ctx)
281288
gomega.Expect(err).NotTo(gomega.HaveOccurred())
282289
}()

vendor/modules.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1813,7 +1813,7 @@ open-cluster-management.io/api/operator/v1
18131813
open-cluster-management.io/api/utils/work/v1/workapplier
18141814
open-cluster-management.io/api/work/v1
18151815
open-cluster-management.io/api/work/v1alpha1
1816-
# open-cluster-management.io/sdk-go v1.0.1-0.20250905083121-3fc951c340cc
1816+
# open-cluster-management.io/sdk-go v1.0.1-0.20250911065113-bff262df709b
18171817
## explicit; go 1.24.0
18181818
open-cluster-management.io/sdk-go/pkg/apis/cluster/v1alpha1
18191819
open-cluster-management.io/sdk-go/pkg/apis/cluster/v1beta1

vendor/open-cluster-management.io/sdk-go/pkg/cloudevents/clients/work/agent/codec/manifestbundle.go

Lines changed: 40 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/open-cluster-management.io/sdk-go/pkg/cloudevents/clients/work/payload/manifestbundle.go

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/open-cluster-management.io/sdk-go/pkg/cloudevents/clients/work/source/codec/manifestbundle.go

Lines changed: 4 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/open-cluster-management.io/sdk-go/pkg/cloudevents/generic/types/types.go

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)