Skip to content

Commit 1bf7cfc

Browse files
authored
chore: Adds a test_name param to acceptance test workflow (#2352)
1 parent 7e4b65b commit 1bf7cfc

File tree

3 files changed

+39
-4
lines changed

3 files changed

+39
-4
lines changed

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

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ on:
1717
description: 'Test group to run, e.g. advanced_cluster, empty for all'
1818
type: string
1919
required: false
20+
test_name:
21+
description: 'Name of the test to run, e.g. TestAccNetworkRSNetworkPeering_basicAzure, empty for all (requires Test group to be specified as well)'
22+
type: string
23+
required: false
2024
ref:
2125
description: 'The branch, tag or SHA where tests will run, e.g. v1.14.0, empty for default branch'
2226
type: string
@@ -133,7 +137,7 @@ env:
133137
TF_LOG: ${{ vars.LOG_LEVEL }}
134138
ACCTEST_TIMEOUT: ${{ vars.ACCTEST_TIMEOUT }}
135139
# Only Migration tests are run when testing a specific previous provider version instead of the latest one
136-
ACCTEST_REGEX_RUN: ${{ inputs.provider_version == '' && '^Test(Acc|Mig)' || '^TestMig' }}
140+
ACCTEST_REGEX_RUN: ${{ inputs.provider_version == '' && '^Test(Acc|Mig)' || '^TestMig' }}
137141
MONGODB_ATLAS_BASE_URL: ${{ inputs.mongodb_atlas_base_url }}
138142
MONGODB_ATLAS_ORG_ID: ${{ inputs.mongodb_atlas_org_id }}
139143
MONGODB_ATLAS_PUBLIC_KEY: ${{ secrets.mongodb_atlas_public_key }}
@@ -166,7 +170,7 @@ jobs:
166170
runs-on: ubuntu-latest
167171
permissions: {}
168172
env:
169-
mustTrigger: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.test_group == '') }}
173+
mustTrigger: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.test_group == '' && inputs.test_name == '') }}
170174
outputs:
171175
advanced_cluster: ${{ steps.filter.outputs.advanced_cluster == 'true' || env.mustTrigger == 'true' }}
172176
assume_role: ${{ steps.filter.outputs.assume_role == 'true' || env.mustTrigger == 'true' }}
@@ -192,7 +196,7 @@ jobs:
192196
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
193197
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36
194198
id: filter
195-
if: ${{ inputs.test_group == '' && env.mustTrigger == 'false' }}
199+
if: ${{ inputs.test_group == '' && inputs.test_name == '' && env.mustTrigger == 'false' }}
196200
with:
197201
filters: |
198202
advanced_cluster:
@@ -293,6 +297,7 @@ jobs:
293297
env:
294298
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
295299
ACCTEST_PACKAGES: ./internal/service/advancedcluster
300+
ACCTEST_REGEX_RUN: ${{ inputs.test_name }}
296301
run: make testacc
297302

298303
assume_role:
@@ -333,6 +338,7 @@ jobs:
333338
AWS_SESSION_TOKEN: ${{ steps.sts-assume-role.outputs.AWS_SESSION_TOKEN }}
334339
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
335340
ACCTEST_PACKAGES: ./internal/provider
341+
ACCTEST_REGEX_RUN: ${{ inputs.test_name }}
336342
run: make testacc
337343

338344
backup:
@@ -359,6 +365,7 @@ jobs:
359365
AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_access_key }}
360366
AWS_ACCESS_KEY_ID: ${{ secrets.aws_access_key_id }}
361367
AWS_S3_BUCKET: ${{ secrets.aws_s3_bucket_backup }}
368+
ACCTEST_REGEX_RUN: ${{ inputs.test_name }}
362369
ACCTEST_PACKAGES: |
363370
./internal/service/cloudbackupschedule
364371
./internal/service/cloudbackupsnapshot
@@ -387,6 +394,7 @@ jobs:
387394
- name: Acceptance Tests
388395
env:
389396
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
397+
ACCTEST_REGEX_RUN: ${{ inputs.test_name }}
390398
ACCTEST_PACKAGES: |
391399
./internal/service/cluster
392400
./internal/service/globalclusterconfig
@@ -411,6 +419,7 @@ jobs:
411419
- name: Acceptance Tests
412420
env:
413421
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
422+
ACCTEST_REGEX_RUN: ${{ inputs.test_name }}
414423
ACCTEST_PACKAGES: ./internal/service/clusteroutagesimulation
415424
run: make testacc
416425

