From 91ca9a6baa7111f2e0a0585eba85647a22977319 Mon Sep 17 00:00:00 2001 From: MalinAhlberg Date: Thu, 17 Oct 2024 14:17:42 +0200 Subject: [PATCH] [tests] allow 409 from add-api-key request --- .github/integration/tests/sda/20_ingest-verify_test.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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"