From dc0d87255abfed61a30e5977e8c439c485acddbd Mon Sep 17 00:00:00 2001 From: Jakub Michalak Date: Fri, 21 Feb 2025 12:22:14 +0100 Subject: [PATCH 1/7] Shorten tests --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index dbf6cb019d..41f4e1eca5 100644 --- a/Makefile +++ b/Makefile @@ -62,10 +62,11 @@ sweep: ## destroy the whole architecture; USE ONLY FOR DEVELOPMENT ACCOUNTS fi; test: test-client ## run unit and integration tests - go test -v -cover -timeout=45m ./... + # go test -v -cover -timeout=45m ./... + go test -timeout 600s -run ^Test_Provider_toDriverLogLevel$ github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk -v test-acceptance: ## run acceptance tests - TF_ACC=1 SF_TF_ACC_TEST_CONFIGURE_CLIENT_ONCE=true TEST_SF_TF_REQUIRE_TEST_OBJECT_SUFFIX=1 SF_TF_ACC_TEST_ENABLE_ALL_PREVIEW_FEATURES=true go test -run "^TestAcc_" -v -cover -timeout=120m ./... + # TF_ACC=1 SF_TF_ACC_TEST_CONFIGURE_CLIENT_ONCE=true TEST_SF_TF_REQUIRE_TEST_OBJECT_SUFFIX=1 SF_TF_ACC_TEST_ENABLE_ALL_PREVIEW_FEATURES=true go test -run "^TestAcc_" -v -cover -timeout=120m ./... test-integration: ## run SDK integration tests TEST_SF_TF_REQUIRE_TEST_OBJECT_SUFFIX=1 go test -run "^TestInt_" -v -cover -timeout=60m ./... From 195efd2707bf8e6c7005bbcc10ffe7da2a0c96b9 Mon Sep 17 00:00:00 2001 From: Jakub Michalak Date: Fri, 21 Feb 2025 13:00:11 +0100 Subject: [PATCH 2/7] Fix pipeline --- .github/workflows/tests.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 824bd0cb0e..e55c8596de 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -29,7 +29,18 @@ jobs: else echo "shas are equal" fi - - uses: actions/checkout@v3 + # - uses: actions/checkout@v3 + - name: Checkout Code (Dispatch event) + if: (github.event_name == 'repository_dispatch') + uses: actions/checkout@v3 + with: + repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }} + ref: ${{ github.event.client_payload.pull_request.head.ref }} + + - name: Checkout Code (PR event) + if: (github.event_name == 'pull_request') + uses: actions/checkout@v3 + - uses: actions/setup-go@v4 with: From 11268dd660d879d6532c3367343d7b66d31cefb6 Mon Sep 17 00:00:00 2001 From: Jakub Michalak Date: Fri, 21 Feb 2025 13:08:55 +0100 Subject: [PATCH 3/7] Debug pipelines --- .github/workflows/tests.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e55c8596de..0fe69af55e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,6 +28,11 @@ jobs: if [ "${SHAHEAD}" != "${SHAINPUT}" ]; then echo "sha input from slash command does not equal the head sha" ; exit 1 else echo "shas are equal" fi + echo ======== + echo \"${{ github.event_name }}\" + echo \"${{ github.event.client_payload.pull_request.head.repo.full_name }}\" + echo \"${{ github.event.client_payload.pull_request.head.ref }}\" + # - uses: actions/checkout@v3 - name: Checkout Code (Dispatch event) From 814e4e22ae230c8ccd708b2bf4ef9c331c30818b Mon Sep 17 00:00:00 2001 From: Jakub Michalak Date: Fri, 21 Feb 2025 14:21:27 +0100 Subject: [PATCH 4/7] Specify repository and ref in PR event --- .github/workflows/tests.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0fe69af55e..3d8b6f4b0d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,6 +3,7 @@ on: repository_dispatch: types: [ok-to-test-command] pull_request: + workflow_dispatch: name: tests jobs: @@ -45,7 +46,9 @@ jobs: - name: Checkout Code (PR event) if: (github.event_name == 'pull_request') uses: actions/checkout@v3 - + with: + repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }} + ref: ${{ github.head_ref }} - uses: actions/setup-go@v4 with: From 184bfa80a6720f1a420311c82932fda81ffdd634 Mon Sep 17 00:00:00 2001 From: Jakub Michalak Date: Fri, 21 Feb 2025 15:27:00 +0100 Subject: [PATCH 5/7] Revert "Shorten tests" This reverts commit dc0d87255abfed61a30e5977e8c439c485acddbd. --- Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 41f4e1eca5..dbf6cb019d 100644 --- a/Makefile +++ b/Makefile @@ -62,11 +62,10 @@ sweep: ## destroy the whole architecture; USE ONLY FOR DEVELOPMENT ACCOUNTS fi; test: test-client ## run unit and integration tests - # go test -v -cover -timeout=45m ./... - go test -timeout 600s -run ^Test_Provider_toDriverLogLevel$ github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk -v + go test -v -cover -timeout=45m ./... test-acceptance: ## run acceptance tests - # TF_ACC=1 SF_TF_ACC_TEST_CONFIGURE_CLIENT_ONCE=true TEST_SF_TF_REQUIRE_TEST_OBJECT_SUFFIX=1 SF_TF_ACC_TEST_ENABLE_ALL_PREVIEW_FEATURES=true go test -run "^TestAcc_" -v -cover -timeout=120m ./... + TF_ACC=1 SF_TF_ACC_TEST_CONFIGURE_CLIENT_ONCE=true TEST_SF_TF_REQUIRE_TEST_OBJECT_SUFFIX=1 SF_TF_ACC_TEST_ENABLE_ALL_PREVIEW_FEATURES=true go test -run "^TestAcc_" -v -cover -timeout=120m ./... test-integration: ## run SDK integration tests TEST_SF_TF_REQUIRE_TEST_OBJECT_SUFFIX=1 go test -run "^TestInt_" -v -cover -timeout=60m ./... From e5c5dfb40a46140cee089f89f03d71c3cfddb723 Mon Sep 17 00:00:00 2001 From: Jakub Michalak Date: Fri, 21 Feb 2025 15:27:38 +0100 Subject: [PATCH 6/7] Use default branch for PR event --- .github/workflows/tests.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3d8b6f4b0d..289e3673cd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,7 +3,6 @@ on: repository_dispatch: types: [ok-to-test-command] pull_request: - workflow_dispatch: name: tests jobs: @@ -35,7 +34,6 @@ jobs: echo \"${{ github.event.client_payload.pull_request.head.ref }}\" - # - uses: actions/checkout@v3 - name: Checkout Code (Dispatch event) if: (github.event_name == 'repository_dispatch') uses: actions/checkout@v3 @@ -46,9 +44,6 @@ jobs: - name: Checkout Code (PR event) if: (github.event_name == 'pull_request') uses: actions/checkout@v3 - with: - repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }} - ref: ${{ github.head_ref }} - uses: actions/setup-go@v4 with: From 3b5ce99f48c9045899547b899e7c00b448e1ccec Mon Sep 17 00:00:00 2001 From: Jakub Michalak Date: Fri, 21 Feb 2025 15:32:47 +0100 Subject: [PATCH 7/7] Debug info --- .github/workflows/tests.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 289e3673cd..874d4b99ee 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -29,19 +29,17 @@ jobs: else echo "shas are equal" fi echo ======== - echo \"${{ github.event_name }}\" echo \"${{ github.event.client_payload.pull_request.head.repo.full_name }}\" echo \"${{ github.event.client_payload.pull_request.head.ref }}\" - - - name: Checkout Code (Dispatch event) + - name: Checkout Code (Repository Dispatch Event) if: (github.event_name == 'repository_dispatch') uses: actions/checkout@v3 with: repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }} ref: ${{ github.event.client_payload.pull_request.head.ref }} - - name: Checkout Code (PR event) + - name: Checkout Code (Pull Request Event) if: (github.event_name == 'pull_request') uses: actions/checkout@v3