@@ -442,6 +451,7 @@ jobs:
442451
AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_access_key }}
443452
AWS_S3_BUCKET: ${{ secrets.aws_s3_bucket_federation }}
444453
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
454+
ACCTEST_REGEX_RUN: ${{ inputs.test_name }}
445455
ACCTEST_PACKAGES: |
446456
./internal/service/alertconfiguration
447457
./internal/service/atlasuser
@@ -478,6 +488,7 @@ jobs:
478488
- name: Acceptance Tests
479489
env:
480490
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
491+
ACCTEST_REGEX_RUN: ${{ inputs.test_name }}
481492
ACCTEST_PACKAGES: ./internal/service/datalakepipeline
482493
run: make testacc
483494

@@ -500,6 +511,7 @@ jobs:
500511
- name: Acceptance Tests
501512
env:
502513
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
514+
ACCTEST_REGEX_RUN: ${{ inputs.test_name }}
503515
ACCTEST_PACKAGES: ./internal/service/encryptionatrest
504516
run: make testacc
505517

@@ -522,6 +534,7 @@ jobs:
522534
- name: Acceptance Tests
523535
env:
524536
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
537+
ACCTEST_REGEX_RUN: ${{ inputs.test_name }}
525538
ACCTEST_PACKAGES: ./internal/service/eventtrigger
526539
run: make testacc
527540

@@ -555,6 +568,7 @@ jobs:
555568
AWS_ACCESS_KEY_ID: ${{ secrets.aws_access_key_id }}
556569
AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_access_key }}
557570
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
571+
ACCTEST_REGEX_RUN: ${{ inputs.test_name }}
558572
ACCTEST_PACKAGES: |
559573
./internal/service/federateddatabaseinstance
560574
./internal/service/federatedquerylimit
@@ -584,6 +598,7 @@ jobs:
584598
MONGODB_ATLAS_PROJECT_OWNER_ID: ${{ inputs.mongodb_atlas_project_owner_id }}
585599
CA_CERT: ${{ secrets.ca_cert }}
586600
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
601+
ACCTEST_REGEX_RUN: ${{ inputs.test_name }}
587602
ACCTEST_PACKAGES: |
588603
./internal/service/auditing
589604
./internal/service/backupcompliancepolicy
@@ -614,6 +629,7 @@ jobs:
614629
MONGODB_ATLAS_LDAP_PORT: ${{ secrets.mongodb_atlas_ldap_port }}
615630
MONGODB_ATLAS_LDAP_CA_CERTIFICATE: ${{ secrets.mongodb_atlas_ldap_ca_certificate }}
616631
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
632+
ACCTEST_REGEX_RUN: ${{ inputs.test_name }}
617633
ACCTEST_PACKAGES: |
618634
./internal/service/ldapconfiguration
619635
./internal/service/ldapverify
@@ -653,6 +669,7 @@ jobs:
653669
AZURE_VNET_NAME: ${{ secrets.azure_vnet_name }}
654670
AZURE_VNET_NAME_UPDATED: ${{ secrets.azure_vnet_name_updated }}
655671
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
672+
ACCTEST_REGEX_RUN: ${{ inputs.test_name }}
656673
ACCTEST_PACKAGES: |
657674
./internal/service/networkcontainer
658675
./internal/service/networkpeering
@@ -692,6 +709,7 @@ jobs:
692709
AWS_VPC_CIDR_BLOCK: ${{ vars.AWS_VPC_CIDR_BLOCK }}
693710
AWS_VPC_ID: ${{ vars.AWS_VPC_ID }}
694711
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
712+
ACCTEST_REGEX_RUN: ${{ inputs.test_name }}
695713
ACCTEST_PACKAGES: |
696714
./internal/service/accesslistapikey
697715
./internal/service/project
@@ -721,6 +739,7 @@ jobs:
721739
AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_access_key }}
722740
AWS_ACCESS_KEY_ID: ${{ secrets.aws_access_key_id }}
723741
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
742+
ACCTEST_REGEX_RUN: ${{ inputs.test_name }}
724743
ACCTEST_PACKAGES: ./internal/service/pushbasedlogexport
725744
run: make testacc
726745

