Skip to content

Commit

Permalink
Merge pull request Azure#34 from huangpf/crp2
Browse files Browse the repository at this point in the history
Fix Compute Tests
  • Loading branch information
AzureRT committed Apr 4, 2015
2 parents be29c74 + cafb979 commit 686259b
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 64 deletions.
16 changes: 0 additions & 16 deletions setup/azurecmdfiles.wxi
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,6 @@
</Component>
</Directory>
<Directory Id="dir130578A4F470BDF58FEC794CB8389E91" Name="Compute">
<Component Id="cmp9F0624F1A60FEC6C92BD00C0FF6D3687" Guid="*">
<File Id="fil0F1880F9AF225B647105636C1209B2AD" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\Compute\AutoMapper.dll" />
</Component>
<Component Id="cmp8114720BD4403889B36408A1E7F419B1" Guid="*">
<File Id="fil5A8265B48813A0104CB5DEEDA9CEAEAA" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\Compute\AutoMapper.Net4.dll" />
</Component>
<Component Id="cmp1A9472BC4D15B6030BB6F05D11229806" Guid="*">
<File Id="filF0631AB8794D12700657664AC8441ACA" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\Compute\Hyak.Common.dll" />
</Component>
Expand Down Expand Up @@ -483,9 +477,6 @@
<Component Id="cmp376056F5367B9E5C189D8A246AFA0C97" Guid="*">
<File Id="filB9CCFF18187D11B090CC1D2F8C043600" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\NetworkResourceProvider\Microsoft.Azure.Management.Storage.dll" />
</Component>
<Component Id="cmp143934D4D6CF1D6494CCBEAB5587D90C" Guid="*">
<File Id="filAC769B36278D851238820D0CA032D9C0" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\NetworkResourceProvider\Microsoft.Azure.ResourceManager.dll" />
</Component>
<Component Id="cmp991B96F3B4C28D882491FA0E36AE2700" Guid="*">
<File Id="fil6C20A34C8E0239AE4D767C3527D93A0A" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\NetworkResourceProvider\Microsoft.Data.Edm.dll" />
</Component>
Expand Down Expand Up @@ -2610,9 +2601,6 @@
<Component Id="cmp3AC709C29C5C98FAE63EC5ACF073B2AF" Guid="*">
<File Id="filBD421847424CAE48F72C74C69770D8C0" KeyPath="yes" Source="$(var.sourceDir)\ServiceManagement\Azure\StorSimple\Microsoft.Azure.Common.NetFramework.dll" />
</Component>
<Component Id="cmpF584FEE91889D98A4299209A1B9B1B94" Guid="*">
<File Id="fil1E84C52FC3BA4FCD7D38DF81574031BC" KeyPath="yes" Source="$(var.sourceDir)\ServiceManagement\Azure\StorSimple\Microsoft.Azure.ResourceManager.dll" />
</Component>
<Component Id="cmp9E03AAB684EA41B087D79346AE6C1073" Guid="*">
<File Id="fil501FE0FB963E03A9292BE5CC5A895CBB" KeyPath="yes" Source="$(var.sourceDir)\ServiceManagement\Azure\StorSimple\Microsoft.IdentityModel.Clients.ActiveDirectory.dll" />
</Component>
Expand Down Expand Up @@ -2767,8 +2755,6 @@
<ComponentRef Id="cmp23BAA5F27F989B6A570DA6BAB5AF6468" />
<ComponentRef Id="cmpEE1426977F06792DC1DF6EC28AA3443B" />
<ComponentRef Id="cmp512146B64C58DFB3AB394B1E97621A38" />
<ComponentRef Id="cmp9F0624F1A60FEC6C92BD00C0FF6D3687" />
<ComponentRef Id="cmp8114720BD4403889B36408A1E7F419B1" />
<ComponentRef Id="cmp1A9472BC4D15B6030BB6F05D11229806" />
<ComponentRef Id="cmpEDFE5B7CD43B10FD4C5F82D443DA0C5D" />
<ComponentRef Id="cmp7F2719BE7827D3FDDF69D7ACB6135115" />
Expand Down Expand Up @@ -2895,7 +2881,6 @@
<ComponentRef Id="cmpA51A23FDB8743E3EE5338D2FBA1CBD59" />
<ComponentRef Id="cmp02282C55620BE455F3DA6F0140F930DB" />
<ComponentRef Id="cmp376056F5367B9E5C189D8A246AFA0C97" />
<ComponentRef Id="cmp143934D4D6CF1D6494CCBEAB5587D90C" />
<ComponentRef Id="cmp991B96F3B4C28D882491FA0E36AE2700" />
<ComponentRef Id="cmp89B95B277B2F95B7715CDC501EA8EB3E" />
<ComponentRef Id="cmpDAFB0D394D32CC8F7F173DD044C1F4CE" />
Expand Down Expand Up @@ -3580,7 +3565,6 @@
<ComponentRef Id="cmp844CE71A108EFCC5B93A410D5205E6DB" />
<ComponentRef Id="cmp6A927AFF9D7CBE438F31603C59A5D1A6" />
<ComponentRef Id="cmp3AC709C29C5C98FAE63EC5ACF073B2AF" />
<ComponentRef Id="cmpF584FEE91889D98A4299209A1B9B1B94" />
<ComponentRef Id="cmp9E03AAB684EA41B087D79346AE6C1073" />
<ComponentRef Id="cmpEC794DBE4822765C546A06D80EAA3292" />
<ComponentRef Id="cmpB48F1BD4D2E8307615F7E22174FF4E6D" />
Expand Down
1 change: 1 addition & 0 deletions src/AzurePowershell.sln
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Compute", "ResourceManager\Compute\Commands.Compute\Commands.Compute.csproj", "{52643BD5-6378-49BD-9F6E-DAC9DD8A867B}"
ProjectSection(ProjectDependencies) = postProject
{98CFD96B-A6BC-4F15-AE2C-603FC2B58981} = {98CFD96B-A6BC-4F15-AE2C-603FC2B58981}
{E1CA72BA-8374-45F6-904D-FD34ECDF5B6F} = {E1CA72BA-8374-45F6-904D-FD34ECDF5B6F}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Compute.Test", "ResourceManager\Compute\Commands.Compute.Test\Commands.Compute.Test.csproj", "{37C44181-3F1B-4ABD-8089-26DFAB4B6BA8}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,27 +46,27 @@
<HintPath>..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Common">
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.0.4\lib\net45\Microsoft.Azure.Common.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Common.Authentication, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.17-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.18-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Common.NetFramework">
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.0.4\lib\net45\Microsoft.Azure.Common.NetFramework.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Gallery">
<HintPath>..\..\..\packages\Microsoft.Azure.Gallery.2.6.2-preview\lib\net40\Microsoft.Azure.Gallery.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Graph.RBAC">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Azure.Graph.RBAC.1.6.0-preview\lib\net40\Microsoft.Azure.Graph.RBAC.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.Azure.Graph.RBAC.1.7.0-preview\lib\net40\Microsoft.Azure.Graph.RBAC.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Management.Authorization">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.0.17.0-preview\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.0.18.0-preview\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.ResourceManager">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Resources.2.14.1-preview\lib\net40\Microsoft.Azure.ResourceManager.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Test.Framework">
<HintPath>..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5562.19686-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll</HintPath>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ function Test-VirtualMachineExtension
Assert-AreEqual $p.HardwareProfile.VirtualMachineSize $vmsize;

