Skip to content

Commit 1d747f8

Browse files
committed
comparison checks
1 parent 3bbcf76 commit 1d747f8

File tree

2 files changed

+21
-23
lines changed

2 files changed

+21
-23
lines changed

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

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,20 @@ on:
2525
description: 'The branch, tag or SHA where tests will run, e.g. v1.14.0, empty for default branch'
2626
type: string
2727
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-
default: false
33+
required: true
3234
use_sa:
3335
description: "Run tests using Service Account instead of API Keys"
3436
type: boolean
35-
default: false
37+
required: true
3638
send_notification:
3739
description: 'Send a Slack notification if stream tests fail.'
3840
type: boolean
39-
default: false
41+
required: true
4042
mongodb_atlas_org_id:
4143
type: string
4244
required: true
@@ -212,14 +214,14 @@ env:
212214
# If the name (regex) of the test is set, only that test is run.
213215
# Don't run migration tests if using Service Accounts because previous provider versions don't support SA yet.
214216
# Only Migration tests are run when a specific previous provider version is set.
215-
ACCTEST_REGEX_RUN: ${{ inputs.test_name || inputs.use_sa && '^TestAcc' || inputs.provider_version == '' && '^Test(Acc|Mig)' || '^TestMig' }}
217+
ACCTEST_REGEX_RUN: ${{ inputs.test_name || inputs.use_sa == true && '^TestAcc' || inputs.provider_version == '' && '^Test(Acc|Mig)' || '^TestMig' }}
216218
MONGODB_ATLAS_BASE_URL: ${{ inputs.mongodb_atlas_base_url }}
217219
MONGODB_REALM_BASE_URL: ${{ inputs.mongodb_realm_base_url }}
218220
MONGODB_ATLAS_ORG_ID: ${{ inputs.mongodb_atlas_org_id }}
219-
MONGODB_ATLAS_PUBLIC_KEY: ${{ inputs.use_sa == false && secrets.mongodb_atlas_public_key || '' }}
220-
MONGODB_ATLAS_PRIVATE_KEY: ${{ inputs.use_sa == false && secrets.mongodb_atlas_private_key || '' }}
221-
MONGODB_ATLAS_CLIENT_ID: ${{ inputs.use_sa && secrets.mongodb_atlas_client_id || '' }}
222-
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 || '' }}
223225
MONGODB_ATLAS_PUBLIC_KEY_READ_ONLY: ${{ secrets.mongodb_atlas_public_key_read_only }}
224226
MONGODB_ATLAS_PRIVATE_KEY_READ_ONLY: ${{ secrets.mongodb_atlas_private_key_read_only }}
225227
MONGODB_ATLAS_GOV_PUBLIC_KEY: ${{ secrets.mongodb_atlas_gov_public_key }}
@@ -445,14 +447,14 @@ jobs:
445447
env:
446448
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
447449
HTTP_MOCKER_CAPTURE: 'true'
448-
ACCTEST_REGEX_RUN: ${{ inputs.reduced_tests && '^TestAccMockable' || env.ACCTEST_REGEX_RUN }}
450+
ACCTEST_REGEX_RUN: ${{ inputs.reduced_tests == true && '^TestAccMockable' || env.ACCTEST_REGEX_RUN }}
449451
ACCTEST_PACKAGES: ./internal/service/advancedcluster
450452
run: make testacc
451453

