test: add aws ec2 wait commands for instance terminate, image

register, and instance running
This commit is contained in:
Xiaofeng Wang 2023-08-14 22:27:48 +08:00 committed by Achilleas Koutsou
parent 84728ea85d
commit dc5583b382

View file

@ -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
@ -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"
@ -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 \