Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(CI): add retry for common errors #44

Merged
merged 1 commit into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion test/integration/appfactory/appfactory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@ package appfactory

import (
"testing"
"time"

"github.com/GoogleCloudPlatform/cloud-foundation-toolkit/infra/blueprint-test/pkg/tft"
"github.com/stretchr/testify/assert"
"github.com/terraform-google-modules/enterprise-application/test/integration/testutils"
)

func TestAppfactory(t *testing.T) {
bootstrap := tft.NewTFBlueprintTest(t,
tft.WithTFDir("../../../3-appfactory/apps"),
tft.WithTFDir("../../../3-appfactory/apps"),
tft.WithRetryableTerraformErrors(testutils.RetryableTransientErrors, 3, 2*time.Minute),
)

bootstrap.DefineVerify(func(assert *assert.Assertions) {
Expand Down
5 changes: 4 additions & 1 deletion test/integration/bootstrap/bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@ package bootstrap

import (
"testing"
"time"

"github.com/GoogleCloudPlatform/cloud-foundation-toolkit/infra/blueprint-test/pkg/tft"
"github.com/stretchr/testify/assert"
"github.com/terraform-google-modules/enterprise-application/test/integration/testutils"
)

func TestBootstrap(t *testing.T) {
bootstrap := tft.NewTFBlueprintTest(t,
tft.WithTFDir("../../../1-bootstrap"),
tft.WithTFDir("../../../1-bootstrap"),
tft.WithRetryableTerraformErrors(testutils.RetryableTransientErrors, 3, 2*time.Minute),
)

bootstrap.DefineVerify(func(assert *assert.Assertions) {
Expand Down
3 changes: 3 additions & 0 deletions test/integration/fleetscope/fleetscope_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ package fleetscope
import (
"fmt"
"testing"
"time"

"github.com/GoogleCloudPlatform/cloud-foundation-toolkit/infra/blueprint-test/pkg/tft"
"github.com/terraform-google-modules/enterprise-application/test/integration/testutils"
)

func TestFleetscope(t *testing.T) {
Expand All @@ -42,6 +44,7 @@ func TestFleetscope(t *testing.T) {
fleetscope := tft.NewTFBlueprintTest(t,
tft.WithTFDir(fmt.Sprintf("../../../4-fleetscope/envs/%s", envName)),
tft.WithVars(vars),
tft.WithRetryableTerraformErrors(testutils.RetryableTransientErrors, 3, 2*time.Minute),
)
fleetscope.Test()
})
Expand Down
3 changes: 3 additions & 0 deletions test/integration/multitenant/multitenant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ package multitenant
import (
"fmt"
"testing"
"time"

"github.com/GoogleCloudPlatform/cloud-foundation-toolkit/infra/blueprint-test/pkg/tft"
"github.com/terraform-google-modules/enterprise-application/test/integration/testutils"
)

func TestMultitenant(t *testing.T) {
Expand All @@ -33,6 +35,7 @@ func TestMultitenant(t *testing.T) {
t.Parallel()
multitenant := tft.NewTFBlueprintTest(t,
tft.WithTFDir(fmt.Sprintf("../../../2-multitenant/envs/%s", envName)),
tft.WithRetryableTerraformErrors(testutils.RetryableTransientErrors, 3, 2*time.Minute),
)
multitenant.Test()
})
Expand Down
22 changes: 22 additions & 0 deletions test/integration/testutils/retry.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package testutils

var (
RetryableTransientErrors = map[string]string{
// Error 409: unable to queue the operation
".*Error 409.*unable to queue the operation": "Unable to queue operation.",
}
)