Skip to content

Commit

Permalink
add better check for load balancing
Browse files Browse the repository at this point in the history
  • Loading branch information
wilkermichael committed Oct 3, 2023
1 parent 424b498 commit 3a44e5e
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions acceptance/tests/wan-federation/wan_federation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ func serviceFailoverCheck(t *testing.T, options *terratestK8s.KubectlOptions, po
var err error

// Retry until we get the response we expect, sometimes you get back the previous server until things stabalize
logger.Log(t, "Initial curl check")
retry.RunWith(timer, t, func(r *retry.R) {
resp, err = k8s.RunKubectlAndGetOutputE(t, options, "exec", "-i",
staticClientDeployment, "-c", connhelper.StaticClientName, "--", "curl", fmt.Sprintf("localhost:%s", port))
Expand All @@ -432,12 +433,18 @@ func serviceFailoverCheck(t *testing.T, options *terratestK8s.KubectlOptions, po
})

// Try again to rule out load-balancing. Errors can still happen so retry
retry.RunWith(timer, t, func(r *retry.R) {
resp, err = k8s.RunKubectlAndGetOutputE(t, options, "exec", "-i",
staticClientDeployment, "-c", connhelper.StaticClientName, "--", "curl", fmt.Sprintf("localhost:%s", port))
assert.NoError(r, err)
})
require.Contains(t, resp, expectedName)
logger.Log(t, "Curl check again for load balancing")
for i := 0; i < 10; i++ {
time.Sleep(500 * time.Millisecond)
resp = ""
retry.RunWith(timer, t, func(r *retry.R) {
resp, err = k8s.RunKubectlAndGetOutputE(t, options, "exec", "-i",
staticClientDeployment, "-c", connhelper.StaticClientName, "--", "curl", fmt.Sprintf("localhost:%s", port))
assert.NoError(r, err)
})
require.Contains(t, resp, expectedName)
}

logger.Log(t, resp)
}

Expand Down

0 comments on commit 3a44e5e

Please sign in to comment.