Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into CLOUDP-242972
Browse files Browse the repository at this point in the history
  • Loading branch information
AgustinBettati committed Apr 17, 2024
2 parents 8dcec0c + 4580a37 commit 00ec82d
Show file tree
Hide file tree
Showing 15 changed files with 137 additions and 724 deletions.
77 changes: 58 additions & 19 deletions .github/workflows/acceptance-tests-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
description: 'Terraform version to use, e.g. 1.6.x, empty for latest'
type: string
required: true
provider_version:
description: 'Previous MongoDB Atlas Provider version to use in Migration tests, e.g. 1.14.0, empty for latest'
type: string
required: false
test_group:
description: 'Test group to run, e.g. advanced_cluster, empty for all'
type: string
Expand Down Expand Up @@ -103,13 +107,30 @@ env:
TF_ACC: 1
TF_LOG: ${{ vars.LOG_LEVEL }}
ACCTEST_TIMEOUT: ${{ vars.ACCTEST_TIMEOUT }}
ACCTEST_REGEX_RUN: "^TestAcc"
# Only Migration tests are run when testing a specific previous provider version instead of the latest one
ACCTEST_REGEX_RUN: ${{ inputs.provider_version == '' && '^Test(Acc|Mig)' || '^TestMig' }}
MONGODB_ATLAS_BASE_URL: ${{ inputs.mongodb_atlas_base_url }}
MONGODB_ATLAS_ORG_ID: ${{ inputs.mongodb_atlas_org_id }}
MONGODB_ATLAS_PUBLIC_KEY: ${{ secrets.mongodb_atlas_public_key }}
MONGODB_ATLAS_PRIVATE_KEY: ${{ secrets.mongodb_atlas_private_key }}

jobs:

get-provider-version:
runs-on: ubuntu-latest
outputs:
provider_version: ${{ inputs.provider_version || steps.get_last_release.outputs.last_provider_version }}
steps:
- name: Checkout
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
- name: Get Last Release
id: get_last_release
shell: bash
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 "last_provider_version=${LAST_RELEASE}" >> "${GITHUB_OUTPUT}"
change-detection:
runs-on: ubuntu-latest
env:
Expand Down Expand Up @@ -215,7 +236,7 @@ jobs:
- 'internal/service/encryptionatrest/*.go'
cluster_outage_simulation:
needs: [ change-detection ]
needs: [ change-detection, get-provider-version ]
if: ${{ needs.change-detection.outputs.cluster_outage_simulation == 'true' || inputs.test_group == 'cluster_outage_simulation' }}
runs-on: ubuntu-latest
steps:
Expand All @@ -231,11 +252,12 @@ jobs:
terraform_wrapper: false
- name: Acceptance Tests
env:
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
ACCTEST_PACKAGES: ./internal/service/clusteroutagesimulation
run: make testacc

advanced_cluster:
needs: [ change-detection ]
needs: [ change-detection, get-provider-version ]
if: ${{ needs.change-detection.outputs.advanced_cluster == 'true' || inputs.test_group == 'advanced_cluster' }}
runs-on: ubuntu-latest
steps:
Expand All @@ -251,11 +273,12 @@ jobs:
terraform_wrapper: false
- name: Acceptance Tests
env:
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
ACCTEST_PACKAGES: ./internal/service/advancedcluster
run: make testacc

cluster:
needs: [ change-detection ]
needs: [ change-detection, get-provider-version ]
if: ${{ needs.change-detection.outputs.cluster == 'true' || inputs.test_group == 'cluster' }}
runs-on: ubuntu-latest
steps:
Expand All @@ -271,13 +294,14 @@ jobs:
terraform_wrapper: false
- name: Acceptance Tests
env:
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
ACCTEST_PACKAGES: |
./internal/service/cluster
./internal/service/globalclusterconfig
run: make testacc

