From a994c2077f7ed379a7ede85d0396ede06ef605e6 Mon Sep 17 00:00:00 2001 From: Matthew Casperson Date: Tue, 5 Dec 2023 14:48:08 +1000 Subject: [PATCH] Fixes https://github.com/OctopusDeployLabs/terraform-provider-octopusdeploy/issues/580 Splits tests to ensure they run quickly. --- .github/workflows/integration-tests.yaml | 92 ++++++++++++++----- .../schema_cloud_region_deployment_target.go | 2 - 2 files changed, 71 insertions(+), 23 deletions(-) diff --git a/.github/workflows/integration-tests.yaml b/.github/workflows/integration-tests.yaml index 306ee49d8..8121e5b86 100644 --- a/.github/workflows/integration-tests.yaml +++ b/.github/workflows/integration-tests.yaml @@ -3,6 +3,15 @@ name: Integration Tests workflow_dispatch: {} push: {} jobs: + tests: + name: Test + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + parallel: [ 15 ] + index: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 ] + build: runs-on: ubuntu-latest steps: @@ -13,8 +22,6 @@ jobs: terraform_wrapper: false - name: Set up Go uses: actions/setup-go@v2 - with: - go-version: 1.20.5 - uses: actions/setup-python@v4 with: python-version: '3.10' @@ -41,6 +48,21 @@ jobs: --header "X-GitHub-Api-Version: 2022-11-28" | jq -r '"GIT_CREDENTIAL=" + .token' > "$GITHUB_ENV" env: GH_APP_INSTALLATION_ID: ${{ secrets.GH_APP_INSTALLATION_ID }} + - name: Download JUnit Summary from Previous Workflow + id: download-artifact + uses: dawidd6/action-download-artifact@v2 + with: + workflow_conclusion: success + name: junit-test-summary + if_no_artifact_found: warn + branch: main + - name: Split integration tests + id: test_split + uses: hashicorp-forge/go-test-split-action@v1 + with: + index: ${{ matrix.index }} + total: ${{ matrix.parallel }} + junit-summary: ./junit-test-summary.xml - name: Install Dependencies run: go get ./... shell: bash @@ -59,22 +81,8 @@ jobs: - name: Install gotestsum run: go install gotest.tools/gotestsum@latest shell: bash - # The GitHub token we generated is valid for an hour. The full test suite can run for longer than an hour. - # So we first run the git tests while the token is fresh, and the run the rest of the tests. - name: Test Git integration - run: go test -v -timeout 0 -run "^\\QTestProjectWithGitUsernameExport\\E$" integration_test.go - shell: bash - env: - LICENSE: ${{ secrets.OCTOPUS_SERVER_BASE64_LICENSE }} - ECR_ACCESS_KEY: ${{ secrets.ECR_ACCESS_KEY }} - ECR_SECRET_KEY: ${{ secrets.ECR_SECRET_KEY }} - GIT_USERNAME: x-access-token - OCTODISABLEOCTOCONTAINERLOGGING: true - OCTOTESTSKIPINIT: true - GOMAXPROCS: 1 - OCTOTESTVERSION: 2023.2 - - name: Test everything else - run: gotestsum --junitfile results.xml -- -v -timeout 0 -skip "^\\QTestProjectWithGitUsernameExport\\E$" -json integration_test.go + run: gotestsum --junitfile node-summary.xml --format short-verbose -- -run "${{ steps.test_split.outputs.run }}" -timeout 0 integration_test.go shell: bash env: LICENSE: ${{ secrets.OCTOPUS_SERVER_BASE64_LICENSE }} @@ -85,14 +93,56 @@ jobs: OCTOTESTSKIPINIT: true GOMAXPROCS: 1 OCTOTESTVERSION: 2023.2 - - if: always() - name: Report + tests-combine-summaries: + name: Combine Test Reports + needs: [ tests ] + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version: 16 + + - name: Download artifacts + uses: actions/download-artifact@v3 + + - name: Install junit-report-merger + run: npm install -g junit-report-merger + + - name: Merge reports + run: > + jrm ./junit-test-summary.xml + "junit-test-summary-0/*.xml" + "junit-test-summary-1/*.xml" + "junit-test-summary-2/*.xml" + "junit-test-summary-3/*.xml" + "junit-test-summary-4/*.xml" + "junit-test-summary-5/*.xml" + "junit-test-summary-6/*.xml" + "junit-test-summary-7/*.xml" + "junit-test-summary-8/*.xml" + "junit-test-summary-9/*.xml" + "junit-test-summary-10/*.xml" + "junit-test-summary-11/*.xml" + "junit-test-summary-12/*.xml" + "junit-test-summary-13/*.xml" + "junit-test-summary-14/*.xml" + + - name: Upload test artifacts + uses: actions/upload-artifact@v3 + with: + name: junit-test-summary + path: ./junit-test-summary.xml + + - name: Report uses: dorny/test-reporter@v1 with: name: Go Tests - path: results.xml + path: junit-test-summary.xml reporter: java-junit - fail-on-error: 'false' + fail-on-error: 'true' permissions: id-token: write checks: write diff --git a/octopusdeploy/schema_cloud_region_deployment_target.go b/octopusdeploy/schema_cloud_region_deployment_target.go index 681117049..bce3dd18e 100644 --- a/octopusdeploy/schema_cloud_region_deployment_target.go +++ b/octopusdeploy/schema_cloud_region_deployment_target.go @@ -54,8 +54,6 @@ func getCloudRegionDeploymentTargetDataSchema() map[string]*schema.Schema { func getCloudRegionDeploymentTargetSchema() map[string]*schema.Schema { cloudRegionDeploymentTargetSchema := getDeploymentTargetSchema() - delete(cloudRegionDeploymentTargetSchema, "endpoint") - cloudRegionDeploymentTargetSchema["default_worker_pool_id"] = &schema.Schema{ Optional: true, Type: schema.TypeString,