generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 2
131 lines (98 loc) · 4.11 KB
/
check_smoke_tests.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
130
131
name: check smoke tests
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
smoke_tests:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: pw
ports:
- 5432:5432
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build RecordLinker Docker Image
run: |
docker build -t rl-service-image .
# - name: Run RecordLinker Service
# run: |
# docker run -d --name rl-service \
# -e DB_URI="postgresql+psycopg2://postgres:pw@localhost:5432/postgres" \
# -p 8080:8080 \
# rl-service-image
# - name: Wait for RL to become healthy
# run: |
# # Wait for the RL Service to be healthy
# TRIES=20
# COUNT=0
# until curl -s http://localhost:8080/ | grep "OK"; do
# echo "Waiting for RL Service to become healthy... Attempt $((COUNT+1)) of $TRIES"
# sleep 5
# COUNT=$((COUNT+1))
# if [ "$COUNT" -ge "$TRIES" ]; then
# echo "RL Service did not become healthy in time."
# exit 1
# fi
# done
- name: Test GET from DB
run: |
docker run -d --name rl-service \
-e DB_URI="postgresql+psycopg2://postgres:[email protected]:5432/postgres" \
-p 8080:8080 \
rl-service-image
sleep 10
docker logs rl-service
RESP=$(curl -s http://localhost:8080/algorithm)
echo "Response: $RESP"
# - name: Testing POST
# run: |
# RESP=$(curl -s -X POST http://localhost:8080/link \
# -d '{"record": {"birth_date": "2053-11-07", "sex": "M", "mrn": "1234567890", "name":[{"family":"Shepard", "given":["John"]}]}}' \
# -H "Content-Type: application/json")
# echo "Response: $RESP"
# - name: Smoke tests
# run: |
# # Run smoke tests and print the response
# JSON_BODY_1='{"record": {"birth_date": "2053-11-07", "sex": "M", "mrn": "1234567890", "name":[{"family":"Shepard", "given":["John"]}]}}'
# JSON_BODY_2='{"algorithm": "dibbs-enhanced", "record": {"birth_date": "2000-12-06", "sex": "M", "mrn": "9876543210", "name":[{"family":"Smith", "given":["William"]}]}}'
# #basic tests
# RESPONSE_1=$(curl -s -X POST http://localhost:8080/link \
# -d "$JSON_BODY_1" \
# -H "Content-Type: application/json")
# echo "Response: $RESPONSE_1"
# echo "$RESPONSE_1" | grep -q '"is_match":\s*false'
# PERSON_REFERENCE_ID=$(echo "$RESPONSE_1" | grep -oP '"person_reference_id":"\K[^"]+')
# RESPONSE_2=$(curl -s -X POST http://localhost:8080/link \
# -d "$JSON_BODY_1" \
# -H "Content-Type: application/json")
# echo "Response: $RESPONSE_2"
# echo "$RESPONSE_2" | grep -q '"is_match":\s*true'
# echo "$RESPONSE_2" | grep -q "\"person_reference_id\":\"$PERSON_REFERENCE_ID\""
# #enhanced tests
# RESPONSE_3=$(curl -s -X POST http://localhost:8080/link \
# -d "$JSON_BODY_2" \
# -H "Content-Type: application/json")
# echo "Response: $RESPONSE_3"
# echo "$RESPONSE_3" | grep -q '"is_match":\s*false'
# PERSON_REFERENCE_ID=$(echo "$RESPONSE_3" | grep -oP '"person_reference_id":"\K[^"]+')
# RESPONSE_4=$(curl -s -X POST http://localhost:8080/link \
# -d "$JSON_BODY_2" \
# -H "Content-Type: application/json")
# echo "Response: $RESPONSE_4"
# echo "$RESPONSE_4" | grep -q '"is_match":\s*true'
# echo "$RESPONSE_4" | grep -q "\"person_reference_id\":\"$PERSON_REFERENCE_ID\""
# #invalid tests
# RESPONSE_5=$(curl -s -X POST http://localhost:8080/link \
# -d '{"algorithm": "invalid", "record": {}}' \
# -H "Content-Type: application/json")
# echo "Response: $RESPONSE_5"
# echo "$RESPONSE_5" | grep -q "Invalid algorithm specified"