Skip to content

Commit

Permalink
feat: changed grep to jq
Browse files Browse the repository at this point in the history
  • Loading branch information
cbrinson-rise8 committed Nov 7, 2024
1 parent 11d2f28 commit dd12fc5
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions .github/workflows/check_smoke_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ jobs:
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
Expand Down Expand Up @@ -67,35 +62,35 @@ jobs:
-H "Content-Type: application/json")
echo "Response: $RESPONSE_1"
echo "$RESPONSE_1" | grep -q '"is_match":\s*false'
echo "$RESPONSE_1" | jq -e '.is_match == false'
PERSON_REFERENCE_ID=$(echo "$RESPONSE_1" | grep -oP '"person_reference_id":"\K[^"]+')
PERSON_REFERENCE_ID=$(echo "$RESPONSE_1" | jq -r '.person_reference_id')
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\""
echo "$RESPONSE_2" | jq -e '.is_match == true'
echo "$RESPONSE_2" | jq -e --arg id "$PERSON_REFERENCE_ID" '.person_reference_id == $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'
echo "$RESPONSE_3" | jq -e '.is_match == false'
PERSON_REFERENCE_ID=$(echo "$RESPONSE_3" | grep -oP '"person_reference_id":"\K[^"]+')
PERSON_REFERENCE_ID=$(echo "$RESPONSE_3" | jq -r '.person_reference_id')
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\""
echo "$RESPONSE_4" | jq -e '.is_match == true'
echo "$RESPONSE_4" | jq -e --arg id "$PERSON_REFERENCE_ID" '.person_reference_id == $id'
#invalid tests
RESPONSE_5=$(curl -s -X POST http://localhost:8080/link \
Expand Down

0 comments on commit dd12fc5

Please sign in to comment.