test: make test more resilient

During manual cleanup of unused resources, the storage account can get
removed. The current storage account is not possible to remove
mannually, but adding this check to make it more resielient in future
scenarios.
This commit is contained in:
Juan Abia 2021-12-16 11:59:24 +01:00 committed by jrusz
parent f284e2a932
commit 786fc2719d

View file

@ -178,6 +178,17 @@ name = "cloud-init"
enabled = ["sshd", "cloud-init", "cloud-init-local", "cloud-config", "cloud-final"]
EOF
# Make sure the specified storage account exists
if [ "$(az resource list --name "$AZURE_STORAGE_ACCOUNT")" == "[]" ]; then
echo "The storage account ${AZURE_STORAGE_ACCOUNT} was removed!"
az storage account create \
--name "${AZURE_STORAGE_ACCOUNT}" \
--resource-group "${AZURE_RESOURCE_GROUP}" \
--location "${AZURE_LOCATION}" \
--sku Standard_RAGRS \
--kind StorageV2
fi
# Prepare the blueprint for the compose.
greenprint "📋 Preparing blueprint"
sudo composer-cli blueprints push "$BLUEPRINT_FILE"