From 5d72d43cc1a2826066ea97b8465cfdbfa1194d9f Mon Sep 17 00:00:00 2001 From: Andrew Peabody Date: Fri, 9 Feb 2024 08:42:09 -0800 Subject: [PATCH 1/7] Update sample_test.go --- test/integration/sample_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/integration/sample_test.go b/test/integration/sample_test.go index e4969768f..e84c7e523 100644 --- a/test/integration/sample_test.go +++ b/test/integration/sample_test.go @@ -82,6 +82,10 @@ func TestSamples(t *testing.T) { tft.WithSetupPath(setupPath), tft.WithRetryableTerraformErrors(retryErrors, 10, time.Minute), ) + + // run discovered tests in parallel upto GOMAXPROCS + t.Parallel() + sampleTest.DefineVerify(func(a *assert.Assertions) {}) sampleTest.Test() t.Logf("Test %s completed in %s project", sampleName, tg.projectID) From ee7ab4cf98a64b0c59608ae802c110ad4beca68f Mon Sep 17 00:00:00 2001 From: Andrew Peabody Date: Fri, 9 Feb 2024 08:42:57 -0800 Subject: [PATCH 2/7] Update int.cloudbuild.yaml --- build/int.cloudbuild.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/int.cloudbuild.yaml b/build/int.cloudbuild.yaml index 62b5facdc..4502ca955 100644 --- a/build/int.cloudbuild.yaml +++ b/build/int.cloudbuild.yaml @@ -71,3 +71,5 @@ tags: substitutions: _DOCKER_IMAGE_DEVELOPER_TOOLS: 'cft/developer-tools' _DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '1' +options: + machineType: E2_HIGHCPU_32 From b21e1a91b39672a5759b5675c2d5eada55f4434a Mon Sep 17 00:00:00 2001 From: Andrew Peabody Date: Fri, 9 Feb 2024 08:55:24 -0800 Subject: [PATCH 3/7] Update int.cloudbuild.yaml --- build/int.cloudbuild.yaml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/build/int.cloudbuild.yaml b/build/int.cloudbuild.yaml index 4502ca955..cab7d9029 100644 --- a/build/int.cloudbuild.yaml +++ b/build/int.cloudbuild.yaml @@ -14,20 +14,6 @@ timeout: 14400s steps: -- id: prune unchanged directories - name: gcr.io/cloud-builders/git - entrypoint: bash - args: - - -c - - | - git fetch --unshallow - git diff origin/${_BASE_BRANCH} --name-only > _changed_files - sed 's/\/.*/\//' _changed_files > _changed_folders - for d in */; do - if ! grep -q "^$d" _changed_folders && [[ "$d" != "test/" ]]; then - rm -rf $d; - fi - done - id: prepare name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS' args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && prepare_environment'] From 6b6f4c0b5e6a5ada1de1afbbfd3dd5622a0dab53 Mon Sep 17 00:00:00 2001 From: Andrew Peabody Date: Fri, 9 Feb 2024 09:36:29 -0800 Subject: [PATCH 4/7] Update sample_test.go --- test/integration/sample_test.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/test/integration/sample_test.go b/test/integration/sample_test.go index e84c7e523..e120cde17 100644 --- a/test/integration/sample_test.go +++ b/test/integration/sample_test.go @@ -83,11 +83,18 @@ func TestSamples(t *testing.T) { tft.WithRetryableTerraformErrors(retryErrors, 10, time.Minute), ) + sampleTest.DefineVerify(func(a *assert.Assertions) {}) + + a := assert.New(sampleTest.t) + utils.RunStage("init", func() { sampleTest.Init(a) }) + // run discovered tests in parallel upto GOMAXPROCS t.Parallel() - - sampleTest.DefineVerify(func(a *assert.Assertions) {}) - sampleTest.Test() + + defer utils.RunStage("teardown", func() { sampleTest.Teardown(a) }) + utils.RunStage("apply", func() { sampleTest.Apply(a) }) + utils.RunStage("verify", func() { sampleTest.Verify(a) }) + t.Logf("Test %s completed in %s project", sampleName, tg.projectID) }) } From d384790aedea0b07261d5a7750a009e250771a14 Mon Sep 17 00:00:00 2001 From: Andrew Peabody Date: Fri, 9 Feb 2024 09:51:02 -0800 Subject: [PATCH 5/7] Update sample_test.go --- test/integration/sample_test.go | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/test/integration/sample_test.go b/test/integration/sample_test.go index e120cde17..1cc9db356 100644 --- a/test/integration/sample_test.go +++ b/test/integration/sample_test.go @@ -82,18 +82,21 @@ func TestSamples(t *testing.T) { tft.WithSetupPath(setupPath), tft.WithRetryableTerraformErrors(retryErrors, 10, time.Minute), ) - - sampleTest.DefineVerify(func(a *assert.Assertions) {}) - a := assert.New(sampleTest.t) - utils.RunStage("init", func() { sampleTest.Init(a) }) + sampleTest.DefineInit(func(a *assert.Assertions) { + terraform.Init(b.t, b.GetTFOptions()) - // run discovered tests in parallel upto GOMAXPROCS - t.Parallel() + // run tests in parallel upto GOMAXPROCS + b.t.Parallel() - defer utils.RunStage("teardown", func() { sampleTest.Teardown(a) }) - utils.RunStage("apply", func() { sampleTest.Apply(a) }) - utils.RunStage("verify", func() { sampleTest.Verify(a) }) + terraform.Validate(b.t, terraform.WithDefaultRetryableErrors(b.t, &terraform.Options{ + TerraformDir: b.tfDir, + Logger: b.logger, + NoColor: true, + })) + }) + sampleTest.DefineVerify(func(a *assert.Assertions) {}) + sampleTest.Test() t.Logf("Test %s completed in %s project", sampleName, tg.projectID) }) From dada8dab0ac22980b8d4ab7be84edc5fcbd74f90 Mon Sep 17 00:00:00 2001 From: Andrew Peabody Date: Fri, 9 Feb 2024 10:06:59 -0800 Subject: [PATCH 6/7] Update sample_test.go --- test/integration/sample_test.go | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/test/integration/sample_test.go b/test/integration/sample_test.go index 1cc9db356..bb5637f4e 100644 --- a/test/integration/sample_test.go +++ b/test/integration/sample_test.go @@ -84,20 +84,13 @@ func TestSamples(t *testing.T) { ) sampleTest.DefineInit(func(a *assert.Assertions) { - terraform.Init(b.t, b.GetTFOptions()) + sampleTest.DefaultInit(a) // run tests in parallel upto GOMAXPROCS - b.t.Parallel() - - terraform.Validate(b.t, terraform.WithDefaultRetryableErrors(b.t, &terraform.Options{ - TerraformDir: b.tfDir, - Logger: b.logger, - NoColor: true, - })) + sampleTest.t.Parallel() }) sampleTest.DefineVerify(func(a *assert.Assertions) {}) sampleTest.Test() - t.Logf("Test %s completed in %s project", sampleName, tg.projectID) }) } From b3b094307a4daa60ea1effc02eb38502f8c43304 Mon Sep 17 00:00:00 2001 From: Andrew Peabody Date: Fri, 9 Feb 2024 10:37:59 -0800 Subject: [PATCH 7/7] Update sample_test.go --- test/integration/sample_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/sample_test.go b/test/integration/sample_test.go index bb5637f4e..2f5635065 100644 --- a/test/integration/sample_test.go +++ b/test/integration/sample_test.go @@ -87,7 +87,7 @@ func TestSamples(t *testing.T) { sampleTest.DefaultInit(a) // run tests in parallel upto GOMAXPROCS - sampleTest.t.Parallel() + b.t.Parallel() }) sampleTest.DefineVerify(func(a *assert.Assertions) {}) sampleTest.Test()