Skip to content

CI: EE - EP Merge - Integration Test #4

CI: EE - EP Merge - Integration Test

CI: EE - EP Merge - Integration Test #4

name: 'CI: EE - EP Merge - Integration Test'
on:
# Allow manual triggering
workflow_dispatch:
# Allow being called by another GitHub Action
workflow_call:
env:
COMPOSE_PROFILES: 'bip'
VRO_DEV_SECRETS_FOLDER: "${{ github.workspace }}/.cache/abd-vro-dev-secrets"
jobs:
integration-test:
runs-on: ubuntu-latest
steps:
- name: 'Checkout source code'
uses: actions/checkout@v3
- name: "Checkout abd-vro-dev-secrets repo"
uses: actions/checkout@v3
with:
# Checkout using a PAT so that we can access the internal repo
token: ${{ secrets.ACCESS_TOKEN_CHECKOUT_INTERNAL_REPO }}
repository: 'department-of-veterans-affairs/abd-vro-dev-secrets'
path: "${{ env.VRO_DEV_SECRETS_FOLDER }}"
- name: 'Build the images'
uses: ./.github/actions/build-images
- name: 'Start the containers'
run: |
source scripts/setenv.sh
# create basic auth token for RabbitMQ and export to github environment
BASIC_AUTH=$(echo "${RABBITMQ_USERNAME}:${RABBITMQ_PASSWORD}" | base64)
{
echo "RABBITMQ_USERNAME=${RABBITMQ_USERNAME}"
echo "RABBITMQ_PASSWORD=${RABBITMQ_PASSWORD}"
echo "RABBITMQ_BASIC_AUTH=${BASIC_AUTH}"
} >> "$GITHUB_ENV"
export -p | sed 's/declare -x //'
./gradlew :dockerComposeUp
- name: 'Wait for containers to start'
run: sleep 60s
shell: bash
- name: 'Wait for RabbitMQ to be ready'
uses: indiesdev/[email protected]
with:
url: 'http://localhost:15672/api/vhosts'
method: 'GET'
basic-auth-token: '${{env.RABBITMQ_BASIC_AUTH}}'
accept: 200
# Retry every 2 seconds
timeout: 2000
# Quit after 60 seconds
retries: 30
# Temporary step added to avoid condition where bipApiExchange is not yet created.
- name: 'Create bipApiExchange exchange'
uses: indiesdev/[email protected]
with:
url: 'http://localhost:15672/api/exchanges/%2f/bipApiExchange'
method: 'PUT'
basic-auth-token: '${{env.RABBITMQ_BASIC_AUTH}}'
body: '{"type":"direct", "durable":true, "auto_delete":true}'
accept: 201, 204
retries: 3
log-response: true
- name: "Run Employee Experience Integration Tests"
run: |
./gradlew :domain-ee:ee-ep-merge-app:integrationTest
- name: "Start svc-bip-api and mock-bip-claims-api"
run: |
source scripts/setenv.sh
export -p | sed 's/declare -x //'
./gradlew :app:dockerComposeUp
./gradlew -p mocks docker
./gradlew -p mocks :dockerComposeUp
./gradlew :domain-ee:dockerComposeUp
- name: 'Wait for other containers to start'
run: sleep 60s
shell: bash
- name: 'Post-Build Docker Cleanup'
uses: ./.github/actions/docker-prune
- name: 'Check disk space (Post-Build)'
uses: ./.github/actions/check-disk-space
- name: 'Send Merge Request'
uses: indiesdev/[email protected]
id: merge_request
with:
url: 'http://localhost:8140/merge'
method: 'POST'
body: '{"pending_claim_id":1001,"ep400_claim_id":1000}'
accept: 202
retries: 3
log-response: true
- name: 'Get Job ID'
shell: bash
id: get_job_id
run: |
job_id="${{ fromJSON(steps.merge_request.outputs.response).data.job.job_id }}"
echo "job_id=$job_id" >> "$GITHUB_OUTPUT"
# Allow time to finish processing
sleep 5s
- name: 'Test get job ID'
shell: bash
run: |
echo ${{steps.get_job_id.outputs.job_id}}
- name: 'Get Merge Request Status'
uses: indiesdev/[email protected]
with:
id: merge_status
url: 'http://localhost:8140/merge/${{steps.get_job_id.outputs.job_id}}'
method: 'GET'
body: '{"pending_claim_id":1001,"ep400_claim_id":1000}'
accept: 202
retries: 3
log-response: true
- name: 'Clean shutdown of all containers'
if: always()
shell: bash
run: |
docker ps
COMPOSE_PROFILES="all" ./gradlew dockerComposeDown