Skip to content

Commit

Permalink
test: add aws ec2 wait commands for instance terminate, image
Browse files Browse the repository at this point in the history
register, and instance running
  • Loading branch information
henrywang authored and achilleas-k committed Aug 14, 2023
1 parent 84728ea commit dc5583b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/cases/ostree-ami-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ clean_up () {
if [[ -v INSTANCE_ID ]]; then
aws ec2 terminate-instances \
--instance-ids "${INSTANCE_ID}"
aws ec2 wait instance-terminated \
--instance-ids "${INSTANCE_ID}"
fi

# Remove bucket content and bucket itself quietly
Expand Down Expand Up @@ -703,6 +705,10 @@ AMI_ID=$(
jq -r '.ImageId'
)

# Wait for image available to use to avoid image not available error
aws ec2 wait image-available \
--image-ids "$AMI_ID"

aws ec2 create-tags \
--resources "${AMI_ID}" \
--tags Key=Name,Value=composer-ci Key=UUID,Value="$TEST_UUID"
Expand Down Expand Up @@ -777,6 +783,10 @@ check_result

INSTANCE_ID=$(jq -r '.Instances[].InstanceId' "${INSTANCE_OUT_INFO}")

# wait for instance running
aws ec2 wait instance-running \
--instance-ids "$INSTANCE_ID"

# get instance public ip
PUBLIC_GUEST_ADDRESS=$(
aws ec2 describe-instances \
Expand Down

0 comments on commit dc5583b

Please sign in to comment.