Skip to content

Commit

Permalink
improve reliability of acceptance tests (#3800)
Browse files Browse the repository at this point in the history
* improve reliability of acceptance tests

* remove update to timeout

* add output to error
  • Loading branch information
NiniOak committed Mar 21, 2024
1 parent eb3b0c4 commit 8d86b59
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions acceptance/framework/helpers/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ func RunCommand(t testutil.TestingTB, options *k8s.KubectlOptions, command Comma

select {
case res := <-resultCh:
if res.err != nil {
logger.Logf(t, "Output: %v.", res.output)
}
return res.output, res.err
// Sometimes this func runs for too long handle timeout if needed.
case <-time.After(320 * time.Second):
Expand Down
3 changes: 3 additions & 0 deletions acceptance/tests/api-gateway/api_gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,14 @@ func TestAPIGateway_Basic(t *testing.T) {
logger.Log(t, "creating static-client pod")
k8s.DeployKustomize(t, ctx.KubectlOptions(t), cfg.NoCleanupOnFailure, cfg.NoCleanup, cfg.DebugDirectory, "../fixtures/bases/static-client")

k8s.RunKubectl(t, ctx.KubectlOptions(t), "wait", "--for=condition=available", "--timeout=5m", fmt.Sprintf("deploy/%s", "static-server"))

logger.Log(t, "patching route to target http server")
k8s.RunKubectl(t, ctx.KubectlOptions(t), "patch", "httproute", "http-route", "-p", `{"spec":{"rules":[{"backendRefs":[{"name":"static-server","port":80}]}]}}`, "--type=merge")

logger.Log(t, "creating target tcp server")
k8s.DeployKustomize(t, ctx.KubectlOptions(t), cfg.NoCleanupOnFailure, cfg.NoCleanup, cfg.DebugDirectory, "../fixtures/bases/static-server-tcp")
k8s.RunKubectl(t, ctx.KubectlOptions(t), "wait", "--for=condition=available", "--timeout=5m", fmt.Sprintf("deploy/%s", "static-server-tcp"))

logger.Log(t, "creating tcp-route")
k8s.RunKubectl(t, ctx.KubectlOptions(t), "apply", "-f", "../fixtures/cases/api-gateways/tcproute/route.yaml")
Expand Down

0 comments on commit 8d86b59

Please sign in to comment.