search_deployment:
needs: [ change-detection ]
needs: [ change-detection, get-provider-version ]
if: ${{ needs.change-detection.outputs.search_deployment == 'true' || inputs.test_group == 'search_deployment' }}
runs-on: ubuntu-latest
steps:
Expand All @@ -293,11 +317,12 @@ jobs:
terraform_wrapper: false
- name: Acceptance Tests
env:
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
ACCTEST_PACKAGES: ./internal/service/searchdeployment
run: make testacc

stream:
needs: [ change-detection ]
needs: [ change-detection, get-provider-version ]
if: ${{ needs.change-detection.outputs.stream == 'true' || inputs.test_group == 'stream' }}
runs-on: ubuntu-latest
steps:
Expand All @@ -314,13 +339,14 @@ jobs:
- name: Acceptance Tests
env:
MONGODB_ATLAS_ENABLE_PREVIEW: "true"
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
ACCTEST_PACKAGES: |
./internal/service/streaminstance
./internal/service/streamconnection
run: make testacc

generic: # Acceptance tests that do not use any time-consuming resource (example: cluster)
needs: [ change-detection ]
needs: [ change-detection, get-provider-version ]
if: ${{ needs.change-detection.outputs.generic == 'true' || inputs.test_group == 'generic' }}
runs-on: ubuntu-latest
steps:
Expand All @@ -338,13 +364,14 @@ jobs:
env:
MONGODB_ATLAS_PROJECT_OWNER_ID: ${{ inputs.mongodb_atlas_project_owner_id }}
CA_CERT: ${{ secrets.ca_cert }}
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
ACCTEST_PACKAGES: |
./internal/service/backupcompliancepolicy
./internal/service/auditing
./internal/service/x509authenticationdatabaseuser
run: make testacc
backup:
needs: [ change-detection ]
needs: [ change-detection, get-provider-version ]
if: ${{ needs.change-detection.outputs.backup == 'true' || inputs.test_group == 'backup' }}
runs-on: ubuntu-latest
steps:
Expand All @@ -361,6 +388,7 @@ jobs:
- name: Acceptance Tests
env:
MONGODB_ATLAS_PROJECT_OWNER_ID: ${{ inputs.mongodb_atlas_project_owner_id }}
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
ACCTEST_PACKAGES: |
./internal/service/onlinearchive
./internal/service/cloudbackupschedule
Expand All @@ -370,7 +398,7 @@ jobs:
./internal/service/cloudbackupsnapshotrestorejob
run: make testacc
project:
needs: [ change-detection ]
needs: [ change-detection, get-provider-version ]
if: ${{ needs.change-detection.outputs.project == 'true' || inputs.test_group == 'project' }}
runs-on: ubuntu-latest
steps:
Expand All @@ -396,14 +424,15 @@ jobs:
AWS_SECURITY_GROUP_2: ${{ vars.AWS_SECURITY_GROUP_2 }}
AWS_VPC_CIDR_BLOCK: ${{ vars.AWS_VPC_CIDR_BLOCK }}
AWS_VPC_ID: ${{ vars.AWS_VPC_ID }}
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
ACCTEST_PACKAGES: |
./internal/service/project
./internal/service/projectipaccesslist
./internal/service/accesslistapikey
./internal/service/projectinvitation
run: make testacc
serverless:
needs: [ change-detection ]
needs: [ change-detection, get-provider-version ]
if: ${{ needs.change-detection.outputs.serverless == 'true' || inputs.test_group == 'serverless' }}
runs-on: ubuntu-latest
steps:
Expand All @@ -421,13 +450,14 @@ jobs:
env:
AWS_ACCESS_KEY_ID: ${{ secrets.aws_access_key_id }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_access_key }}
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
ACCTEST_PACKAGES: |
./internal/service/serverlessinstance
./internal/service/privatelinkendpointserverless
./internal/service/privatelinkendpointserviceserverless
run: make testacc
network:
needs: [ change-detection ]
needs: [ change-detection, get-provider-version ]
if: ${{ needs.change-detection.outputs.network == 'true' || inputs.test_group == 'network' }}
runs-on: ubuntu-latest
steps:
Expand All @@ -453,6 +483,7 @@ jobs:
AWS_SECURITY_GROUP_2: ${{ vars.AWS_SECURITY_GROUP_2 }}
AWS_VPC_CIDR_BLOCK: ${{ vars.AWS_VPC_CIDR_BLOCK }}
AWS_VPC_ID: ${{ vars.AWS_VPC_ID }}
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
ACCTEST_PACKAGES: |
./internal/service/networkcontainer
./internal/service/networkpeering
Expand All @@ -462,7 +493,7 @@ jobs:
./internal/service/privatelinkendpointservicedatafederationonlinearchive
run: make testacc
config:
needs: [ change-detection ]
needs: [ change-detection, get-provider-version ]
if: ${{ needs.change-detection.outputs.config == 'true' || inputs.test_group == 'config' }}
runs-on: ubuntu-latest
steps:
Expand All @@ -486,6 +517,7 @@ jobs:
AWS_REGION: ${{ vars.AWS_REGION_LOWERCASE }}
AWS_ACCESS_KEY_ID: ${{ secrets.aws_access_key_id }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_access_key }}
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
ACCTEST_PACKAGES: |
./internal/service/alertconfiguration
./internal/service/atlasuser
Expand All @@ -504,7 +536,7 @@ jobs:
run: make testacc

