diff --git a/.github/integration/tests/sda/20_ingest-verify_test.sh b/.github/integration/tests/sda/20_ingest-verify_test.sh index cee612531..09bcf73e4 100644 --- a/.github/integration/tests/sda/20_ingest-verify_test.sh +++ b/.github/integration/tests/sda/20_ingest-verify_test.sh @@ -76,7 +76,13 @@ for file in NA12878.bam NA12878_20k_b37.bam NA12878.bai NA12878_20k_b37.bai; do # Insert key hash after the ingestion of the first file has started # Makes sure that ingestion works even if the key hash is there - curl -k -L "http://api:8080/key/hashed" -H "Authorization: Bearer $token" -d "{\"hash\": \"$key\", \"description\": \"first key\"}" + response=$(curl -s -w "%{http_code}" -k -L "http://api:8080/key/hashed" -H "Authorization: Bearer $token" -d "{\"hash\": \"$key\", \"description\": \"first key\"}") + # Extract the 3 last characters, ie the status code + status=$(echo -n "$response" | tail -c 3) + if [ "$status" -ne "200" ] && [ "$status" -ne "409" ]; then + echo "Could not add key hash to database" + exit 1 + fi done echo "waiting for verify to complete"