From 894c7046d96e71906bfd2c203e425f8f59e19668 Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Mon, 30 Oct 2023 18:06:23 +0100 Subject: [PATCH] test: compare upload_statuses[0] with upload_status Check that the first element of the upload_statuses array matches the top-level upload_status. We only test one upload target for now. --- test/cases/api.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/cases/api.sh b/test/cases/api.sh index 805e3048e6..990356d481 100755 --- a/test/cases/api.sh +++ b/test/cases/api.sh @@ -489,6 +489,9 @@ function waitForState() { UPLOAD_TYPE=$(echo "$OUTPUT" | jq -r '.image_status.upload_status.type') UPLOAD_OPTIONS=$(echo "$OUTPUT" | jq -r '.image_status.upload_status.options') + # get the upload_statuses array to compare the first element with the top level upload_status + UPLOAD_STATUSES=$(echo "$OUTPUT" | jq -r '.image_status.upload_statuses') + case "$COMPOSE_STATUS" in "$DESIRED_STATE") break @@ -623,6 +626,17 @@ fi test "$UPLOAD_TYPE" = "$EXPECTED_UPLOAD_TYPE" test $((INIT_COMPOSES+1)) = "$SUBS_COMPOSES" +# test that the first element in the upload_statuses matches the top +# upload_status +UPLOAD_STATUS_0=$(echo "$UPLOAD_STATUSES" | jq -r '.[0].status') +test "$UPLOAD_STATUS_0" = "success" + +UPLOAD_TYPE_0=$(echo "$UPLOAD_STATUSES" | jq -r '.[0].type') +test "$UPLOAD_TYPE" = "$UPLOAD_TYPE_0" + +UPLOAD_OPTIONS_0=$(echo "$UPLOAD_STATUSES" | jq -r '.[0].options') +test "$UPLOAD_OPTIONS" = "$UPLOAD_OPTIONS_0" + if [ -s "$IMG_COMPOSE_REQ_FILE" ]; then sendImgFromCompose "$IMG_COMPOSE_REQ_FILE"