Skip to content
This repository was archived by the owner on Apr 13, 2020. It is now read-only.

Commit f3cf0ba

Browse files
authored
spk onboard smoke test fails on storage account name (#213)
1 parent 5706003 commit f3cf0ba

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

tests/functions.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,27 @@ function storage_account_table_exists () {
200200

201201
if [ "$sat_exists" = "true" ]; then
202202
echo "The table '$t' exists "
203+
if [ "$action" == "delete" ]; then
204+
echo "Delete table '$t'"
205+
az storage table delete -n $t --account-name $sa_name
206+
total_wait_seconds=20
207+
wait_delete_seconds=50
208+
start=0
209+
wait_seconds=5
210+
while [ $start -lt $total_wait_seconds ]; do
211+
sat_result=$(az storage table exists -n $t --account-name $sa_name)
212+
sat_exists=$(echo $sat_result | jq '.exists | . == true')
213+
if [ "$sat_exists" = "false" ]; then
214+
echo "The table '$t' was marked deleted"
215+
echo "Wait $wait_delete_seconds seconds for delete..."
216+
sleep $wait_delete_seconds
217+
break
218+
fi
219+
echo "Wait $wait_seconds seconds..."
220+
sleep $wait_seconds
221+
start=$((start + wait_seconds))
222+
done
223+
fi
203224
else
204225
echo "The table $sa_name does not exist"
205226
if [ "$action" == "fail" ]; then

tests/introspection-validations.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ TEST_WORKSPACE="$(pwd)/spk-env"
1717
[ ! -z "$SP_APP_ID" ] || { echo "Provide SP_APP_ID"; exit 1;}
1818
[ ! -z "$SP_PASS" ] || { echo "Provide SP_PASS"; exit 1;}
1919
[ ! -z "$SP_TENANT" ] || { echo "Provide SP_TENANT"; exit 1;}
20+
[ ! -z "$AZ_STORAGE_ACCOUNT" ] || { echo "Provide AZ_STORAGE_ACCOUNT"; exit 1;}
2021
AZDO_ORG_URL="${AZDO_ORG_URL:-"https://dev.azure.com/$AZDO_ORG"}"
2122

2223
echo "TEST_WORKSPACE: $TEST_WORKSPACE"
@@ -26,10 +27,10 @@ echo "AZDO_ORG: $AZDO_ORG"
2627
echo "AZDO_ORG_URL: $AZDO_ORG_URL"
2728
echo "AZ_RESOURCE_GROUP: $AZ_RESOURCE_GROUP"
2829
echo "ACR_NAME: $ACR_NAME"
30+
echo "AZ_STORAGE_ACCOUNT: $AZ_STORAGE_ACCOUNT"
2931

3032
vg_name=fabrikam-vg
31-
sa_name=fabrikamsatst
32-
sat_name=fabrikamdeployments
33+
sat_name=fabrikamtestdeployments
3334
sa_location=westus
3435
kv_name=fabrikamkv
3536
kv_location=westus
@@ -40,9 +41,10 @@ echo "SPK Version: $(spk --version)"
4041
echo "Running from $(pwd)"
4142

4243
# spk deployment onboard validation test
43-
storage_account_exists $sa_name $AZ_RESOURCE_GROUP "delete"
44-
spk deployment onboard -s $sa_name -t $sat_name -l $sa_location -r $AZ_RESOURCE_GROUP --subscription-id $AZ_SUBSCRIPTION_ID --service-principal-id $SP_APP_ID --service-principal-password $SP_PASS --tenant-id $SP_TENANT
45-
storage_account_exists $sa_name $AZ_RESOURCE_GROUP "fail"
46-
storage_account_table_exists $sat_name $sa_name "fail"
44+
storage_account_exists $AZ_STORAGE_ACCOUNT $AZ_RESOURCE_GROUP "fail"
45+
storage_account_table_exists $sat_name $AZ_STORAGE_ACCOUNT "delete"
46+
spk deployment onboard -s $AZ_STORAGE_ACCOUNT -t $sat_name -l $sa_location -r $AZ_RESOURCE_GROUP --subscription-id $AZ_SUBSCRIPTION_ID --service-principal-id $SP_APP_ID --service-principal-password $SP_PASS --tenant-id $SP_TENANT
47+
storage_account_table_exists $sat_name $AZ_STORAGE_ACCOUNT "fail"
48+
storage_account_table_exists $sat_name $AZ_STORAGE_ACCOUNT "delete"
4749

4850
echo "Successfully reached the end of the introspection validations script."

0 commit comments

Comments
 (0)