452454
advanced_cluster_tpf_mig_from_sdkv2:
453455
needs: [ change-detection, get-provider-version ]
454456
# Previous advanced_cluster versions don't support SA.
455-
if: ${{ inputs.reduced_tests == false && inputs.use_sa == false && (needs.change-detection.outputs.advanced_cluster == 'true' || inputs.test_group == 'advanced_cluster') }}
457+
if: ${{ inputs.reduced_tests != true && inputs.use_sa != true && (needs.change-detection.outputs.advanced_cluster == 'true' || inputs.test_group == 'advanced_cluster') }}
456458
runs-on: ubuntu-latest
457459
permissions: {}
458460
steps:
@@ -478,7 +480,7 @@ jobs:
478480
advanced_cluster_tpf_mig_from_tpf_preview:
479481
needs: [ change-detection, get-provider-version ]
480482
# Previous advanced_cluster versions don't support SA.
481-
if: ${{ inputs.reduced_tests == false && inputs.use_sa == false && (needs.change-detection.outputs.advanced_cluster == 'true' || inputs.test_group == 'advanced_cluster') }}
483+
if: ${{ inputs.reduced_tests != true && inputs.use_sa != true && (needs.change-detection.outputs.advanced_cluster == 'true' || inputs.test_group == 'advanced_cluster') }}
482484
runs-on: ubuntu-latest
483485
permissions: {}
484486
steps:
@@ -927,7 +929,7 @@ jobs:
927929
event_trigger:
928930
needs: [change-detection, get-provider-version]
929931
# Realm SDK doesn't support SA.
930-
if: ${{ inputs.use_sa == false && (needs.change-detection.outputs.event_trigger == 'true' || inputs.test_group == 'event_trigger') }}
932+
if: ${{ inputs.use_sa != true && (needs.change-detection.outputs.event_trigger == 'true' || inputs.test_group == 'event_trigger') }}
931933
runs-on: ubuntu-latest
932934
permissions: {}
933935
steps:
@@ -1236,10 +1238,10 @@ jobs:
12361238
terraform_wrapper: false
12371239
- name: Acceptance Tests
12381240
env:
1239-
MONGODB_ATLAS_PUBLIC_KEY: ${{ inputs.use_sa == false && secrets.mongodb_atlas_rp_public_key || '' }}
1240-
MONGODB_ATLAS_PRIVATE_KEY: ${{ inputs.use_sa == false && secrets.mongodb_atlas_rp_private_key || '' }}
1241-
MONGODB_ATLAS_CLIENT_ID: ${{ inputs.use_sa && secrets.mongodb_atlas_rp_client_id || '' }}
1242-
MONGODB_ATLAS_CLIENT_SECRET: ${{ inputs.use_sa && secrets.mongodb_atlas_rp_client_secret || '' }}
1241+
MONGODB_ATLAS_PUBLIC_KEY: ${{ inputs.use_sa != true && secrets.mongodb_atlas_rp_public_key || '' }}
1242+
MONGODB_ATLAS_PRIVATE_KEY: ${{ inputs.use_sa != true && secrets.mongodb_atlas_rp_private_key || '' }}
1243+
MONGODB_ATLAS_CLIENT_ID: ${{ inputs.use_sa == true && secrets.mongodb_atlas_rp_client_id || '' }}
1244+
MONGODB_ATLAS_CLIENT_SECRET: ${{ inputs.use_sa == true && secrets.mongodb_atlas_rp_client_secret || '' }}
12431245
MONGODB_ATLAS_ORG_ID: ${{ inputs.mongodb_atlas_rp_org_id }}
12441246
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
12451247
ACCTEST_PACKAGES: ./internal/service/resourcepolicy
@@ -1351,7 +1353,7 @@ jobs:
13511353

13521354
slack-notification-stream:
13531355
needs: [stream]
1354-
if: ${{ !cancelled() && needs.stream.result == 'failure' && inputs.send_notification }}
1356+
if: ${{ !cancelled() && needs.stream.result == 'failure' && inputs.send_notification == true }}
13551357
runs-on: ubuntu-latest
13561358
permissions: {}
13571359
steps:

.github/workflows/acceptance-tests.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,14 @@ on:
2929
description: 'The branch, tag or SHA where tests will run, e.g. v1.14.0, empty for default branch'
3030
type: string
3131
required: false
32-
reduced_tests:
33-
description: 'If run only minimum tests for advanced_cluster, e.g. in PRs'
34-
type: boolean
35-
default: false
3632
use_sa:
3733
description: "Run tests using Service Account instead of API Keys"
3834
type: boolean
39-
default: false
35+
required: false
4036
send_notification:
4137
description: 'Send a Slack notification if tests fail.'
4238
type: boolean
43-
default: false
39+
required: false
4440

4541
workflow_call: # workflow runs after Test Suite or code-health
4642
inputs:

0 commit comments

Comments
 (0)