Skip to content

Commit

Permalink
Merge branch 'main' into payload
Browse files Browse the repository at this point in the history
  • Loading branch information
gurnben authored Jun 6, 2024
2 parents 1b72be5 + abdc788 commit f78fa33
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ require (
k8s.io/client-go v0.29.4
k8s.io/component-base v0.29.3
k8s.io/klog/v2 v2.120.1
open-cluster-management.io/api v0.13.1-0.20240506072237-800b00d9f0db
open-cluster-management.io/ocm v0.13.1-0.20240521012022-92a2c91f1594
open-cluster-management.io/sdk-go v0.13.1-0.20240520073308-f18d198a844d
open-cluster-management.io/api v0.13.1-0.20240521030453-9d94703b9eba
open-cluster-management.io/ocm v0.13.1-0.20240606073633-61a74bb348a4
open-cluster-management.io/sdk-go v0.13.1-0.20240606075054-7671bb086504
)

require (
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1173,12 +1173,12 @@ k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/A
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA=
k8s.io/utils v0.0.0-20240310230437-4693a0247e57 h1:gbqbevonBh57eILzModw6mrkbwM0gQBEuevE/AaBsHY=
k8s.io/utils v0.0.0-20240310230437-4693a0247e57/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
open-cluster-management.io/api v0.13.1-0.20240506072237-800b00d9f0db h1:puVfabidvMj0phg34e5PqAmC0jzFiVN5LCNlZIEk+CA=
open-cluster-management.io/api v0.13.1-0.20240506072237-800b00d9f0db/go.mod h1:yrNuMMpciXjXPnj2yznb6LTyrGliiTrFZAJDp/Ck3c4=
open-cluster-management.io/ocm v0.13.1-0.20240521012022-92a2c91f1594 h1:BA7d2C96rNIu1SGs4OwJ1s21Gp9aEwlYDL3ZdQokA8g=
open-cluster-management.io/ocm v0.13.1-0.20240521012022-92a2c91f1594/go.mod h1:0l7ESHU83bf7ZrOD8Zv0fQRBoIyAHKaD7SW7Hp5wNik=
open-cluster-management.io/sdk-go v0.13.1-0.20240520073308-f18d198a844d h1:5lcrL1DsQdNtDQU6U2oXwLAN0EBczcvI421YNgEzL/4=
open-cluster-management.io/sdk-go v0.13.1-0.20240520073308-f18d198a844d/go.mod h1:XBrldz+AqVBy9miOVNIu+6l8JXS18i795XbTqIqURJU=
open-cluster-management.io/api v0.13.1-0.20240521030453-9d94703b9eba h1:UsXnD4/N7pxYupPgoLvTq8wO73V72vD2D2ZkDd4iws0=
open-cluster-management.io/api v0.13.1-0.20240521030453-9d94703b9eba/go.mod h1:yrNuMMpciXjXPnj2yznb6LTyrGliiTrFZAJDp/Ck3c4=
open-cluster-management.io/ocm v0.13.1-0.20240606073633-61a74bb348a4 h1:waZV6MKK01jRUmUyLyLRLZUjCdaCvs/AJwqQPNcEHoo=
open-cluster-management.io/ocm v0.13.1-0.20240606073633-61a74bb348a4/go.mod h1:em/6OHu/z7vkwoQanhC3i3lA8bQiKuBQlik6cyk3E5o=
open-cluster-management.io/sdk-go v0.13.1-0.20240606075054-7671bb086504 h1:65KSUUpUapTbaeMx+MuxCqXRyrR3KGtOSFuoJwoXmMA=
open-cluster-management.io/sdk-go v0.13.1-0.20240606075054-7671bb086504/go.mod h1:muWzHWsgK8IsopltwTnsBjf4DN9IcC9rF0G2uEq/Pjw=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
Expand Down
10 changes: 7 additions & 3 deletions test/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/openshift-online/maestro/pkg/controllers"
"github.com/openshift-online/maestro/pkg/event"
"github.com/openshift-online/maestro/pkg/logger"
workv1informers "open-cluster-management.io/api/client/work/informers/externalversions/work/v1"
workv1 "open-cluster-management.io/api/work/v1"
"open-cluster-management.io/sdk-go/pkg/cloudevents/generic"
grpcoptions "open-cluster-management.io/sdk-go/pkg/cloudevents/generic/options/grpc"
Expand Down Expand Up @@ -75,6 +76,7 @@ type Helper struct {
PulseServer *server.PulseServer
ControllerManager *server.ControllersServer
WorkAgentHolder *work.ClientHolder
WorkAgentInformer workv1informers.ManifestWorkInformer
TimeFunc TimeFunc
JWTPrivateKey *rsa.PrivateKey
JWTCA *rsa.PublicKey
Expand Down Expand Up @@ -260,17 +262,19 @@ func (helper *Helper) StartWorkAgent(ctx context.Context, clusterName string, bu
workCodec = codec.NewManifestCodec(nil)
}

clientHolder, err := work.NewClientHolderBuilder(mqttOptions).
clientHolder, informer, err := work.NewClientHolderBuilder(mqttOptions).
WithClientID(clusterName).
WithClusterName(clusterName).
WithCodecs(workCodec).
NewAgentClientHolder(ctx)
NewAgentClientHolderWithInformer(ctx)
if err != nil {
glog.Fatalf("Unable to create work agent holder: %s", err)
}

go clientHolder.ManifestWorkInformer().Informer().Run(ctx.Done())
go informer.Informer().Run(ctx.Done())

helper.WorkAgentHolder = clientHolder
helper.WorkAgentInformer = informer
}

func (helper *Helper) StartGRPCResourceSourceClient() {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/pulse_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func TestPulseServer(t *testing.T) {
h.StartControllerManager(ctx)
h.StartWorkAgent(ctx, consumer.Name, false)
clientHolder := h.WorkAgentHolder
informer := clientHolder.ManifestWorkInformer()
informer := h.WorkAgentInformer
lister := informer.Lister().ManifestWorks(consumer.Name)
agentWorkClient := clientHolder.ManifestWorks(consumer.Name)
resourceService := h.Env().Services.Resources()
Expand Down
8 changes: 4 additions & 4 deletions test/integration/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func TestResourcePost(t *testing.T) {
h.StartControllerManager(ctx)
h.StartWorkAgent(ctx, consumer.Name, false)
clientHolder := h.WorkAgentHolder
informer := clientHolder.ManifestWorkInformer()
informer := h.WorkAgentInformer
lister := informer.Lister().ManifestWorks(consumer.Name)
agentWorkClient := clientHolder.ManifestWorks(consumer.Name)
resourceService := h.Env().Services.Resources()
Expand Down Expand Up @@ -282,7 +282,7 @@ func TestResourcePatch(t *testing.T) {
h.StartControllerManager(ctx)
h.StartWorkAgent(ctx, consumer.ID, false)
clientHolder := h.WorkAgentHolder
informer := clientHolder.ManifestWorkInformer()
informer := h.WorkAgentInformer
lister := informer.Lister().ManifestWorks(consumer.ID)
agentWorkClient := clientHolder.ManifestWorks(consumer.ID)

Expand Down Expand Up @@ -558,7 +558,7 @@ func TestResourceFromGRPC(t *testing.T) {
h.StartControllerManager(ctx)
h.StartWorkAgent(ctx, consumer.Name, false)
clientHolder := h.WorkAgentHolder
informer := clientHolder.ManifestWorkInformer()
informer := h.WorkAgentInformer
agentWorkClient := clientHolder.ManifestWorks(consumer.Name)

// use grpc client to create resource
Expand Down Expand Up @@ -766,7 +766,7 @@ func TestResourceBundleFromGRPC(t *testing.T) {
h.StartControllerManager(ctx)
h.StartWorkAgent(ctx, consumer.Name, true)
clientHolder := h.WorkAgentHolder
informer := clientHolder.ManifestWorkInformer()
informer := h.WorkAgentInformer
agentWorkClient := clientHolder.ManifestWorks(consumer.Name)

// use grpc client to create resource bundle
Expand Down

0 comments on commit f78fa33

Please sign in to comment.