assume_role:
needs: [ change-detection]
needs: [ change-detection, get-provider-version ]
if: ${{ needs.change-detection.outputs.assume_role == 'true' || inputs.test_group == 'assume_role' }}
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -538,11 +570,12 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ steps.sts-assume-role.outputs.aws_access_key_id }}
AWS_SECRET_ACCESS_KEY: ${{ steps.sts-assume-role.outputs.aws_secret_access_key }}
AWS_SESSION_TOKEN: ${{ steps.sts-assume-role.outputs.AWS_SESSION_TOKEN }}
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
ACCTEST_PACKAGES: ./internal/provider
run: make testacc

search_index:
needs: [ change-detection ]
needs: [ change-detection, get-provider-version ]
if: ${{ needs.change-detection.outputs.search_index == 'true' || inputs.test_group == 'search_index' }}
runs-on: ubuntu-latest
steps:
Expand All @@ -558,11 +591,12 @@ jobs:
terraform_wrapper: false
- name: Acceptance Tests
env:
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
ACCTEST_PACKAGES: ./internal/service/searchindex
run: make testacc

federated:
needs: [ change-detection ]
needs: [ change-detection, get-provider-version ]
if: ${{ needs.change-detection.outputs.federated == 'true' || inputs.test_group == 'federated' }}
runs-on: ubuntu-latest
steps:
Expand All @@ -589,6 +623,7 @@ jobs:
AWS_REGION: ${{ vars.aws_region_federation }}
AWS_ACCESS_KEY_ID: ${{ secrets.aws_access_key_id }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_access_key }}
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
ACCTEST_PACKAGES: |
./internal/service/federatedsettingsidentityprovider
./internal/service/federateddatabaseinstance
Expand All @@ -597,7 +632,7 @@ jobs:
./internal/service/federatedquerylimit
run: make testacc
data_lake:
needs: [ change-detection ]
needs: [ change-detection, get-provider-version ]
if: ${{ needs.change-detection.outputs.data_lake == 'true' || inputs.test_group == 'data_lake' }}
runs-on: ubuntu-latest
steps:
Expand All @@ -613,10 +648,11 @@ jobs:
terraform_wrapper: false
- name: Acceptance Tests
env:
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
ACCTEST_PACKAGES: ./internal/service/datalakepipeline
run: make testacc
ldap:
needs: [ change-detection ]
needs: [ change-detection, get-provider-version ]
if: ${{ needs.change-detection.outputs.ldap == 'true' || inputs.test_group == 'ldap' }}
runs-on: ubuntu-latest
steps:
Expand All @@ -637,12 +673,13 @@ jobs:
MONGODB_ATLAS_LDAP_PASSWORD: ${{ secrets.mongodb_atlas_ldap_password }}
MONGODB_ATLAS_LDAP_PORT: ${{ secrets.mongodb_atlas_ldap_port }}
MONGODB_ATLAS_LDAP_CA_CERTIFICATE: ${{ secrets.mongodb_atlas_ldap_ca_certificate }}
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
ACCTEST_PACKAGES: |
./internal/service/ldapconfiguration
./internal/service/ldapverify
run: make testacc
encryption:
needs: [ change-detection ]
needs: [ change-detection, get-provider-version ]
if: ${{ needs.change-detection.outputs.encryption == 'true' || inputs.test_group == 'encryption' }}
runs-on: ubuntu-latest
steps:
Expand All @@ -658,10 +695,11 @@ jobs:
terraform_wrapper: false
- name: Acceptance Tests
env:
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
ACCTEST_PACKAGES: ./internal/service/encryptionatrest
run: make testacc
event_trigger:
needs: [ change-detection ]
needs: [ change-detection, get-provider-version ]
if: ${{ needs.change-detection.outputs.event_trigger == 'true' || inputs.test_group == 'event_trigger' }}
runs-on: ubuntu-latest
steps:
Expand All @@ -677,5 +715,6 @@ jobs:
terraform_wrapper: false
- name: Acceptance Tests
env:
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
ACCTEST_PACKAGES: ./internal/service/eventtrigger
run: make testacc
22 changes: 15 additions & 7 deletions .github/workflows/acceptance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
description: 'Terraform version to use, e.g. 1.6.x, empty for latest'
type: string
required: false
provider_version:
description: 'Previous MongoDB Atlas Provider version to use in Migration tests, e.g. 1.14.0, empty for latest'
type: string
required: false
atlas_cloud_env:
description: 'Atlas cloud environment used, can be either `dev` or `qa`, empty for `dev`'
type: string
Expand All @@ -27,19 +31,22 @@ on:
description: 'Terraform version to use, e.g. 1.6.x, empty for latest'
type: string
required: false
ref:
description: 'The branch, tag or SHA where tests will run, e.g. v1.14.0, empty for default branch'
provider_version:
description: 'Previous MongoDB Atlas Provider version to use in Migration tests, e.g. 1.14.0, empty for latest'
type: string
required: false
required: false
atlas_cloud_env:
description: 'Atlas cloud environment used, can be either `dev` or `qa`, empty for `dev`'
type: string
required: false


