Skip to content

Commit 866d5b0

Browse files
authored
feat: Runs Acceptance and Migration tests for different Terraform CLI versions (#1688)
* only Test Suite is scheduled * run acc and migration tests for different TF CLI versions * fix matrix values * update release instructions * remove permissions section
1 parent 2273d6b commit 866d5b0

File tree

5 files changed

+51
-26
lines changed

5 files changed

+51
-26
lines changed

.github/workflows/acceptance-tests.yml

+9-3
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,25 @@ on:
55
inputs:
66
terraform_version:
77
description: 'Terraform version to use, empty for latest'
8+
type: string
9+
required: false
10+
workflow_call: # workflow runs after Test Suite or code-health
11+
inputs:
12+
terraform_version:
13+
description: 'Terraform version to use, empty for latest'
14+
type: string
815
required: false
9-
workflow_call: # workflow runs after code-health
1016
pull_request: # you can run a specic job in your PR using GitHub labels
1117
types: [ labeled ]
12-
schedule:
13-
- cron: "0 4 * * *" # workflow runs every day at 04:00 AM
18+
1419
env:
1520
terraform_version: ${{ inputs.terraform_version || vars.TF_VERSION_LATEST }}
1621
# CI: true # GH does this automatically
1722
TF_ACC: 1
1823
SKIP_TEST_EXTERNAL_CREDENTIALS: true
1924
TF_LOG: ${{ vars.LOG_LEVEL }}
2025
ACCTEST_TIMEOUT: ${{ vars.ACCTEST_TIMEOUT }}
26+
2127
jobs:
2228
change-detection:
2329
runs-on: ubuntu-latest

.github/workflows/code-health.yml

-8
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,9 @@ jobs:
9191
call-acceptance-tests-workflow:
9292
needs: [build, lint, shellcheck, unit-test, website-lint]
9393
secrets: inherit
94-
permissions:
95-
contents: write
96-
pull-requests: read
97-
repository-projects: read
9894
uses: ./.github/workflows/acceptance-tests.yml
9995
call-migration-tests-workflow:
10096
needs: [build, lint, shellcheck, unit-test, website-lint]
10197
secrets: inherit
102-
permissions:
103-
contents: write
104-
pull-requests: read
105-
repository-projects: read
10698
uses: ./.github/workflows/migration-tests.yml
10799

.github/workflows/migration-tests.yml

+10-4
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,25 @@ on:
55
inputs:
66
terraform_version:
77
description: 'Terraform version to use, empty for latest'
8+
type: string
89
required: false
9-
workflow_call: # workflow runs after code-health
10-
pull_request:
10+
workflow_call: # workflow runs after Test Suite or code-health
11+
inputs:
12+
terraform_version:
13+
description: 'Terraform version to use, empty for latest'
14+
type: string
15+
required: false
16+
pull_request: # you can run a specic job in your PR using GitHub labels
1117
types: [ labeled ]
12-
schedule:
13-
- cron: "0 4 * * *" # workflow runs every day at 04:00 AM
18+
1419
env:
1520
terraform_version: ${{ inputs.terraform_version || vars.TF_VERSION_LATEST }}
1621
# CI: true # GH does this automatically
1722
TF_ACC: 1
1823
SKIP_TEST_EXTERNAL_CREDENTIALS: true
1924
TF_LOG: ${{ vars.LOG_LEVEL }}
2025
ACCTEST_TIMEOUT: ${{ vars.ACCTEST_TIMEOUT }}
26+
2127
jobs:
2228
change-detection:
2329
runs-on: ubuntu-latest

.github/workflows/test-suite.yml

+31-10
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,35 @@ name: 'Test Suite'
22

33
on:
44
workflow_dispatch:
5+
schedule:
6+
- cron: "0 2 * * *" # workflow runs every day at 02:00 AM
7+
8+
jobs:
9+
acc-tests:
10+
strategy:
11+
max-parallel: 1
12+
fail-fast: false
13+
matrix:
14+
terraform_version: ['${{ vars.TF_VERSION_LATEST }}', '1.0.8']
15+
name: acc-tests-${{ matrix.terraform_version }}
16+
secrets: inherit
17+
permissions:
18+
contents: write
19+
pull-requests: read
20+
repository-projects: read
21+
uses: ./.github/workflows/acceptance-tests.yml
22+
with:
23+
terraform_version: ${{ matrix.terraform_version }}
524

6-
jobs:
7-
example:
8-
runs-on: ubuntu-latest
9-
steps:
10-
- name: Checkout
11-
uses: actions/checkout@v4
12-
- name: Set up Go
13-
uses: actions/setup-go@v4
14-
with:
15-
go-version-file: 'go.mod'
25+
migration-tests:
26+
needs: acc-tests
27+
strategy:
28+
max-parallel: 1
29+
fail-fast: false
30+
matrix:
31+
terraform_version: ['${{ vars.TF_VERSION_LATEST }}', '1.0.8']
32+
name: migration-tests-${{ matrix.terraform_version }}
33+
secrets: inherit
34+
uses: ./.github/workflows/migration-tests.yml
35+
with:
36+
terraform_version: ${{ matrix.terraform_version }}

RELEASING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
## Steps
88

99
### Make sure that the acceptance tests are successful
10-
Check [workflows/acceptance-tests.yml](https://github.com/mongodb/terraform-provider-mongodbatlas/actions/workflows/acceptance-tests.yml) and see if the latest run of the Acceptance Test action is successful (it runs every day at 4 AM Dublin Time). If tests are failing, you should investigate the failure before proceeding with the next steps.
10+
Check [workflows/test-suite.yml](https://github.com/mongodb/terraform-provider-mongodbatlas/actions/workflows/test-suite.yml) and see if the latest run of the Test Suite action is successful (it runs every day at 2 AM Dublin Time). If tests are failing, you should investigate the failure before proceeding with the next steps.
1111

1212
### Pre-release the provider
1313
We pre-release the provider to make for testing purpose. **A Pre-release is not published to the Hashicorp Terraform Registry**.

0 commit comments

Comments
 (0)