@@ -92,9 +92,18 @@ TERRAFORM_SAMPLES=(
9292 " samples/web-app-sql-database/python/terraform|bash deploy.sh"
9393)
9494
95+ # 3b. Define Bicep Samples
96+ BICEP_SAMPLES=(
97+ # "samples/web-app-sql-database/python/bicep|bash deploy.sh"
98+ " samples/function-app-managed-identity/python/bicep|bash deploy.sh"
99+ " samples/function-app-storage-http/dotnet/bicep|bash deploy.sh"
100+ " samples/web-app-cosmosdb-mongodb-api/python/bicep|bash deploy.sh"
101+ " samples/web-app-managed-identity/python/bicep|bash deploy.sh"
102+ )
103+
95104# 4. Calculate Shard
96- # Combine both script-based and Terraform samples into one array
97- ALL_SAMPLES=(" ${SAMPLES[@]} " " ${TERRAFORM_SAMPLES[@]} " )
105+ # Combine script-based, Terraform, and Bicep samples into one array
106+ ALL_SAMPLES=(" ${SAMPLES[@]} " " ${TERRAFORM_SAMPLES[@]} " " ${BICEP_SAMPLES[@]} " )
98107TOTAL=${# ALL_SAMPLES[@]}
99108SHARD=${1:- 1}
100109SPLITS=${2:- 1}
@@ -107,7 +116,7 @@ if [ "$SHARD" -eq "$SPLITS" ]; then
107116fi
108117
109118echo " Running samples shard $SHARD of $SPLITS (index $START , count $COUNT )"
110- echo " Total samples (scripts + terraform): $TOTAL "
119+ echo " Total samples (scripts + terraform + bicep ): $TOTAL "
111120
112121# 5. Run Samples
113122for (( i= START; i< START+ COUNT; i++ )) ; do
@@ -133,6 +142,33 @@ for (( i=START; i<START+COUNT; i++ )); do
133142 rm -rf .terraform terraform.tfstate terraform.tfstate.backup .terraform.lock.hcl tfplan || true
134143 fi
135144
145+ # Cleanup Bicep artifacts for bicep tests
146+ if [[ " $path " == * " /bicep" ]]; then
147+ echo " Cleaning up Bicep artifacts..."
148+ # Clean up zip files if any were created
149+ rm -f * .zip || true
150+
151+ # Clean up Azure resources to prevent state pollution between tests
152+ echo " Cleaning up Azure resources in LocalStack..."
153+ if command -v azlocal > /dev/null 2>&1 ; then
154+ echo " Deleting all resource groups..."
155+ # List and delete all resource groups
156+ RG_LIST=$( azlocal group list --query " [].name" -o tsv 2> /dev/null || echo " " )
157+ if [[ -n " $RG_LIST " ]]; then
158+ echo " $RG_LIST " | while read -r rg; do
159+ if [[ -n " $rg " ]]; then
160+ echo " - Deleting resource group: $rg "
161+ azlocal group delete --name " $rg " --yes --no-wait 2> /dev/null || true
162+ fi
163+ done
164+ # Wait a bit for deletions to process
165+ sleep 2
166+ else
167+ echo " No resource groups to clean up"
168+ fi
169+ fi
170+ fi
171+
136172 popd > /dev/null
137173 echo " Completed: $path "
138174
0 commit comments