# NRP
$subnet = New-AzureVirtualNetworkSubnetConfig -Name ('subnet' + $rgname) -AddressPrefix "10.0.0.0/24" -DnsServer "10.1.1.1";
$subnet = New-AzureVirtualNetworkSubnetConfig -Name ('subnet' + $rgname) -AddressPrefix "10.0.0.0/24";
$vnet = New-AzureVirtualNetwork -Force -Name ('vnet' + $rgname) -ResourceGroupName $rgname -Location $loc -AddressPrefix "10.0.0.0/16" -DnsServer "10.1.1.1" -Subnet $subnet;
$vnet = Get-AzureVirtualNetwork -Name ('vnet' + $rgname) -ResourceGroupName $rgname;
$subnetId = $vnet.Properties.Subnets[0].Id;
$subnetId = $vnet.Subnets[0].Id;
$pubip = New-AzurePublicIpAddress -Force -Name ('pubip' + $rgname) -ResourceGroupName $rgname -Location $loc -AllocationMethod Dynamic -DomainNameLabel ('pubip' + $rgname);
$pubip = Get-AzurePublicIpAddress -Name ('pubip' + $rgname) -ResourceGroupName $rgname;
$pubipId = $pubip.Id;
$nic = New-AzureNetworkInterface -Force -Name ('nic' + $rgname) -ResourceGroupName $rgname -Location $loc -AllocationMethod Dynamic -SubnetId $subnetId -PublicIpAddressId $pubip.Id;
$nic = New-AzureNetworkInterface -Force -Name ('nic' + $rgname) -ResourceGroupName $rgname -Location $loc -SubnetId $subnetId -PublicIpAddressId $pubip.Id;
$nic = Get-AzureNetworkInterface -Name ('nic' + $rgname) -ResourceGroupName $rgname;
$nicId = $nic.Id;

