-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Updates migration tests to run separately and use last released…
… version of provider for plan checks (#1565)
- Loading branch information
Showing
9 changed files
with
423 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
name: 'Migration Tests' | ||
|
||
on: | ||
workflow_dispatch: {} | ||
workflow_call: # workflow runs after code-health | ||
inputs: | ||
parent-event-name: | ||
required: true | ||
type: string | ||
pull_request: | ||
types: [ labeled ] | ||
|
||
jobs: | ||
set-output: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
condition: ${{ steps.set-condition.outputs.condition }} | ||
steps: | ||
- name: Set Event Condition | ||
id: set-condition | ||
run: | | ||
if [ "${{ github.event_name }}" = "push" ] || [ "${{ github.event_name }}" = "workflow_dispatch" ] || [ "${{ github.event_name }}" = "schedule" ] || [ "${{ inputs.parent-event-name }}" = "release" ] || [ "${{ github.event.label.name }}" = "run-testacc-migration" ]; then | ||
echo "::set-output name=condition::true" | ||
else | ||
echo "::set-output name=condition::false" | ||
fi | ||
change-detection: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: read | ||
repository-projects: read | ||
outputs: | ||
project: ${{ steps.filter.outputs.project }} | ||
config: ${{ steps.filter.outputs.config }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
if: ${{ needs.set-output.outputs.condition == 'true' }} | ||
- uses: dorny/paths-filter@v2 | ||
id: filter | ||
with: | ||
filters: | | ||
project: | ||
- 'mongodbatlas/fw_data_source_mongodbatlas_project_ip_access_list*.go' | ||
- 'mongodbatlas/fw_resource_mongodbatlas_project_ip_access_list*.go' | ||
config: | ||
- 'mongodbatlas/fw_data_source_mongodbatlas_alert_configuration*.go' | ||
- 'mongodbatlas/fw_data_source_mongodbatlas_database_user*.go' | ||
- 'mongodbatlas/fw_data_source_mongodbatlas_atlas_user*.go' | ||
- 'mongodbatlas/fw_resource_mongodbatlas_alert_configuration*.go' | ||
- 'mongodbatlas/fw_resource_mongodbatlas_database_user*.go' | ||
project: | ||
needs: [ change-detection ] | ||
if: ${{ needs.set-output.outputs.condition == 'true' || needs.change-detection.outputs.project == 'true' || github.event.label.name == 'run-testacc-project-migration'}} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Get Last Release | ||
id: get_last_release | ||
run: | | ||
LAST_RELEASE=$(curl -sSfL -X GET https://api.github.com/repos/mongodb/terraform-provider-mongodbatlas/releases/latest | jq -r '.tag_name | ltrimstr("v")') | ||
echo "Last release: $LAST_RELEASE" | ||
echo "MONGODB_ATLAS_LAST_VERSION=$LAST_RELEASE" >> $GITHUB_ENV | ||
shell: bash | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: 'go.mod' | ||
- name: Migration Tests | ||
env: | ||
MONGODB_ATLAS_PUBLIC_KEY: ${{ secrets.MONGODB_ATLAS_PUBLIC_KEY_CLOUD_DEV }} | ||
MONGODB_ATLAS_PRIVATE_KEY: ${{ secrets.MONGODB_ATLAS_PRIVATE_KEY_CLOUD_DEV }} | ||
MONGODB_ATLAS_ORG_ID: ${{ vars.MONGODB_ATLAS_ORG_ID_CLOUD_DEV }} | ||
MONGODB_ATLAS_BASE_URL: ${{ vars.MONGODB_ATLAS_BASE_URL }} | ||
MONGODB_ATLAS_PROJECT_OWNER_ID: ${{ vars.MONGODB_ATLAS_PROJECT_OWNER_ID }} | ||
MONGODB_ATLAS_API_KEYS_IDS: ${{ vars.MONGODB_ATLAS_API_KEYS_IDS }} | ||
MONGODB_ATLAS_TEAMS_IDS: ${{ vars.MONGODB_ATLAS_TEAMS_IDS }} | ||
SKIP_TEST_EXTERNAL_CREDENTIALS: ${{ vars.SKIP_TEST_EXTERNAL_CREDENTIALS }} | ||
ACCTEST_TIMEOUT: ${{ vars.ACCTEST_TIMEOUT }} | ||
TF_LOG: ${{ vars.LOG_LEVEL }} | ||
TF_ACC: 1 | ||
PARALLEL_GO_TEST: 20 | ||
CI: true | ||
TEST_REGEX: "^TestAccMigrationProject" | ||
run: make testacc | ||
|
||
config: | ||
needs: [ change-detection ] | ||
if: ${{ needs.set-output.outputs.condition == 'true' || needs.change-detection.outputs.config == 'true' || github.event.label.name == 'run-testacc-config-migration'}} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Get Last Release | ||
id: get_last_release | ||
run: | | ||
LAST_RELEASE=$(curl -sSfL -X GET https://api.github.com/repos/mongodb/terraform-provider-mongodbatlas/releases/latest | jq -r '.tag_name | ltrimstr("v")') | ||
echo "Last release: $LAST_RELEASE" | ||
echo "MONGODB_ATLAS_LAST_VERSION=$LAST_RELEASE" >> $GITHUB_ENV | ||
shell: bash | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: 'go.mod' | ||
- name: Migration Tests | ||
env: | ||
MONGODB_ATLAS_PUBLIC_KEY: ${{ secrets.MONGODB_ATLAS_PUBLIC_KEY_CLOUD_DEV_NETWORK }} | ||
MONGODB_ATLAS_PRIVATE_KEY: ${{ secrets.MONGODB_ATLAS_PRIVATE_KEY_CLOUD_DEV_NETWORK }} | ||
MONGODB_ATLAS_ORG_ID: ${{ vars.MONGODB_ATLAS_ORG_ID_CLOUD_DEV_NETWORK }} | ||
MONGODB_ATLAS_BASE_URL: ${{ vars.MONGODB_ATLAS_BASE_URL }} | ||
MONGODB_ATLAS_PROJECT_OWNER_ID: ${{ vars.MONGODB_ATLAS_PROJECT_OWNER_ID }} | ||
SKIP_TEST_EXTERNAL_CREDENTIALS: ${{ vars.SKIP_TEST_EXTERNAL_CREDENTIALS }} | ||
MONGODB_ATLAS_USERNAME_CLOUD_DEV: ${{ vars.MONGODB_ATLAS_USERNAME_CLOUD_DEV }} | ||
AZURE_ATLAS_APP_ID: ${{vars.AZURE_ATLAS_APP_ID}} | ||
AZURE_SERVICE_PRINCIPAL_ID: ${{vars.AZURE_SERVICE_PRINCIPAL_ID}} | ||
AZURE_TENANT_ID: ${{vars.AZURE_TENANT_ID}} | ||
ACCTEST_TIMEOUT: ${{ vars.ACCTEST_TIMEOUT }} | ||
TF_LOG: ${{ vars.LOG_LEVEL }} | ||
TF_ACC: 1 | ||
PARALLEL_GO_TEST: 20 | ||
CI: true | ||
TEST_REGEX: "^TestAccMigrationConfig" | ||
run: make testacc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.