small fixes

master
Alexander Tomokhov 2023-12-12 07:43:37 +04:00
parent 08a5dd0870
commit 57c6b9606e
1 changed files with 6 additions and 3 deletions

View File

@ -1,10 +1,11 @@
#! /usr/bin/env bash
set -o pipefail
set -o errexit
set -o nounset
set -o pipefail
shopt -s inherit_errexit
: ${DOMAIN:?specify domain name}
: "${DOMAIN:?specify domain name}"
readonly AUTH_HEADER="Authorization: Bearer du-dummy-api-token"
readonly QUERY='query AllServices {
@ -85,9 +86,11 @@ received_response="$(curl --show-error -s "https://api.$DOMAIN/graphql" \
jq <<<"$received_response"
if [ "$EXPECTED_RESPONSE" == "$received_response" ]; then
if diff -w -u --color <(printf "%s\n" "$EXPECTED_RESPONSE") <(printf "%s\n" "$received_response") 2>/dev/null
then
echo -e "\e[1;32mOK"
else
echo -e "\e[1;31mFAIL: response does not match!"
jd -color <(printf "%s" "$EXPECTED_RESPONSE") <(printf "%s" "$received_response")
exit 1
fi