Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
leon-inf committed Apr 24, 2024
1 parent 9d355ee commit e0db691
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pkg/controller/component/vars_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ var _ = Describe("vars", func() {
Expect(err).ShouldNot(BeNil())
Expect(err.Error()).Should(ContainSubstring("the required var is not found"))

By("adaptive - has load balancer service")
By("adaptive - has load balancer pod service")
vars = []appsv1alpha1.EnvVar{
{
Name: "advertised",
Expand Down Expand Up @@ -903,7 +903,9 @@ var _ = Describe("vars", func() {
Expect(err).Should(Succeed())
checkEnvVarWithValue(envVars, "advertised", advertisedSvcName)

By("adaptive - has load balancer in provisioning")
By("adaptive - has load balancer service in provisioning")
// change to non pod-service
advertisedSvcName = constant.GenerateComponentServiceName(synthesizedComp.ClusterName, synthesizedComp.Name, "advertised")
reader = &mockReader{
cli: testCtx.Cli,
objs: []client.Object{
Expand Down Expand Up @@ -961,10 +963,7 @@ var _ = Describe("vars", func() {
}
_, envVars, err = ResolveTemplateNEnvVars(testCtx.Ctx, reader, synthesizedComp, vars)
Expect(err).Should(Succeed())
endpoints = []string{
fmt.Sprintf("%s:127.0.0.1", advertisedSvcName),
}
checkEnvVarWithValue(envVars, "advertised", strings.Join(endpoints, ","))
checkEnvVarWithValue(envVars, "advertised", "127.0.0.1")
})

It("credential vars", func() {
Expand Down
2 changes: 2 additions & 0 deletions pkg/controller/multicluster/placement.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ func FromContext(ctx context.Context) (string, error) {
return "", placementNotFoundError{}
}

// TODO: replace it with a new client option and automatically perform the assignment based on ordinal.

func Assign(ctx context.Context, obj client.Object, ordinal func() int) client.Object {
// has been set
if obj.GetAnnotations() != nil && obj.GetAnnotations()[constant.KBAppMultiClusterPlacementKey] != "" {
Expand Down

0 comments on commit e0db691

Please sign in to comment.