diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index fcfd84b..f9eb1e3 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -22,7 +22,19 @@ jobs: echo AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} >> .env echo AWS_DEFAULT_REGION=${{ secrets.AWS_DEFAULT_REGION }} >> .env echo S3_BUCKET=${{ secrets.S3_BUCKET }} >> .env - + - name: 'Create .env.json file' + run: | + cat < .env.json + { + "accounts": [ + { + "AWS_ACCESS_KEY_ID": "${{ secrets.AWS_ACCESS_KEY_ID }}", + "AWS_SECRET_ACCESS_KEY": "${{ secrets.AWS_SECRET_ACCESS_KEY }}" + } + ], + "bucket_allow_list": ["ffrd-pilot", "ffrd-trinity", "${{ secrets.S3_BUCKET }}"] + } + EOF - name: Build the docker-compose stack run: docker-compose build @@ -44,9 +56,13 @@ jobs: sleep 50s docker logs mcat-ras-newman + - name: Clean up .env.json + if: always() + run: rm -f .env.json + - name: Check Newman Exit Code run: | - if [ $(docker inspect mcat-ras-newman --format='{{.State.ExitCode}}') -ne 0 ] + if [ $(docker inspect mcat-ras-newman --format='{{.State.ExitCode}}') -ne 0 ] then echo "Newman failed." exit 1 diff --git a/docker-compose.yml b/docker-compose.yml index 4fc4b7b..e276efb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -28,10 +28,14 @@ services: entrypoint: [ "" ] command: > sh -c "sleep 30s && - newman run /app/testing/postman_collection.json --env-var "url=api:5600"" + newman run /app/testing/postman_collection.json + --env-var url=api:5600 + --env-var bucket=${S3_BUCKET}" volumes: - ./testing:/app/testing depends_on: - "api" + environment: + - S3_BUCKET=${S3_BUCKET} networks: - app_network diff --git a/testing/postman_collection.json b/testing/postman_collection.json index 46b2acb..ffc0c8e 100644 --- a/testing/postman_collection.json +++ b/testing/postman_collection.json @@ -1,9 +1,10 @@ { "info": { - "_postman_id": "d3145bb8-85d0-4989-bc2f-064b2c02a658", + "_postman_id": "776e55f5-e919-42df-b84f-1a00301abbf8", "name": "mcat-ras-testing", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", - "_exporter_id": "14419355" + "_exporter_id": "18773467", + "_collection_link": "https://universal-comet-524706.postman.co/workspace/Dewberry~fe115dcb-2f48-4ca3-a618-e462c6ac4255/collection/18773467-776e55f5-e919-42df-b84f-1a00301abbf8?action=share&source=collection_link&creator=18773467" }, "item": [ { @@ -66,7 +67,8 @@ " pm.expect(valLen).to.eql(141);\r", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -74,7 +76,7 @@ "method": "GET", "header": [], "url": { - "raw": "http://{{url}}/forcingdata?definition_file=mcat-ras-testing/Example_Projects/2D Unsteady Flow Hydraulics/BaldEagleCrkMulti2D/BaldEagleDamBrk.prj", + "raw": "http://{{url}}/forcingdata?definition_file=mcat-ras-testing/Example_Projects/2D Unsteady Flow Hydraulics/BaldEagleCrkMulti2D/BaldEagleDamBrk.prj&bucket={{bucket}}", "protocol": "http", "host": [ "{{url}}" @@ -86,6 +88,10 @@ { "key": "definition_file", "value": "mcat-ras-testing/Example_Projects/2D Unsteady Flow Hydraulics/BaldEagleCrkMulti2D/BaldEagleDamBrk.prj" + }, + { + "key": "bucket", + "value": "{{bucket}}" } ] } @@ -134,7 +140,8 @@ " pm.response.to.not.have.jsonBody(\"error\");\r", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -142,7 +149,7 @@ "method": "GET", "header": [], "url": { - "raw": "http://{{url}}/forcingdata?definition_file=mcat-ras-testing/mocked-data/bare-minimum-project/BaldEagleDamBrk.prj", + "raw": "http://{{url}}/forcingdata?definition_file=mcat-ras-testing/mocked-data/bare-minimum-project/BaldEagleDamBrk.prj&bucket={{bucket}}", "protocol": "http", "host": [ "{{url}}" @@ -154,6 +161,10 @@ { "key": "definition_file", "value": "mcat-ras-testing/mocked-data/bare-minimum-project/BaldEagleDamBrk.prj" + }, + { + "key": "bucket", + "value": "{{bucket}}" } ] } @@ -171,7 +182,8 @@ " pm.expect(pm.response.json()).to.eql({});\r", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -179,7 +191,7 @@ "method": "GET", "header": [], "url": { - "raw": "http://{{url}}/forcingdata?definition_file=mcat-ras-testing/mocked-data/no-flow-file/BaldEagleDamBrk.prj", + "raw": "http://{{url}}/forcingdata?definition_file=mcat-ras-testing/mocked-data/no-flow-file/BaldEagleDamBrk.prj&bucket={{bucket}}", "protocol": "http", "host": [ "{{url}}" @@ -191,6 +203,10 @@ { "key": "definition_file", "value": "mcat-ras-testing/mocked-data/no-flow-file/BaldEagleDamBrk.prj" + }, + { + "key": "bucket", + "value": "{{bucket}}" } ] } @@ -240,7 +256,8 @@ "\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -248,7 +265,7 @@ "method": "GET", "header": [], "url": { - "raw": "http://{{url}}/forcingdata?definition_file=mcat-ras-testing/Example_Projects/not-exist.prj", + "raw": "http://{{url}}/forcingdata?definition_file=mcat-ras-testing/Example_Projects/not-exist.prj&bucket={{bucket}}", "protocol": "http", "host": [ "{{url}}" @@ -260,6 +277,10 @@ { "key": "definition_file", "value": "mcat-ras-testing/Example_Projects/not-exist.prj" + }, + { + "key": "bucket", + "value": "{{bucket}}" } ] } @@ -330,7 +351,8 @@ "});\r", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -338,7 +360,7 @@ "method": "GET", "header": [], "url": { - "raw": "http://{{url}}/isamodel?definition_file=mcat-ras-testing/Example_Projects/2D Unsteady Flow Hydraulics/BaldEagleCrkMulti2D/GISData/MainChannelBanks.prj", + "raw": "http://{{url}}/isamodel?definition_file=mcat-ras-testing/Example_Projects/2D Unsteady Flow Hydraulics/BaldEagleCrkMulti2D/GISData/MainChannelBanks.prj&bucket={{bucket}}", "protocol": "http", "host": [ "{{url}}" @@ -350,6 +372,10 @@ { "key": "definition_file", "value": "mcat-ras-testing/Example_Projects/2D Unsteady Flow Hydraulics/BaldEagleCrkMulti2D/GISData/MainChannelBanks.prj" + }, + { + "key": "bucket", + "value": "{{bucket}}" } ] } @@ -389,6 +415,11 @@ "key": "url", "value": "localhost:5600", "type": "string" + }, + { + "key": "bucket", + "value": "", + "type": "string" } ] } \ No newline at end of file