@@ -743,6 +762,7 @@ jobs:
743762
- name: Acceptance Tests
744763
env:
745764
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
765+
ACCTEST_REGEX_RUN: ${{ inputs.test_name }}
746766
ACCTEST_PACKAGES: ./internal/service/searchdeployment
747767
run: make testacc
748768

@@ -765,6 +785,7 @@ jobs:
765785
- name: Acceptance Tests
766786
env:
767787
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
788+
ACCTEST_REGEX_RUN: ${{ inputs.test_name }}
768789
ACCTEST_PACKAGES: ./internal/service/searchindex
769790
run: make testacc
770791

@@ -789,6 +810,7 @@ jobs:
789810
AWS_ACCESS_KEY_ID: ${{ secrets.aws_access_key_id }}
790811
AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_access_key }}
791812
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
813+
ACCTEST_REGEX_RUN: ${{ inputs.test_name }}
792814
ACCTEST_PACKAGES: |
793815
./internal/service/privatelinkendpointserverless
794816
./internal/service/privatelinkendpointserviceserverless
@@ -814,6 +836,7 @@ jobs:
814836
- name: Acceptance Tests
815837
env:
816838
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
839+
ACCTEST_REGEX_RUN: ${{ inputs.test_name }}
817840
ACCTEST_PACKAGES: |
818841
./internal/service/streamconnection
819842
./internal/service/streaminstance
@@ -838,6 +861,7 @@ jobs:
838861
- name: Acceptance Tests
839862
env:
840863
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
864+
ACCTEST_REGEX_RUN: ${{ inputs.test_name }}
841865
ACCTEST_PACKAGES: |
842866
./internal/service/controlplaneipaddresses
843867
run: make testacc

.github/workflows/acceptance-tests.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ on:
2121
description: 'Test group to run, e.g. advanced_cluster, empty for all'
2222
type: string
2323
required: false
24+
test_name:
25+
description: 'Name of the test to run, e.g. TestAccNetworkRSNetworkPeering_basicAzure, empty for all (requires Test group to be specified as well)'
26+
type: string
27+
required: false
2428
ref:
2529
description: 'The branch, tag or SHA where tests will run, e.g. v1.14.0, empty for default branch'
2630
type: string
@@ -77,6 +81,7 @@ jobs:
7781
provider_version: ${{ inputs.provider_version }}
7882
ref: ${{ inputs.ref }}
7983
test_group: ${{ inputs.test_group }}
84+
test_name: ${{ inputs.test_name }}
8085
aws_region_federation: ${{ vars.AWS_REGION_FEDERATION }}
8186
mongodb_atlas_org_id: ${{ inputs.atlas_cloud_env == 'qa' && vars.MONGODB_ATLAS_ORG_ID_CLOUD_QA || vars.MONGODB_ATLAS_ORG_ID_CLOUD_DEV }}
8287
mongodb_atlas_base_url: ${{ inputs.atlas_cloud_env == 'qa' && vars.MONGODB_ATLAS_BASE_URL_QA || vars.MONGODB_ATLAS_BASE_URL }}

GNUmakefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ ifdef ACCTEST_PACKAGES
55
else
66
ACCTEST_PACKAGES := "./..."
77
endif
8-
ACCTEST_REGEX_RUN?=^TestAcc
8+
9+
ifdef ACCTEST_REGEX_RUN
10+
# remove newlines and blanks coming from GH Actions
11+
ACCTEST_REGEX_RUN := $(strip $(subst $(newline),, $(ACCTEST_REGEX_RUN)))
12+
else
13+
ACCTEST_REGEX_RUN?=^TestAcc
14+
endif
915
ACCTEST_TIMEOUT?=300m
1016
PARALLEL_GO_TEST?=20
1117

0 commit comments

Comments
 (0)