From 0bc00b50d146240176b5a7931661c0f972b98dff Mon Sep 17 00:00:00 2001 From: hezijie Date: Sun, 18 Feb 2024 15:43:46 +0800 Subject: [PATCH] add retry when the ingress is not ready --- test/e2e/terraform_aks_test.go | 6 ++++++ test/upgrade/upgrade_test.go | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/test/e2e/terraform_aks_test.go b/test/e2e/terraform_aks_test.go index 2affbf05..b41c9a74 100644 --- a/test/e2e/terraform_aks_test.go +++ b/test/e2e/terraform_aks_test.go @@ -7,6 +7,7 @@ import ( "regexp" "strings" "testing" + "time" "github.com/hashicorp/go-retryablehttp" @@ -157,6 +158,11 @@ func TestExamples_applicationGatewayIngress(t *testing.T) { "use_brown_field_application_gateway": u.useBrownFieldAppGw, "create_role_assignments_for_application_gateway": u.createRoleBindingForAppGw, }, + MaxRetries: 20, + TimeBetweenRetries: time.Minute, + RetryableTerraformErrors: map[string]string{ + ".*is empty list of object.*": "the ingress hasn't been created, need more time", + }, }, func(t *testing.T, output test_helper.TerraformOutput) { url, ok := output["ingress_endpoint"].(string) require.True(t, ok) diff --git a/test/upgrade/upgrade_test.go b/test/upgrade/upgrade_test.go index 3a254826..efc79a3a 100644 --- a/test/upgrade/upgrade_test.go +++ b/test/upgrade/upgrade_test.go @@ -4,6 +4,7 @@ import ( "fmt" "os" "testing" + "time" test_helper "github.com/Azure/terraform-module-test-helper" "github.com/gruntwork-io/terratest/modules/terraform" @@ -138,6 +139,11 @@ func TestExampleUpgrade_applicationGw(t *testing.T) { "use_brown_field_application_gateway": u.useBrownFieldAppGw, "create_role_assignments_for_application_gateway": u.createRoleBindingForAppGw, }, + MaxRetries: 20, + TimeBetweenRetries: time.Minute, + RetryableTerraformErrors: map[string]string{ + ".*is empty list of object.*": "the ingress hasn't been created, need more time", + }, }, currentMajorVersion) }) }