Skip to content

Commit bda40bf

Browse files
committed
Update Tests
1 parent 99623cf commit bda40bf

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

examples/compute-management/01-VirtualMachineSizes.sh

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,39 @@
22
set -e
33
printf "\n=== Managing Virtual Machine Sizes in Azure Compute ===\n"
44

5-
printf "\nShowing VM size results in location: %s.\n" "$location"
5+
printf "\n1. Showing VM size results in location: %s.\n" "$location"
66
azure vmsize get --location "$location"
77

8-
printf "\nChecking VM size results in location: %s.\n" "$location"
8+
printf "\n2. Checking VM size results in location: %s.\n" "$location"
99
vmSizeResult=`azure vmsize get --location "$location"`
1010

11-
if [ "$vmSizeResult" = "" ]; then
11+
if [[ $vmSizeResult == "" ]]; then
1212
echo "Failure: No VM sizes!" 1>&2
1313
exit 1
1414
else
15-
printf "\nSuccess: Non-empty Results.\n"
15+
echo "Success: Non-empty Results."
1616
fi
1717

18-
queryString=Standard_A0
19-
result=`echo "$vmSizeResult" | grep -q "$queryString"`
20-
if [ "$vmSizeResult" = "" ] ; then
21-
printf "\nFailure: VM Size Not Found: '%s'.\n" "$queryString"
18+
filterResult=`azure vmsize get --location "$location" | cat | jq 'select(.name | contains("Standard_A0"))' --raw-output`
19+
if [[ "$filterResult" == "" ]]; then
20+
echo "Failure: Standard_A0 vm size not found." 1>&2
2221
exit 1
2322
else
24-
printf "\nSuccess: VM Size Found in Results: '%s'.\n" "$queryString"
23+
echo "Success: Standard_A0 vm size found."
2524
fi
2625

27-
queryString=Standard_G1
28-
result=`echo "$vmSizeResult" | grep -q "$queryString"`
29-
if [ "$vmSizeResult" = "" ] ; then
30-
printf "\nFailure: VM Size Not Found: '%s'.\n" "$queryString"
26+
filterResult=`azure vmsize get --location "$location" | cat | jq 'select(.name | contains("Standard_G1"))' --raw-output`
27+
if [[ "$filterResult" == "" ]]; then
28+
echo "Failure: Standard_G1 vm size not found." 1>&2
3129
exit 1
3230
else
33-
printf "\nSuccess: VM Size Found in Results: '%s'.\n" "$queryString"
31+
echo "Success: Standard_G1 vm size found."
3432
fi
33+
34+
filterResult=`azure vmsize get --location "$location" | cat | jq 'select(.name | contains("NonStandard_A1"))' --raw-output`
35+
if [[ "$filterResult" == "" ]]; then
36+
echo "Success: NonStandard_A1 vm size not found."
37+
else
38+
echo "Failure: NonStandard_A1 vm size found." 1>&2
39+
exit 1
40+
fi

0 commit comments

Comments
 (0)