Skip to content

Commit

Permalink
test(e2e): add failing MeshMultiZoneService and MeshLoadBalancingStra…
Browse files Browse the repository at this point in the history
…tegy case

Also fix existing assertion.

Signed-off-by: Mike Beaumont <[email protected]>
  • Loading branch information
michaelbeaumont committed Nov 5, 2024
1 parent c0883d4 commit 863d1bf
Showing 1 changed file with 36 additions and 2 deletions.
38 changes: 36 additions & 2 deletions test/e2e_env/multizone/localityawarelb/meshmultizoneservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ spec:
testserver.WithMesh(meshName),
testserver.WithEchoArgs("echo", "--instance", "kube-test-server-1"),
)).
Install(democlient.Install(democlient.WithNamespace(namespace), democlient.WithMesh(meshName))).
SetupInGroup(multizone.KubeZone1, &group)

NewClusterSetup().
Expand Down Expand Up @@ -115,7 +116,9 @@ spec:
It("should fallback only to first zone", func() {
// given traffic to other zones
Eventually(responseFromInstance(multizone.KubeZone2), "30s", "1s").
MustPassRepeatedly(5).Should(Or(Equal("kube-test-server-1"), Equal("uni-test-server")))
Should(Equal("kube-test-server-1"))
Eventually(responseFromInstance(multizone.KubeZone2), "30s", "1s").
Should(Equal("uni-test-server"))

// when
policy := `
Expand All @@ -129,7 +132,7 @@ spec:
- targetRef:
kind: MeshMultiZoneService
labels:
kuma.io/display-name: test-server
kuma.io/display-name: test-server
default:
localityAwareness:
crossZone:
Expand All @@ -151,4 +154,35 @@ spec:
Eventually(responseFromInstance(multizone.KubeZone2), "30s", "1s").
MustPassRepeatedly(5).Should(Equal("kube-test-server-1"))
})

It("should be locality aware unless disabled", func() {
// given traffic only to the local zone
Eventually(responseFromInstance(multizone.KubeZone1), "30s", "1s").
MustPassRepeatedly(5).Should(Equal("kube-test-server-1"))

// when
policy := `
type: MeshLoadBalancingStrategy
name: mlb-mzms
mesh: mlb-mzms
spec:
targetRef:
kind: Mesh
to:
- targetRef:
kind: MeshMultiZoneService
labels:
kuma.io/display-name: test-server
default:
localityAwareness:
disabled: true
`
err := multizone.Global.Install(YamlUniversal(policy))

// then
Expect(err).ToNot(HaveOccurred())

Eventually(responseFromInstance(multizone.KubeZone1), "30s", "1s").
Should(Equal("uni-test-server"))
})
}

0 comments on commit 863d1bf

Please sign in to comment.