ref:
description: 'The branch, tag or SHA where tests will run, e.g. v1.14.0, empty for default branch'
type: string
required: false

jobs:
acc-tests:
name: acc-tests-${{ inputs.terraform_version || 'latest' }}-${{ inputs.atlas_cloud_env || 'dev' }}
tests:
name: tests-${{ inputs.terraform_version || 'latest' }}-${{ inputs.provider_version || 'latest' }}-${{ inputs.atlas_cloud_env || 'dev' }}
uses: ./.github/workflows/acceptance-tests-runner.yml
secrets:
mongodb_atlas_public_key: ${{ inputs.atlas_cloud_env == 'qa' && secrets.MONGODB_ATLAS_PUBLIC_KEY_CLOUD_QA || secrets.MONGODB_ATLAS_PUBLIC_KEY_CLOUD_DEV }}
Expand All @@ -59,6 +66,7 @@ jobs:

with:
terraform_version: ${{ inputs.terraform_version || vars.TF_VERSION_LATEST }}
provider_version: ${{ inputs.provider_version }}
ref: ${{ inputs.ref }}
test_group: ${{ inputs.test_group }}
aws_region_federation: ${{ vars.AWS_REGION_FEDERATION }}
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/code-health.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,3 @@ jobs:
needs: [build, lint, shellcheck, unit-test, website-lint]
secrets: inherit
uses: ./.github/workflows/acceptance-tests.yml
call-migration-tests-workflow:
needs: [build, lint, shellcheck, unit-test, website-lint]
secrets: inherit
uses: ./.github/workflows/migration-tests.yml

Loading

0 comments on commit 00ec82d

Please sign in to comment.