diff --git a/01api/petstore-api-buildspec.yml b/01api/petstore-api-buildspec.yml index af9dce14..8c45eceb 100644 --- a/01api/petstore-api-buildspec.yml +++ b/01api/petstore-api-buildspec.yml @@ -4,7 +4,7 @@ phases: commands: - cd 01api - aws cloudformation package --template-file petstore-api.yaml - --s3-bucket + --s3-bucket kodnest-users --s3-prefix api-code --output-template-file petstore-api-output.yaml artifacts: diff --git a/02postman/PetStoreAPI.postman_collection.json b/02postman/PetStoreAPI.postman_collection.json index 6a4f9d1f..86c81ab8 100644 --- a/02postman/PetStoreAPI.postman_collection.json +++ b/02postman/PetStoreAPI.postman_collection.json @@ -52,9 +52,9 @@ "method": "GET", "header": [], "url": { - "raw": "{{apigw-root}}/pets", + "raw": "{{base_url}}/pets", "host": [ - "{{apigw-root}}" + "{{base_url}}" ], "path": [ "pets" @@ -121,9 +121,9 @@ "raw": "{\n\t\"type\":\"Lizzard\",\n\t\"price\": 3.50\n}" }, "url": { - "raw": "{{apigw-root}}/pets", + "raw": "{{base_url}}/pets", "host": [ - "{{apigw-root}}" + "{{base_url}}" ], "path": [ "pets" @@ -180,9 +180,9 @@ "method": "GET", "header": [], "url": { - "raw": "{{apigw-root}}/pets/3", + "raw": "{{base_url}}/pets/3", "host": [ - "{{apigw-root}}" + "{{base_url}}" ], "path": [ "pets", diff --git a/02postman/PetStoreAPIEnvironment.postman_environment.json b/02postman/PetStoreAPIEnvironment.postman_environment.json index f163aa9b..67be7e2f 100644 --- a/02postman/PetStoreAPIEnvironment.postman_environment.json +++ b/02postman/PetStoreAPIEnvironment.postman_environment.json @@ -4,7 +4,7 @@ "values": [ { "key": "apigw-root", - "value": "https://g228ynt8yb.execute-api.us-east-1.amazonaws.com/prod", + "value": "http://petstore-demo-endpoint.execute-api.com", "enabled": true } ], diff --git a/03codebuild/postman-newman-buildspec.yml b/03codebuild/postman-newman-buildspec.yml index cb7c0af4..0e687fa8 100644 --- a/03codebuild/postman-newman-buildspec.yml +++ b/03codebuild/postman-newman-buildspec.yml @@ -2,30 +2,36 @@ version: 0.2 env: variables: - key: "S3_BUCKET" + S3_BUCKET: "kodnest-users" phases: install: runtime-versions: nodejs: 10 - commands: #https://learning.getpostman.com/docs/postman/collection-runs/command-line-integration-with-newman/ + commands: - npm install -g newman - yum install -y jq pre_build: commands: - - aws s3 cp "s3://${S3_BUCKET}/postman-env-files/PetStoreAPIEnvironment.postman_environment.json" ./02postman/ - - aws s3 cp "s3://${S3_BUCKET}/postman-env-files/PetStoreAPI.postman_collection.json" ./02postman/ + - aws s3 cp s3://${S3_BUCKET}/postman-env-files/PetStoreAPIEnvironment.postman_environment.json ./02postman/ + - aws s3 cp s3://${S3_BUCKET}/postman-env-files/PetStoreAPI.postman_collection.json ./02postman/ - cd ./02postman + - chmod +x ./update-postman-env-file.sh - ./update-postman-env-file.sh build: commands: - echo Build started on `date` from dir `pwd` - - newman run PetStoreAPI.postman_collection.json --environment PetStoreAPIEnvironment.postman_environment.json -r junit + - newman run "PetStoreAPI.postman_collection.json" --environment "PetStoreAPIEnvironment.postman_environment.json" --reporters "cli,junit" --reporter-junit-export "newman-report.xml" + + post_build: + commands: + - echo Tests completed on `date` + - aws s3 cp ./02postman/newman/ s3://${S3_BUCKET}/postman-reports/ --recursive --exclude "*" --include "*.xml" reports: - JUnitReports: # CodeBuild will create a report group called "SurefireReports". - files: #Store all of the files - - '**/*' - base-directory: '02postman/newman' # Location of the reports + junitreports: + files: + - '**/*.xml' + base-directory: '02postman/newman'