Skip to content

Commit

Permalink
Add smoke tests
Browse files Browse the repository at this point in the history
  • Loading branch information
johnake committed Feb 9, 2024
1 parent e35bba5 commit 54403be
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 13 deletions.
25 changes: 19 additions & 6 deletions .github/actions/deploy-environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ runs:
DOCKER_IMAGE_TAG: ${{ inputs.docker-image }}
PR_NUMBER: ${{ inputs.pull-request-number }}

- name: Set up Terraform outputs as env vars
- name: Extract Terraform outputs
shell: bash
id: set_outputs
run: |
echo "CLAIMS_EXTERNAL_HOST=$(terraform output -raw claims_web_external_hostname)" >> $GITHUB_ENV
echo "PLACEMENTS_EXTERNAL_HOST=$(terraform output -raw placements_web_external_hostname)" >> $GITHUB_ENV
output=$(terraform output -json hostname)
echo "HOSTNAMES=$output" >> $GITHUB_ENV
- name: Set up Ruby 3.2.2
uses: ruby/setup-ruby@v1
Expand All @@ -54,10 +56,21 @@ runs:
echo 'gem "rspec"' >> Gemfile
bundle
# - name: Run RSpec tests
# shell: bash
# run: |
# bin/bundle exec rspec --tag smoke_test -b
# env:
# SMOKE_TEST: "true"
# CLAIMS_EXTERNAL_HOST: ${{ env.CLAIMS_EXTERNAL_HOST }}
# PLACEMENTS_EXTERNAL_HOST: ${{ env.PLACEMENTS_EXTERNAL_HOST }}

- name: Run RSpec tests
shell: bash
run: bin/bundle exec rspec --tag smoke_test -b
run: |
CLAIMS_EXTERNAL_HOST=$(echo $HOSTNAMES | jq -r '.[0]')
PLACEMENTS_EXTERNAL_HOST=$(echo $HOSTNAMES | jq -r '.[1]')
bin/bundle exec rspec --tag smoke_test -b
env:
SMOKE_TEST: "true"
CLAIMS_EXTERNAL_HOST: ${{ env.CLAIMS_EXTERNAL_HOST }}
PLACEMENTS_EXTERNAL_HOST: ${{ env.PLACEMENTS_EXTERNAL_HOST }}
HOSTNAMES: ${{ env.HOSTNAMES }}
22 changes: 15 additions & 7 deletions terraform/application/output.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
# Access the first hostname
output "claims_web_external_hostname" {
value = module.web_application.web_external_hostnames[0]
}
# # Access the first hostname
# output "claims_web_external_hostname" {
# value = module.web_application.hostname[0]
# }

# output "claims_web_external_hostname" {
# value = module.web_application.web_external_hostnames[0]
# }

# # Access the second hostname
# output "placements_external_hostname" {
# value = module.web_application.hostname[1]
# }

# Access the second hostname
output "placements_external_hostname" {
value = module.web_application.web_external_hostnames[1]
output "hostname" {
value = [local.app_env_values["CLAIMS_HOST"], local.app_env_values["PLACEMENTS_HOST"]]
}

0 comments on commit 54403be

Please sign in to comment.