Skip to content

Commit ac7bd00

Browse files
authored
test: Fix TestAccCloudUserTeamAssignment_basic (#3685)
1 parent 8e79fc9 commit ac7bd00

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ on:
4343
mongodb_atlas_project_owner_id:
4444
type: string
4545
required: true
46+
mongodb_atlas_cloud_user_id:
47+
type: string
48+
required: true
4649
mongodb_atlas_teams_ids:
4750
type: string
4851
required: true
@@ -616,7 +619,7 @@ jobs:
616619
env:
617620
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
618621
MONGODB_ATLAS_TEAMS_IDS: ${{ inputs.mongodb_atlas_teams_ids }}
619-
MONGODB_ATLAS_PROJECT_OWNER_ID: ${{ inputs.mongodb_atlas_project_owner_id }}
622+
MONGODB_ATLAS_CLOUD_USER_ID: ${{ inputs.mongodb_atlas_cloud_user_id }}
620623
MONGODB_ATLAS_ORG_ID: ${{ inputs.mongodb_atlas_org_id }}
621624
MONGODB_ATLAS_USERNAME: ${{ vars.MONGODB_ATLAS_USERNAME }}
622625
MONGODB_ATLAS_USERNAME_2: ${{ vars.MONGODB_ATLAS_USERNAME_2 }}

.github/workflows/acceptance-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ jobs:
108108
mongodb_atlas_base_url: ${{ inputs.atlas_cloud_env == 'qa' && vars.MONGODB_ATLAS_BASE_URL_QA || vars.MONGODB_ATLAS_BASE_URL }}
109109
mongodb_realm_base_url: ${{ inputs.atlas_cloud_env == 'qa' && vars.MONGODB_REALM_BASE_URL_QA || vars.MONGODB_REALM_BASE_URL }}
110110
mongodb_atlas_project_owner_id: ${{ inputs.atlas_cloud_env == 'qa' && vars.MONGODB_ATLAS_PROJECT_OWNER_ID_QA || vars.MONGODB_ATLAS_PROJECT_OWNER_ID }}
111+
mongodb_atlas_cloud_user_id: ${{ inputs.atlas_cloud_env == 'qa' && vars.MONGODB_ATLAS_CLOUD_USER_ID_QA || vars.MONGODB_ATLAS_CLOUD_USER_ID }}
111112
mongodb_atlas_teams_ids: ${{ inputs.atlas_cloud_env == 'qa' && vars.MONGODB_ATLAS_TEAMS_IDS_QA || vars.MONGODB_ATLAS_TEAMS_IDS }}
112113
azure_atlas_app_id: ${{ inputs.atlas_cloud_env == 'qa' && vars.AZURE_ATLAS_APP_ID_QA || vars.AZURE_ATLAS_APP_ID }}
113114
azure_service_principal_id: ${{ inputs.atlas_cloud_env == 'qa' && vars.AZURE_SERVICE_PRINCIPAL_ID_QA || vars.AZURE_SERVICE_PRINCIPAL_ID }}

internal/service/clouduserteamassignment/resource_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,12 @@ func TestAccCloudUserTeamAssignment_basic(t *testing.T) {
2222

2323
func basicTestCase(t *testing.T) *resource.TestCase {
2424
t.Helper()
25-
2625
orgID := os.Getenv("MONGODB_ATLAS_ORG_ID")
27-
userID := os.Getenv("MONGODB_ATLAS_PROJECT_OWNER_ID")
26+
userID := os.Getenv("MONGODB_ATLAS_CLOUD_USER_ID")
2827
teamName := acc.RandomName()
2928

3029
return &resource.TestCase{
31-
PreCheck: func() { acc.PreCheckBasic(t); acc.PreCheckBasicOwnerID(t) },
30+
PreCheck: func() { acc.PreCheckCloudUserID(t) },
3231
ProtoV6ProviderFactories: acc.TestAccProviderV6Factories,
3332
CheckDestroy: checkDestroy,
3433
Steps: []resource.TestStep{

internal/testutil/acc/pre_check.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ func PreCheckBasicOwnerID(tb testing.TB) {
8484
}
8585
}
8686

87+
func PreCheckCloudUserID(tb testing.TB) {
88+
tb.Helper()
89+
PreCheckBasic(tb)
90+
if os.Getenv("MONGODB_ATLAS_CLOUD_USER_ID") == "" {
91+
tb.Fatal("`MONGODB_ATLAS_CLOUD_USER_ID` must be set ")
92+
}
93+
}
94+
8795
func PreCheckAtlasUsername(tb testing.TB) {
8896
tb.Helper()
8997
PreCheckBasic(tb)

0 commit comments

Comments
 (0)