Dockerfile Smoke Tests #45
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: check smoke tests | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
smoke_tests: | |
runs-on: ubuntu-latest | |
services: | |
db: | |
image: postgres:17 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: pw | |
ports: | |
- 5432:5432 | |
options: | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
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: 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" \ | |
-p 8080:8080 \ | |
rl-service-image | |
sleep 10 | |
# 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" |