Skip to content

Commit

Permalink
fix make test bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyelei committed Dec 2, 2024
1 parent 1a41121 commit b27c78a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion controllers/apps/transformer_cluster_component.go
Original file line number Diff line number Diff line change
Expand Up @@ -835,10 +835,10 @@ func (h *clusterShardingHandler) protoComps(transCtx *clusterTransformContext, n
annotations = transCtx.annotations[spec.Name]
}
obj, err := buildComponentWrapper(transCtx, spec, labels, annotations, running)
setShardingNameLabel(obj, sharding.Name)
if err != nil {
return nil, err
}
setShardingNameLabel(obj, sharding.Name)
objs = append(objs, obj)
}
return objs, nil
Expand Down
7 changes: 6 additions & 1 deletion controllers/apps/transformer_cluster_component_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,12 @@ var _ = Describe("cluster component transformer test", func() {
setters = append(setters, func(comp *appsv1.Component) {
comp.Labels[constant.KBAppShardingNameLabelKey] = shardingName
})
setters = append(setters, func(comp *appsv1.Component) {
if comp.Spec.Labels == nil {
comp.Spec.Labels = map[string]string{}
}
comp.Spec.Labels[constant.KBAppShardingNameLabelKey] = shardingName
})
return newCompObj(transCtx, specs[0], setters...)
}

Expand Down Expand Up @@ -1262,7 +1268,6 @@ var _ = Describe("cluster component transformer test", func() {
}
transCtx.Client = model.NewGraphClient(reader)
transCtx.OrigCluster.Generation += 1 // mock cluster spec update

err := transformer.Transform(transCtx, dag)
Expect(err).Should(BeNil())

Expand Down

0 comments on commit b27c78a

Please sign in to comment.