Skip to content

Commit 2024dfd

Browse files
committed
Merge branch 'master' into CLOUDP-352095_sa_mig_tests
* master: chore: Invoke Delete operation if timeout in autogen (#3820) Add support for typed nested sets in autogen (#3819) chore: Use timeouts attributes in autogen resources (#3817) refactor: Adds invalid update error for delete_on_create_timeout for sdkv2 (#3810) Add support for typed lists in autogen (#3816) refactor: Uses delete_on_create_timeout with default=true support across TPF resources (#3809) Rename customtype package to customtypes (#3814) chore: Add support for typed nested lists in autogen (#3813) don't schedule matrix until CLOUDP-353513 (#3812) chore: Fix stream tests notifications (#3805) chore: Bump golang.org/x/oauth2 from 0.31.0 to 0.32.0 (#3803) depends on data sources (#3808) test: Avoids flaky test by simplifying the check, ensuring count > 0 instead of reading API response and trying exact match (#3806) chore: Generate timeouts attribute for autogen resources (#3802) # Conflicts: # .github/workflows/acceptance-tests-runner.yml
2 parents c2f065f + 971e21b commit 2024dfd

File tree

100 files changed

+3470
-1462
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+3470
-1462
lines changed

.github/workflows/acceptance-tests-runner.yml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,33 @@ on:
1212
provider_version:
1313
description: 'Previous MongoDB Atlas Provider version to use in Migration tests, e.g. 1.14.0, empty for latest'
1414
type: string
15-
required: false
15+
required: true
1616
test_group:
1717
description: 'Test group to run, e.g. advanced_cluster, empty for all'
1818
type: string
19-
required: false
19+
required: true
2020
test_name:
2121
description: 'Name of the test to run, e.g. TestAccNetworkRSNetworkPeering_basicAzure, empty for all (this is regex & requires Test group to be specified as well)'
2222
type: string
23-
required: false
23+
required: true
2424
ref:
2525
description: 'The branch, tag or SHA where tests will run, e.g. v1.14.0, empty for default branch'
2626
type: string
27-
required: false
27+
required: true
28+
# Boolean inputs are passed as null between workflows when false. For comparisons use my_input == true or my_input != true.
29+
# Don't use my_input or my_input == false.
2830
reduced_tests:
2931
description: 'If run only minimum tests for advanced_cluster, e.g. in PRs'
3032
type: boolean
31-
required: false
32-
default: false
33+
required: true
3334
use_sa:
3435
description: "Run tests using Service Account instead of API Keys"
3536
type: boolean
36-
required: false
37+
required: true
3738
send_notification:
3839
description: 'Send a Slack notification if stream tests fail.'
3940
type: boolean
40-
required: false
41+
required: true
4142
mongodb_atlas_org_id:
4243
type: string
4344
required: true
@@ -213,15 +214,14 @@ env:
213214
# If the name (regex) of the test is set, only that test is run.
214215
# Only Migration tests are run when a specific previous provider version is set.
215216
# Don't run migration tests if using Service Account because each migration test creates a new SA token in the test first step.
216-
# The previous provider runs externally (equivalent to running a Terraform command), causing token creation limit issues.
217-
ACCTEST_REGEX_RUN: ${{ inputs.test_name || inputs.use_sa && '^TestAcc' || inputs.provider_version == '' && '^Test(Acc|Mig)' || '^TestMig' }}
217+
# The previous provider runs externally (equivalent to running a Terraform command), causing token creation limit issues. ACCTEST_REGEX_RUN: ${{ inputs.test_name || inputs.use_sa == true && '^TestAcc' || inputs.provider_version == '' && '^Test(Acc|Mig)' || '^TestMig' }}
218218
MONGODB_ATLAS_BASE_URL: ${{ inputs.mongodb_atlas_base_url }}
219219
MONGODB_REALM_BASE_URL: ${{ inputs.mongodb_realm_base_url }}
220220
MONGODB_ATLAS_ORG_ID: ${{ inputs.mongodb_atlas_org_id }}
221-
MONGODB_ATLAS_PUBLIC_KEY: ${{ inputs.use_sa == false && secrets.mongodb_atlas_public_key || '' }}
222-
MONGODB_ATLAS_PRIVATE_KEY: ${{ inputs.use_sa == false && secrets.mongodb_atlas_private_key || '' }}
223-
MONGODB_ATLAS_CLIENT_ID: ${{ inputs.use_sa && secrets.mongodb_atlas_client_id || '' }}
224-
MONGODB_ATLAS_CLIENT_SECRET: ${{ inputs.use_sa && secrets.mongodb_atlas_client_secret || '' }}
221+
MONGODB_ATLAS_PUBLIC_KEY: ${{ inputs.use_sa != true && secrets.mongodb_atlas_public_key || '' }}
222+
MONGODB_ATLAS_PRIVATE_KEY: ${{ inputs.use_sa != true && secrets.mongodb_atlas_private_key || '' }}
223+
MONGODB_ATLAS_CLIENT_ID: ${{ inputs.use_sa == true && secrets.mongodb_atlas_client_id || '' }}
224+
MONGODB_ATLAS_CLIENT_SECRET: ${{ inputs.use_sa == true && secrets.mongodb_atlas_client_secret || '' }}
225225
MONGODB_ATLAS_PUBLIC_KEY_READ_ONLY: ${{ secrets.mongodb_atlas_public_key_read_only }}
226226
MONGODB_ATLAS_PRIVATE_KEY_READ_ONLY: ${{ secrets.mongodb_atlas_private_key_read_only }}
227227
MONGODB_ATLAS_GOV_PUBLIC_KEY: ${{ secrets.mongodb_atlas_gov_public_key }}
@@ -422,14 +422,14 @@ jobs:
422422
env:
423423
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
424424
HTTP_MOCKER_CAPTURE: 'true'
425-
ACCTEST_REGEX_RUN: ${{ inputs.reduced_tests && '^TestAccMockable' || env.ACCTEST_REGEX_RUN }}
425+
ACCTEST_REGEX_RUN: ${{ inputs.reduced_tests == true && '^TestAccMockable' || env.ACCTEST_REGEX_RUN }}
426426
ACCTEST_PACKAGES: ./internal/service/advancedcluster
427427
run: make testacc
428428

429429
advanced_cluster_tpf_mig_from_sdkv2:
430430
needs: [ change-detection, get-provider-version ]
431431
# advanced_cluster v1.x versions don't support SA.
432-
if: ${{ inputs.reduced_tests == false && inputs.use_sa == false && (needs.change-detection.outputs.advanced_cluster == 'true' || inputs.test_group == 'advanced_cluster') }}
432+
if: ${{ inputs.reduced_tests != true && inputs.use_sa != true && (needs.change-detection.outputs.advanced_cluster == 'true' || inputs.test_group == 'advanced_cluster') }}
433433
runs-on: ubuntu-latest
434434
permissions: {}
435435
steps:
@@ -455,7 +455,7 @@ jobs:
455455
advanced_cluster_tpf_mig_from_tpf_preview:
456456
needs: [ change-detection, get-provider-version ]
457457
# advanced_cluster v1.x versions don't support SA.
458-
if: ${{ inputs.reduced_tests == false && inputs.use_sa == false && (needs.change-detection.outputs.advanced_cluster == 'true' || inputs.test_group == 'advanced_cluster') }}
458+
if: ${{ inputs.reduced_tests != true && inputs.use_sa != true && (needs.change-detection.outputs.advanced_cluster == 'true' || inputs.test_group == 'advanced_cluster') }}
459459
runs-on: ubuntu-latest
460460
permissions: {}
461461
steps:
@@ -891,7 +891,7 @@ jobs:
891891
event_trigger:
892892
needs: [change-detection, get-provider-version]
893893
# Realm SDK doesn't support SA.
894-
if: ${{ inputs.use_sa == false && (needs.change-detection.outputs.event_trigger == 'true' || inputs.test_group == 'event_trigger') }}
894+
if: ${{ inputs.use_sa != true && (needs.change-detection.outputs.event_trigger == 'true' || inputs.test_group == 'event_trigger') }}
895895
runs-on: ubuntu-latest
896896
permissions: {}
897897
steps:
@@ -1200,10 +1200,10 @@ jobs:
12001200
terraform_wrapper: false
12011201
- name: Acceptance Tests
12021202
env:
1203-
MONGODB_ATLAS_PUBLIC_KEY: ${{ inputs.use_sa == false && secrets.mongodb_atlas_rp_public_key || '' }}
1204-
MONGODB_ATLAS_PRIVATE_KEY: ${{ inputs.use_sa == false && secrets.mongodb_atlas_rp_private_key || '' }}
1205-
MONGODB_ATLAS_CLIENT_ID: ${{ inputs.use_sa && secrets.mongodb_atlas_rp_client_id || '' }}
1206-
MONGODB_ATLAS_CLIENT_SECRET: ${{ inputs.use_sa && secrets.mongodb_atlas_rp_client_secret || '' }}
1203+
MONGODB_ATLAS_PUBLIC_KEY: ${{ inputs.use_sa != true && secrets.mongodb_atlas_rp_public_key || '' }}
1204+
MONGODB_ATLAS_PRIVATE_KEY: ${{ inputs.use_sa != true && secrets.mongodb_atlas_rp_private_key || '' }}
1205+
MONGODB_ATLAS_CLIENT_ID: ${{ inputs.use_sa == true && secrets.mongodb_atlas_rp_client_id || '' }}
1206+
MONGODB_ATLAS_CLIENT_SECRET: ${{ inputs.use_sa == true && secrets.mongodb_atlas_rp_client_secret || '' }}
12071207
MONGODB_ATLAS_ORG_ID: ${{ inputs.mongodb_atlas_rp_org_id }}
12081208
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
12091209
ACCTEST_PACKAGES: ./internal/service/resourcepolicy
@@ -1318,7 +1318,7 @@ jobs:
13181318

13191319
slack-notification-stream:
13201320
needs: [stream]
1321-
if: ${{ !cancelled() && needs.stream.result == 'failure' && !contains(github.event.inputs.send_notification, 'false') }}
1321+
if: ${{ !cancelled() && needs.stream.result == 'failure' && inputs.send_notification == true }}
13221322
runs-on: ubuntu-latest
13231323
permissions: {}
13241324
steps:

.github/workflows/acceptance-tests.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'Acceptance Tests'
2-
run-name: "Acceptance Tests ${{ inputs.atlas_cloud_env }} ${{ inputs.test_group }} ${{ inputs.use_sa && 'sa' || 'pak'}}"
2+
run-name: "Acceptance Tests ${{ inputs.atlas_cloud_env }} ${{ inputs.test_group }} ${{ inputs.use_sa == true && 'sa' || 'pak'}}"
33

44
# Used for running acceptance tests, either triggered manually or called by other workflows.
55
on:
@@ -28,7 +28,7 @@ on:
2828
ref:
2929
description: 'The branch, tag or SHA where tests will run, e.g. v1.14.0, empty for default branch'
3030
type: string
31-
required: false
31+
required: false
3232
use_sa:
3333
description: "Run tests using Service Account instead of API Keys"
3434
type: boolean
@@ -122,13 +122,12 @@ jobs:
122122
with:
123123
terraform_version: ${{ inputs.terraform_version || '1.13.x' }}
124124
provider_version: ${{ inputs.provider_version }}
125-
ref: ${{ inputs.ref }}
126125
test_group: ${{ inputs.test_group }}
127126
test_name: ${{ inputs.test_name }}
128-
reduced_tests: ${{ inputs.reduced_tests || false }}
129-
use_sa: ${{ inputs.use_sa || false }}
130-
send_notification: ${{ !contains(github.event.inputs.send_notification, 'false') }}
131-
aws_region_federation: ${{ vars.AWS_REGION_FEDERATION }}
127+
ref: ${{ inputs.ref }}
128+
reduced_tests: ${{ inputs.reduced_tests == true }}
129+
use_sa: ${{ inputs.use_sa == true }}
130+
send_notification: ${{ inputs.send_notification == true }}
132131
mongodb_atlas_org_id: ${{ inputs.atlas_cloud_env == 'qa' && vars.MONGODB_ATLAS_ORG_ID_CLOUD_QA || vars.MONGODB_ATLAS_ORG_ID_CLOUD_DEV }}
133132
mongodb_atlas_base_url: ${{ inputs.atlas_cloud_env == 'qa' && vars.MONGODB_ATLAS_BASE_URL_QA || vars.MONGODB_ATLAS_BASE_URL }}
134133
mongodb_realm_base_url: ${{ inputs.atlas_cloud_env == 'qa' && vars.MONGODB_REALM_BASE_URL_QA || vars.MONGODB_REALM_BASE_URL }}
@@ -139,6 +138,7 @@ jobs:
139138
azure_service_principal_id: ${{ inputs.atlas_cloud_env == 'qa' && vars.AZURE_SERVICE_PRINCIPAL_ID_QA || vars.AZURE_SERVICE_PRINCIPAL_ID }}
140139
azure_tenant_id: ${{ vars.AZURE_TENANT_ID }}
141140
aws_secret_name: ${{ inputs.atlas_cloud_env == 'qa' && vars.AWS_SECRET_NAME_QA || vars.AWS_SECRET_NAME }}
141+
aws_region_federation: ${{ vars.AWS_REGION_FEDERATION }}
142142
mongodb_atlas_federation_settings_id: ${{ inputs.atlas_cloud_env == 'qa' && vars.MONGODB_ATLAS_FEDERATION_SETTINGS_ID_QA || vars.MONGODB_ATLAS_FEDERATION_SETTINGS_ID }}
143143
mongodb_atlas_federated_okta_idp_id: ${{ inputs.atlas_cloud_env == 'qa' && vars.MONGODB_ATLAS_FEDERATED_OKTA_IDP_ID_QA || vars.MONGODB_ATLAS_FEDERATED_OKTA_IDP_ID }}
144144
mongodb_atlas_federated_idp_id: ${{ inputs.atlas_cloud_env == 'qa' && vars.MONGODB_ATLAS_FEDERATED_IDP_ID_QA || vars.MONGODB_ATLAS_FEDERATED_IDP_ID }}

.github/workflows/code-health.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,5 +93,3 @@ jobs:
9393
uses: ./.github/workflows/acceptance-tests.yml
9494
with:
9595
reduced_tests: true
96-
use_sa: false
97-
send_notification: false

.github/workflows/release.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,6 @@ jobs:
125125
with:
126126
atlas_cloud_env: "qa"
127127
ref: ${{ inputs.version_number }}
128-
use_sa: false
129-
send_notification: false
130128

131129
release:
132130
runs-on: ubuntu-latest

.github/workflows/terraform-compatibility-matrix.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ name: "HashiCorp Terraform Compatibility Matrix"
22
run-name: 'HashiCorp Terraform Compatibility Matrix ${{ inputs.atlas_cloud_env }}'
33

44
on:
5-
schedule:
6-
- cron: "0 0 1 * *" # runs first day of the month at midnight UTC
5+
# Will be spread in multiple days in CLOUDP-353513, don't schedule at the moment.
6+
# schedule:
7+
# - cron: "0 0 1 * *" # runs first day of the month at midnight UTC
78
workflow_dispatch:
89
inputs:
910
atlas_cloud_env:

.github/workflows/test-suite.yml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name: 'Test Suite'
77
# - Tuesday, Thursday, Saturday: SA against Dev environment
88
# Note: PAK refers to Programmatic API Key authentication (use_sa: false), SA refers to Service Account authentication (use_sa: true)
99
# It can also be run manually.
10-
# The 1st day of the month we run terraform-compatibility-matrix.yml and therefore, we skip the test-suite (see schedule->cron below).
10+
# Pending change in CLOUDP-353513: The 1st day of the month we run terraform-compatibility-matrix.yml and therefore, we skip the test-suite (see schedule->cron below).
1111
on:
1212
workflow_dispatch:
1313
inputs:
@@ -24,7 +24,7 @@ on:
2424
use_sa:
2525
description: "Run tests using Service Account instead of API Keys"
2626
type: boolean
27-
required: false
27+
default: false
2828
workflow_call:
2929
inputs:
3030
terraform_matrix:
@@ -41,7 +41,11 @@ on:
4141
send_notification:
4242
description: 'Send the Slack notification if any of the tests fail.'
4343
type: boolean
44-
default: true
44+
default: false
45+
use_sa:
46+
description: "Run tests using Service Account instead of API Keys"
47+
type: boolean
48+
default: false
4549
schedule:
4650
- cron: "0 0 2-31 * *" # workflow runs every day at midnight UTC except on the first day of the month
4751

@@ -59,7 +63,8 @@ jobs:
5963
terraform_matrix: ${{ inputs.terraform_matrix || env.schedule_terraform_matrix }}
6064
provider_matrix: ${{ inputs.provider_matrix || env.schedule_provider_matrix }}
6165
is_sun: ${{ steps.set_day.outputs.DAY == 'Sun' }}
62-
use_sa: ${{ (inputs.use_sa != null && inputs.use_sa) || (inputs.use_sa == null && (steps.set_day.outputs.DAY == 'Tue' || steps.set_day.outputs.DAY == 'Thu' || steps.set_day.outputs.DAY == 'Sat')) }}
66+
use_sa: ${{ inputs.use_sa == true || (github.event_name == 'schedule' && (steps.set_day.outputs.DAY == 'Tue' || steps.set_day.outputs.DAY == 'Thu' || steps.set_day.outputs.DAY == 'Sat')) }}
67+
send_notification: ${{ github.event_name == 'schedule' || inputs.send_notification == true }}
6368
steps:
6469
- name: set day
6570
id: set_day
@@ -86,9 +91,9 @@ jobs:
8691
terraform_version: ${{ matrix.terraform_version }}
8792
provider_version: ${{ matrix.provider_version }}
8893
atlas_cloud_env: ${{ inputs.atlas_cloud_env || needs.variables.outputs.is_sun == 'true' && 'qa' || '' }} # Run against QA on Sundays
94+
# Job output variables are always returned as strings.
8995
use_sa: ${{ needs.variables.outputs.use_sa == 'true' }}
90-
# This expression is true if unset (scheduled workflow) and works with boolean and string (GHA params are passed as strings)
91-
send_notification: ${{ !contains(github.event.inputs.send_notification, 'false') }}
96+
send_notification: ${{ needs.variables.outputs.send_notification == 'true' }}
9297

9398
clean-after:
9499
needs: tests
@@ -97,8 +102,8 @@ jobs:
97102
uses: ./.github/workflows/cleanup-test-env.yml
98103

99104
slack-notification:
100-
needs: [tests, clean-after]
101-
if: ${{ !cancelled() && needs.tests.result == 'failure' && !contains(github.event.inputs.send_notification, 'false') }}
105+
needs: [tests, variables, clean-after]
106+
if: ${{ !cancelled() && needs.tests.result == 'failure' && needs.variables.outputs.send_notification == 'true' }}
102107
runs-on: ubuntu-latest
103108
permissions: {}
104109
steps:

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ require (
4242
github.com/hashicorp/terraform-json v0.27.2
4343
github.com/hashicorp/terraform-plugin-framework-jsontypes v0.2.0
4444
go.mongodb.org/atlas-sdk/v20250312008 v20250312008.0.0
45-
golang.org/x/oauth2 v0.31.0
45+
golang.org/x/oauth2 v0.32.0
4646
)
4747

4848
require (

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1608,8 +1608,8 @@ golang.org/x/oauth2 v0.4.0/go.mod h1:RznEsdpjGAINPTOF0UH/t+xJ75L18YO3Ho6Pyn+uRec
16081608
golang.org/x/oauth2 v0.5.0/go.mod h1:9/XBHVqLaWO3/BRHs5jbpYCnOZVjj5V0ndyaAM7KB4I=
16091609
golang.org/x/oauth2 v0.6.0/go.mod h1:ycmewcwgD4Rpr3eZJLSB4Kyyljb3qDh40vJ8STE5HKw=
16101610
golang.org/x/oauth2 v0.7.0/go.mod h1:hPLQkd9LyjfXTiRohC/41GhcFqxisoUQ99sCUOHO9x4=
1611-
golang.org/x/oauth2 v0.31.0 h1:8Fq0yVZLh4j4YA47vHKFTa9Ew5XIrCP8LC6UeNZnLxo=
1612-
golang.org/x/oauth2 v0.31.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
1611+
golang.org/x/oauth2 v0.32.0 h1:jsCblLleRMDrxMN29H3z/k1KliIvpLgCkE6R8FXXNgY=
1612+
golang.org/x/oauth2 v0.32.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
16131613
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
16141614
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
16151615
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=

0 commit comments

Comments
 (0)