Skip to content

Commit

Permalink
test: compare upload_statuses[0] with upload_status
Browse files Browse the repository at this point in the history
Check that the first element of the upload_statuses array matches the
top-level upload_status.
We only test one upload target for now.
  • Loading branch information
achilleas-k authored and croissanne committed Nov 17, 2023
1 parent d3921dc commit 894c704
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/cases/api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 894c704

Please sign in to comment.