Skip to content

Commit 7f9571d

Browse files
rakhul-mongorakhul-peerislands
authored andcommitted
Add workflow for contract tests
1 parent 8479e75 commit 7f9571d

File tree

1 file changed

+63
-19
lines changed

1 file changed

+63
-19
lines changed

.github/workflows/contract-testing.yaml

Lines changed: 63 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
pull-requests: read
1212
repository-projects: read
1313
outputs: # ensure resources are sorted alphabetically
14-
access-list-api-key: ${{ steps.filter.outputs.access-list-api-key }}
14+
access-list-api-key: ${{ steps.filter.outputs.access-list-api-key }}
1515
alert-configuration: ${{ steps.filter.outputs.alert-configuration }}
1616
api-key: ${{ steps.filter.outputs.api-key }}
1717
auditing: ${{ steps.filter.outputs.auditing }}
@@ -30,6 +30,7 @@ jobs:
3030
search-deployment: ${{ steps.filter.outputs.search-deployment }}
3131
stream-connection: ${{ steps.filter.outputs.stream-connection }}
3232
stream-instance: ${{ steps.filter.outputs.stream-instance }}
33+
stream-workspace: ${{ steps.filter.outputs.stream-workspace }}
3334
steps:
3435
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
3536
if: ${{ github.event_name == 'push' }}
@@ -75,6 +76,8 @@ jobs:
7576
- 'cfn-resources/stream-connection/**'
7677
stream-instance:
7778
- 'cfn-resources/stream-instance/**'
79+
stream-workspace:
80+
- 'cfn-resources/stream-workspace/**'
7881
access-list-api-key:
7982
needs: change-detection
8083
if: ${{ needs.change-detection.outputs.access-list-api-key == 'true' }}
@@ -188,10 +191,10 @@ jobs:
188191
run: |
189192
pushd cfn-resources/api-key
190193
make create-test-resources
191-
194+
192195
cat inputs/inputs_1_create.json
193196
cat inputs/inputs_1_update.json
194-
197+
195198
make run-contract-testing
196199
make delete-test-resources
197200
auditing:
@@ -229,12 +232,12 @@ jobs:
229232
run: |
230233
pushd cfn-resources/auditing
231234
make create-test-resources
232-
235+
233236
cat inputs/inputs_1_create.json
234237
cat inputs/inputs_1_update.json
235238
cat inputs/inputs_2_create.json
236239
cat inputs/inputs_2_update.json
237-
240+
238241
make run-contract-testing
239242
make delete-test-resources
240243
cloud-backup-restore-jobs:
@@ -314,9 +317,9 @@ jobs:
314317
run: |
315318
pushd cfn-resources/cluster-outage-simulation
316319
make create-test-resources
317-
320+
318321
cat inputs/inputs_1_create.json
319-
322+
320323
make run-contract-testing
321324
make delete-test-resources
322325
federated-database-instance:
@@ -354,10 +357,10 @@ jobs:
354357
run: |
355358
pushd cfn-resources/federated-database-instance
356359
make create-test-resources
357-
360+
358361
cat inputs/inputs_1_create.json
359362
cat inputs/inputs_1_update.json
360-
363+
361364
make run-contract-testing
362365
make delete-test-resources
363366
federated-query-limit:
@@ -395,10 +398,10 @@ jobs:
395398
run: |
396399
pushd cfn-resources/federated-query-limit
397400
make create-test-resources
398-
401+
399402
cat inputs/inputs_1_create.json
400403
cat inputs/inputs_1_update.json
401-
404+
402405
make run-contract-testing
403406
make delete-test-resources
404407
@@ -437,10 +440,10 @@ jobs:
437440
run: |
438441
pushd cfn-resources/flex-cluster
439442
make create-test-resources
440-
443+
441444
cat inputs/inputs_1_create.json
442445
cat inputs/inputs_1_update.json
443-
446+
444447
make run-contract-testing
445448
make delete-test-resources
446449
online-archive:
@@ -519,10 +522,10 @@ jobs:
519522
run: |
520523
pushd cfn-resources/organization
521524
make create-test-resources
522-
525+
523526
cat inputs/inputs_1_create.json
524527
cat inputs/inputs_1_update.json
525-
528+
526529
make run-contract-testing
527530
make delete-test-resources
528531
private-endpoint-aws:
@@ -642,10 +645,10 @@ jobs:
642645
run: |
643646
pushd cfn-resources/privatelink-endpoint-service-data-federation-online-archive
644647
make create-test-resources
645-
648+
646649
cat inputs/inputs_1_create.json
647650
cat inputs/inputs_1_update.json
648-
651+
649652
make run-contract-testing
650653
make delete-test-resources
651654
project:
@@ -684,10 +687,10 @@ jobs:
684687
run: |
685688
pushd cfn-resources/project
686689
make create-test-resources
687-
690+
688691
cat inputs/inputs_1_create.json
689692
cat inputs/inputs_1_update.json
690-
693+
691694
make run-contract-testing
692695
make delete-test-resources
693696
resource-policy:
@@ -854,3 +857,44 @@ jobs:
854857
cat inputs/inputs_1_create.json
855858
make run-contract-testing
856859
make delete-test-resources
860+
stream-workspace:
861+
needs: change-detection
862+
if: ${{ needs.change-detection.outputs.stream-workspace == 'true' }}
863+
runs-on: ubuntu-latest
864+
steps:
865+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
866+
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c
867+
with:
868+
go-version-file: 'cfn-resources/go.mod'
869+
- name: setup Atlas CLI
870+
uses: mongodb/atlas-github-action@e3c9e0204659bafbb3b65e1eb1ee745cca0e9f3b
871+
- uses: aws-actions/setup-sam@c2a20b1822cc4a6bc594ff7f1dbb658758e383c3
872+
with:
873+
use-installer: true
874+
- uses: aws-actions/configure-aws-credentials@61815dcd50bd041e203e49132bacad1fd04d2708
875+
with:
876+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_TEST_ENV }}
877+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_TEST_ENV }}
878+
aws-region: eu-west-1
879+
- uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548
880+
with:
881+
python-version: '3.9'
882+
cache: 'pip' # caching pip dependencies
883+
- run: pip install cloudformation-cli cloudformation-cli-go-plugin
884+
- name: Run the Contract test
885+
shell: bash
886+
env:
887+
MONGODB_ATLAS_PUBLIC_API_KEY: ${{ secrets.CLOUD_DEV_PUBLIC_KEY }}
888+
MONGODB_ATLAS_PRIVATE_API_KEY: ${{ secrets.CLOUD_DEV_PRIVATE_KEY }}
889+
MONGODB_ATLAS_ORG_ID: ${{ secrets.CLOUD_DEV_ORG_ID }}
890+
MONGODB_ATLAS_OPS_MANAGER_URL: ${{ vars.MONGODB_ATLAS_BASE_URL }}
891+
MONGODB_ATLAS_PROFILE: cfn-cloud-dev-github-action
892+
run: |
893+
cd cfn-resources/stream-workspace
894+
make create-test-resources
895+
896+
cat inputs/inputs_1_create.json
897+
cat inputs/inputs_1_update.json
898+
899+
make run-contract-testing
900+
make delete-test-resources

0 commit comments

Comments
 (0)