-
Notifications
You must be signed in to change notification settings - Fork 6
129 lines (108 loc) · 3.93 KB
/
svc-bip-api-integration-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: 'CI: SVC BIP API integration test'
on:
# Allow manual triggering
workflow_dispatch:
# Allow being called by another GitHub Action
workflow_call:
push:
branches: [josiah/bip-integration-test]
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: |
# 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"
source scripts/setenv.sh
export -p | sed 's/declare -x //'
./gradlew :dockerComposeUp
./gradlew -p mocks :build
./gradlew -p mocks :mock-bip-claims-api:docker
./gradlew -p mocks :mock-bip-ce-api:docker
./gradlew -p mocks :mock-slack:docker
./gradlew -p mocks :mock-lighthouse-api:docker
./gradlew -p mocks :mock-bie-kafka:docker
./gradlew -p mocks :dockerComposeUp
./gradlew :domain-xample:dockerComposeUp
./gradlew :app:dockerComposeUp
- name: 'Wait for RabbitMQ to be ready'
uses: indiesdev/curl@v1.1
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
- name: 'Wait for svc-bip-api to be ready'
uses: nev7n/wait_for_response@v1
with:
url: 'http://localhost:10301/actuator/health'
responseCode: 200
# Retry every 2 seconds
interval: 2000
# Quit after 60 seconds
timeout: 60000
- name: "Wait for VRO to be ready"
uses: nev7n/wait_for_response@v1
with:
url: 'http://localhost:8111/actuator/health'
responseCode: 200
# Retry every 2 seconds
interval: 2000
# Quit after 100 seconds
timeout: 100000
- name: "Run the integration test"
run: |
source scripts/setenv.sh
./gradlew :svc-bip-api:integrationTest
- name: "Collect docker logs"
if: always()
uses: jwalton/gh-docker-logs@v2
with:
dest: './svc-bip-api-container-logs'
- name: "Upload artifact"
if: always()
uses: actions/upload-artifact@v3
with:
name: svc-bip-api-container-logs
path: ./svc-bip-api-container-logs/**
retention-days: 14
- name: "Check for errors in container logs"
run: |
if docker logs vro_svc-bip-api_1 | grep 'ERROR'; then
echo "Unexpected ERROR logs in svc-bip-api container"
exit 11
fi
if docker logs vro_svc-bip-api_1 | grep 'ERROR\|WARN' | grep -v 'Simulated error'; then
echo "Unexpected ERROR logs in svc-bip-api container"
exit 12
fi
- name: 'Clean shutdown of all containers'
if: always()
shell: bash
run: |
docker ps
COMPOSE_PROFILES="all" ./gradlew dockerComposeDown