Skip to content

Commit

Permalink
improve reliability of acceptance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NiniOak committed Mar 20, 2024
1 parent 9006fef commit 6e6f4c9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 6 additions & 2 deletions acceptance/framework/helpers/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,13 @@ func RunCommand(t testutil.TestingTB, options *k8s.KubectlOptions, command Comma

select {
case res := <-resultCh:
return res.output, res.err
if res.err != nil {
resErr := fmt.Errorf("error: %v\nOutput: %s", res.err, res.output)
return "", resErr
}
return res.output, nil
// Sometimes this func runs for too long handle timeout if needed.
case <-time.After(320 * time.Second):
case <-time.After(400 * time.Second):
GetCRDRemoveFinalizers(t, options)
logger.Logf(t, "RunCommand timed out")
return "", nil
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 6e6f4c9

Please sign in to comment.