Expand Down Expand Up @@ -83,7 +83,7 @@ function Test-VirtualMachineExtension
Assert-AreEqual $p.StorageProfile.DataDisks[1].Lun 1;
Assert-AreEqual $p.StorageProfile.DataDisks[1].VirtualHardDisk.Uri $dataDiskVhdUri2;

# OS
# OS & Image
$user = "Foo12";
$password = 'BaR@123' + $rgname;
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force;
Expand Down Expand Up @@ -117,7 +117,7 @@ function Test-VirtualMachineExtension
$settingstr = '{"fileUris":[],"commandToExecute":""}';
$protectedsettingstr = '{"storageAccountName":"' + $stoname + '","storageAccountKey":"' + $stokey + '"}';
Set-AzureVMExtension -ResourceGroupName $rgname -Location $loc -VMName $vmname -Name $extname -Publisher $publisher -Type $exttype -TypeHandlerVersion $extver -SettingString $settingstr -ProtectedSettingString $protectedsettingstr;

# Get VM Extension
$ext = Get-AzureVMExtension -ResourceGroupName $rgname -VMName $vmname -Name $extname;
Assert-AreEqual $ext.ResourceGroupName $rgname;
Expand All @@ -127,7 +127,7 @@ function Test-VirtualMachineExtension
Assert-AreEqual $ext.TypeHandlerVersion $extver;
Assert-AreEqual $ext.ResourceGroupName $rgname;
Assert-NotNull $ext.ProvisioningState;

$ext = Get-AzureVMExtension -ResourceGroupName $rgname -VMName $vmname -Name $extname -Status;
Assert-AreEqual $ext.ResourceGroupName $rgname;
Assert-AreEqual $ext.Name $extname;
Expand All @@ -137,7 +137,7 @@ function Test-VirtualMachineExtension
Assert-AreEqual $ext.ResourceGroupName $rgname;
Assert-NotNull $ext.ProvisioningState;
Assert-NotNull $ext.Statuses;

# Set extension settings by hash table
$settings = @{"fileUris" = "[]"; "commandToExecute" = ""};
$protectedsettings = @{"storageAccountName" = $stoname; "storageAccountKey" = $stokey};
Expand All @@ -152,7 +152,7 @@ function Test-VirtualMachineExtension
Assert-AreEqual $ext.TypeHandlerVersion $extver;
Assert-AreEqual $ext.ResourceGroupName $rgname;
Assert-NotNull $ext.ProvisioningState;

$ext = Get-AzureVMExtension -ResourceGroupName $rgname -VMName $vmname -Name $extname -Status;
Assert-AreEqual $ext.ResourceGroupName $rgname;
Assert-AreEqual $ext.Name $extname;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,22 @@ function Test-VirtualMachine
Assert-AreEqual $p.HardwareProfile.VirtualMachineSize $vmsize;

