Skip to content

Commit 40cb058

Browse files
committed
VM Tests
1 parent 4c82ae6 commit 40cb058

File tree

3 files changed

+51
-0
lines changed

3 files changed

+51
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Param(
2+
[string]$resourceGroupName,
3+
[string]$resourceGroupLocation
4+
)
5+
6+
Write-Host "Skip"
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
set -e
3+
printf "\n=== Managing Virtual Machine Creation in Azure Compute ===\n"
4+
5+
printf "\n1. Creating a new resource group: %s and location: %s.\n" "$groupName" "$location"
6+
azure group create -n "$groupName" --location "$location"
7+
8+
printf "\n2. Creating a new storage account '%s' in type '%s'.\n" "$storageAccountName" "$storageAccountType"
9+
azure storage account new --resourcegroupname "$groupName" --name "$storageAccountName" --location "$location" --type "$storageAccountType"
10+
11+
printf "\n3. Create virtual network.\n"
12+
result=`azure virtual network create --resourcegroupname "$groupName" --name test --location "$location" --addressprefix "[\"10.0.0.0/16\"]" --subnet "[{\"Name\":\"test\",\"AddressPrefix\":\"10.0.0.0/24\"}]" --force`
13+
14+
contextResult=`azure context get`
15+
16+
subId=`echo $contextResult | jq '.Subscription.SubscriptionId' --raw-output`
17+
18+
subnetId="/subscriptions/$subId/resourceGroups/$groupName/providers/Microsoft.Network/virtualNetworks/test/subnets/test"
19+
20+
echo "$subnetId" > "$BASEDIR/$groupName.subnetIdFile"
21+
22+
sleep 10
23+
24+
printf "\n4. Create network interface with:\r\nsubId='%s' \r\n& \r\nsubnetId='$subnetId'.\n" "$subId"
25+
azure network interface create --name test --resourcegroupname "$groupName" --location "$location" --subnetid @"$BASEDIR/$groupName.subnetIdFile"
26+
27+
nicId="/subscriptions/$subId/resourceGroups/$groupName/providers/Microsoft.Network/networkInterfaces/test"
28+
29+
vhdUri="https://$storageAccountName.blob.core.windows.net/$storageAccountName/$storageAccountName.vhd"
30+
31+
vmStr="{\"Name\":\"test\",\"HardwareProfile\":{\"VmSize\":\"Standard_A1\"},\"NetworkProfile\":{\"NetworkInterfaces\":[{\"Id\":\"$nicId\"}]},\"OSProfile\":{\"ComputerName\":\"test\",\"AdminPassword\":\"BaR@1234\",\"AdminUsername\":\"Foo12\"},\"StorageProfile\":{\"ImageReference\":{\"Offer\":\"WindowsServer\",\"Publisher\":\"MicrosoftWindowsServer\",\"Sku\":\"2008-R2-SP1\",\"Version\":\"latest\"},\"OSDisk\":{\"Caching\":\"ReadWrite\",\"CreateOption\":\"FromImage\",\"Name\":\"osDisk\",\"Vhd\":{\"Uri\":\"$vhdUri\"}}}}"
32+
33+
printf "\n5. Create virtual machine with\r\nnicId='%s'\r\nvhdUri='%s'\r\nvmStr='%s'\n" "$nicId" "$vhdUri" "$vmStr"
34+
35+
azure vm new --resourcegroupname "$groupName" --location "$location" --vmprofile "$vmStr"
36+
37+
printf "\n6. Removing resource group: %s.\n" "$groupName"
38+
azure group remove -n "$groupName" -f

src/CLU/Commands.Common.ScenarioTest/SampleTest.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,12 @@ public void VirtualMachineSizeTest()
5252
var helper = _collectionState.GetRunner("compute-management");
5353
helper.RunScript("01-VirtualMachineSizes");
5454
}
55+
56+
[Fact]
57+
public void VirtualMachineCreationTest()
58+
{
59+
var helper = _collectionState.GetRunner("compute-management");
60+
helper.RunScript("02-VirtualMachineCreation");
61+
}
5562
}
5663
}

0 commit comments

Comments
 (0)