diff --git a/tests/test-run.sh b/tests/test-run.sh index b5fc1a2156cd7177da534e1a858fb3d29a142f0b..79d5f7574f169238cfdfc5757896b8b16c85bfe7 100755 --- a/tests/test-run.sh +++ b/tests/test-run.sh @@ -28,6 +28,7 @@ GATEWAY_IP=$(docker inspect backend-test | grep \"Gateway\":\ \" | sed 's/.*Gate # Test - GET groups +echo "Testing groups API..." if [ "$(curl -s ${GATEWAY_IP}:65434/services/groups)" != "$GROUPS_REF" ]; then echo "Tests failed - failed to load groups" exit 1 @@ -36,6 +37,7 @@ fi # Test - GET variables +echo "Testing variables API..." if [ "$(curl -s ${GATEWAY_IP}:65434/services/variables)" != "$VARIABLES_REF" ]; then echo "Tests failed - failed to load variables" exit 1 @@ -52,6 +54,7 @@ fi # Test - GET stats +echo "Testing stats API..." if [ "$(curl -s ${GATEWAY_IP}:65434/services/stats)" != "$STATS_REF" ]; then echo "Tests failed - failed to load stats" exit 1 @@ -60,6 +63,7 @@ fi # Test - POST requests +echo "Testing requests API..." response=$(curl -s -H "Content-Type: application/json" -X POST -d ${REQUEST_BODY} ${GATEWAY_IP}:65434/services/queries/requests) if [ "${response:52}" != "${REQUEST_REF:52}" ]; then echo "Tests failed - failed to post requests" @@ -69,9 +73,10 @@ fi # Test - POST and GET an article -curl -s -H "Content-Type: application/json" -X POST -d ${ARTICLE_BODY} ${GATEWAY_IP}:65434/services/articles +echo "Testing articles API..." +temp=$(curl -s -H "Content-Type: application/json" -X POST -d ${ARTICLE_BODY} ${GATEWAY_IP}:65434/services/articles) response=$(curl -s ${GATEWAY_IP}:65434/services/articles | sed "s/\"createdAt\":[0-9]*,//g") -response_ref=$(echo ${ARTICLE_REF} | sed "s/\"createdAt\":[0-9]*,//g") +response_ref=$(echo "${ARTICLE_REF}" | sed "s/\"createdAt\":[0-9]*,//g") if [ "${response}" != "${response_ref}" ]; then echo "Tests failed - failed to save/load article" exit 1 @@ -80,7 +85,8 @@ fi # Test - POST and GET a model -curl -s -H "Content-Type: application/json" -X POST -d ${MODEL_BODY} ${GATEWAY_IP}:65434/services/models +echo "Testing models API..." +temp=$(curl -s -H "Content-Type: application/json" -X POST -d ${MODEL_BODY} ${GATEWAY_IP}:65434/services/models) response=$(curl -s ${GATEWAY_IP}:65434/services/models | sed "s/\"createdAt\":[0-9]*,//g" | sed "s/\"date\":[0-9]*,//g") response_ref=$(echo "${MODEL_REF}" | sed "s/\"createdAt\":[0-9]*,//g" | sed "s/\"date\":[0-9]*,//g") if [ "${response}" != "${response_ref}" ]; then @@ -89,6 +95,6 @@ if [ "${response}" != "${response_ref}" ]; then fi -echo "Tests successfully passed" +echo "All tests successfully passed" exit 0