# NRP
$subnet = New-AzureVirtualNetworkSubnetConfig -Name ('subnet' + $rgname) -AddressPrefix "10.0.0.0/24" -DnsServer "10.1.1.1";
$subnet = New-AzureVirtualNetworkSubnetConfig -Name ('subnet' + $rgname) -AddressPrefix "10.0.0.0/24";
$vnet = New-AzureVirtualNetwork -Force -Name ('vnet' + $rgname) -ResourceGroupName $rgname -Location $loc -AddressPrefix "10.0.0.0/16" -DnsServer "10.1.1.1" -Subnet $subnet;
$vnet = Get-AzureVirtualNetwork -Name ('vnet' + $rgname) -ResourceGroupName $rgname;
$subnetId = $vnet.Properties.Subnets[0].Id;
$subnetId = $vnet.Subnets[0].Id;
$pubip = New-AzurePublicIpAddress -Force -Name ('pubip' + $rgname) -ResourceGroupName $rgname -Location $loc -AllocationMethod Dynamic -DomainNameLabel ('pubip' + $rgname);
$pubip = Get-AzurePublicIpAddress -Name ('pubip' + $rgname) -ResourceGroupName $rgname;
$pubipId = $pubip.Id;
$nic = New-AzureNetworkInterface -Force -Name ('nic' + $rgname) -ResourceGroupName $rgname -Location $loc -AllocationMethod Dynamic -SubnetId $subnetId -PublicIpAddressId $pubip.Id;
$nic = New-AzureNetworkInterface -Force -Name ('nic' + $rgname) -ResourceGroupName $rgname -Location $loc -SubnetId $subnetId -PublicIpAddressId $pubip.Id;
$nic = Get-AzureNetworkInterface -Name ('nic' + $rgname) -ResourceGroupName $rgname;
$nicId = $nic.Id;

$p = Add-AzureVMNetworkInterface -VM $p -Id $nicId;
Assert-AreEqual $p.NetworkProfile.NetworkInterfaces.Count 1;
Assert-AreEqual $p.NetworkProfile.NetworkInterfaces[0].ReferenceUri $nicId;

# Storage
# Storage Account (SA)
$stoname = 'sto' + $rgname;
$stotype = 'Standard_GRS';
New-AzureStorageAccount -ResourceGroupName $rgname -Name $stoname -Location $loc -Type $stotype;
Expand Down Expand Up @@ -90,11 +90,11 @@ function Test-VirtualMachine
$computerName = 'test';
$vhdContainer = "https://$stoname.blob.core.windows.net/test";
$img = 'a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-Datacenter-201410.01-en.us-127GB.vhd';

$p.StorageProfile.OSDisk = $null;
$p = Set-AzureVMOperatingSystem -VM $p -Windows -ComputerName $computerName -Credential $cred;
$p = Set-AzureVMSourceImage -VM $p -Name $img -DestinationVhdsContainer $vhdContainer;

Assert-AreEqual $p.OSProfile.AdminUsername $user;
Assert-AreEqual $p.OSProfile.ComputerName $computerName;
Assert-AreEqual $p.OSProfile.AdminPassword $password;
Expand All @@ -105,6 +105,7 @@ function Test-VirtualMachine
# TODO: Still need to do retry for New-AzureVM for SA, even it's returned in Get-.
New-AzureVM -ResourceGroupName $rgname -Location $loc -Name $vmname -VM $p;

# Get VM
$vm1 = Get-AzureVM -Name $vmname -ResourceGroupName $rgname;
Assert-AreEqual $vm1.Name $vmname;
Assert-AreEqual $vm1.NetworkProfile.NetworkInterfaces.Count 1;
Expand Down Expand Up @@ -168,7 +169,6 @@ function Test-VirtualMachine

# Remove
Remove-AzureVM -Name $vmname2 -ResourceGroupName $rgname -Force;

}
finally
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Hyak.Common" version="1.0.2" targetFramework="net45" />
<package id="Microsoft.Azure.Common" version="2.0.4" targetFramework="net45" />
<package id="Microsoft.Azure.Common.Authentication" version="1.0.17-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Common" version="2.1.0" targetFramework="net45" />
<package id="Microsoft.Azure.Common.Authentication" version="1.0.18-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.Azure.Gallery" version="2.6.2-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Graph.RBAC" version="1.6.0-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Authorization" version="0.17.0-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Resources" version="2.14.1-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Graph.RBAC" version="1.7.0-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Authorization" version="0.18.0-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Resources" version="2.18.0-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Test.Framework" version="1.0.5562.19686-prerelease" targetFramework="net45" />
<package id="Microsoft.Azure.Test.HttpRecorder" version="1.0.5562.19686-prerelease" targetFramework="net45" />
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net45" />
Expand Down
Loading

0 comments on commit 686259b

Please sign in to comment.