Skip to content

Commit

Permalink
feat: add smoke tests back in
Browse files Browse the repository at this point in the history
  • Loading branch information
cbrinson-rise8 committed Nov 7, 2024
1 parent 29b6e93 commit 62afa61
Showing 1 changed file with 50 additions and 64 deletions.
114 changes: 50 additions & 64 deletions .github/workflows/check_smoke_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ jobs:
run: |
docker build -t rl-service-image .
- name: Start RecordLinker Service
- name: Start RecordLinker Service and Run Smoke Tests
run: |
# Start Record Linker Service
docker run -d --name rl-service \
--network="host" \
-e DB_URI="postgresql+psycopg2://postgres:pw@localhost:5432/postgres" \
Expand All @@ -45,82 +46,67 @@ jobs:
sleep 10
docker ps
if [ "$(docker ps -q -f name=rl-service)" == "" ]; then
echo "RecordLinker Service container is not running"
docker logs rl-service
exit 1
fi
# docker ps
# if [ "$(docker ps -q -f name=rl-service)" == "" ]; then
# echo "RecordLinker Service container is not running"
# docker logs rl-service
# exit 1
# fi
RESP=$(curl -s http://localhost:8080/algorithm)
echo "Response: $RESP"
# RESP=$(curl -s http://localhost:8080/algorithm)
# echo "Response: $RESP"
RESP_1=$(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_1"
# - 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")
# # Smoke Tests
# RESP_1=$(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"

# echo "Response: $RESP_1"
# - 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"]}]}}'
# 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[^"]+')
#basic tests
RESPONSE_1=$(curl -s -X POST http://localhost:8080/link \
-d "$JSON_BODY_1" \
-H "Content-Type: application/json")
# RESPONSE_2=$(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'
# echo "Response: $RESPONSE_2"
# echo "$RESPONSE_2" | grep -q '"is_match":\s*true'
# echo "$RESPONSE_2" | grep -q "\"person_reference_id\":\"$PERSON_REFERENCE_ID\""
PERSON_REFERENCE_ID=$(echo "$RESPONSE_1" | grep -oP '"person_reference_id":"\K[^"]+')
# #enhanced tests
# RESPONSE_3=$(curl -s -X POST http://localhost:8080/link \
# -d "$JSON_BODY_2" \
# -H "Content-Type: application/json")
RESPONSE_2=$(curl -s -X POST http://localhost:8080/link \
-d "$JSON_BODY_1" \
-H "Content-Type: application/json")
# echo "Response: $RESPONSE_3"
# echo "$RESPONSE_3" | grep -q '"is_match":\s*false'
echo "Response: $RESPONSE_2"
echo "$RESPONSE_2" | grep -q '"is_match":\s*true'
echo "$RESPONSE_2" | grep -q "\"person_reference_id\":\"$PERSON_REFERENCE_ID\""
# PERSON_REFERENCE_ID=$(echo "$RESPONSE_3" | grep -oP '"person_reference_id":"\K[^"]+')
#enhanced tests
RESPONSE_3=$(curl -s -X POST http://localhost:8080/link \
-d "$JSON_BODY_2" \
-H "Content-Type: application/json")
# RESPONSE_4=$(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'
# 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")
PERSON_REFERENCE_ID=$(echo "$RESPONSE_3" | grep -oP '"person_reference_id":"\K[^"]+')
# echo "Response: $RESPONSE_5"
# echo "$RESPONSE_5" | grep -q "Invalid algorithm specified"

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"

0 comments on commit 62afa61

Please sign in to comment.