Skip to content

Commit

Permalink
Add test step for deployed Lambda
Browse files Browse the repository at this point in the history
#minor
  • Loading branch information
gregtyler committed Oct 9, 2023
1 parent f002db6 commit 68c6f45
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/env-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,21 @@ on:
description: "AWS Secret Access Key"
required: true
github_access_token:
description: 'Github Token'
description: "Github Token"
required: true
outputs:
create_url:
description: "URL of the create endpoint"
value: ${{ jobs.terraform_environment_workflow.outputs.url }}

jobs:
terraform_environment_workflow:
runs-on: ubuntu-latest
environment:
name: ${{ inputs.workspace_name }} popup environment
url: ${{ steps.terraform_outputs.outputs.url }}
outputs:
url: ${{ steps.terraform_outputs.outputs.url }}
steps:
- uses: actions/checkout@v4
with:
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/workflow-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,16 @@ jobs:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
github_access_token: ${{ secrets.GITHUB_TOKEN }}

test-pr-env:
name: Test PR Environment
needs: [deploy-pr-env]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"
- name: POST to server
env:
URL: ${{ needs.deploy-pr-env.outputs.create_url }}
run: make test-api
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ up:
down:
docker compose down

test-api: URL ?= http://localhost:9000/create
test-api:
curl -XPOST localhost:9000/create -d '{"uid":"test","version":"1"}' -i
curl $(URL) -XPOST -H 'Content-type: application/json' -d '{"uid":"M-AL9A-7EY3-075D","version":"1"}' -q

create-tables:
docker compose run --rm aws dynamodb describe-table --table-name deeds || \
Expand Down

0 comments on commit 68c6f45

Please sign in to comment.