Skip to content

Update Compute library to Swagger-generated one #1579

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jan 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@
<Reference Include="Microsoft.Azure.Management.Authorization">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.2.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Management.Compute, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Reference Include="Microsoft.Azure.Management.Compute">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Compute.9.1.0\lib\net40\Microsoft.Azure.Management.Compute.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Compute.11.1.0-prerelease\lib\net45\Microsoft.Azure.Management.Compute.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.Management.Network, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
Expand Down Expand Up @@ -205,7 +205,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\Common\Commands.ScenarioTests.Common\Assert.ps1">
<None Include="..\..\Common\Commands.ScenarioTests.ResourceManager.Common\Assert.ps1">
<Link>ScenarioTests\Assert.ps1</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ private void SetupManagementClients(RestTestFramework.MockContext context)
GalleryClient = GetGalleryClient();
//var eventsClient = GetEventsClient();
NetworkManagementClient = this.GetNetworkManagementClientClient(context);
ComputeManagementClient = GetComputeManagementClient();
ComputeManagementClient = GetComputeManagementClient(context);
AuthorizationManagementClient = GetAuthorizationManagementClient();
GraphClient = GetGraphClient();

Expand Down Expand Up @@ -242,10 +242,10 @@ private NetworkManagementClient GetNetworkManagementClientClient(RestTestFramewo
: TestBase.GetServiceClient<NetworkManagementClient>(new RDFETestEnvironmentFactory());
}

private ComputeManagementClient GetComputeManagementClient()
private ComputeManagementClient GetComputeManagementClient(RestTestFramework.MockContext context)
{
return testViaCsm
? TestBase.GetServiceClient<ComputeManagementClient>(this.csmTestFactory)
? context.GetServiceClient<ComputeManagementClient>(RestTestFramework.TestEnvironmentFactory.GetTestEnvironment())
: TestBase.GetServiceClient<ComputeManagementClient>(new RDFETestEnvironmentFactory());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// ----------------------------------------------------------------------------------

using Hyak.Common;
using Microsoft.Azure.Commands.Compute.Common;
using Microsoft.WindowsAzure.Commands.Common;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Xunit;
Expand All @@ -26,31 +27,31 @@ public class ComputeCloudExceptionTests
public void RunComputeCloudExceptionTests()
{
// Message Only
var ex1 = new CloudException("Test1");
var ex1 = new Rest.Azure.CloudException("Test1");
var cx1 = new ComputeCloudException(ex1);
Assert.True(string.Equals(cx1.Message, ex1.Message));
Assert.True(cx1.InnerException is CloudException);
Assert.True(cx1.InnerException is Rest.Azure.CloudException);
Assert.True(string.Equals(cx1.InnerException.Message, ex1.Message));

// Message + Inner Exception
var ex2 = new CloudException("Test2", ex1);
var ex2 = new Rest.Azure.CloudException("Test2", ex1);
var cx2 = new ComputeCloudException(ex2);
Assert.True(string.Equals(cx2.Message, ex2.Message));
Assert.True(cx2.InnerException is CloudException);
Assert.True(cx2.InnerException is Rest.Azure.CloudException);
Assert.True(string.Equals(cx2.InnerException.Message, ex2.Message));

// Empty Message
var ex3 = new CloudException(string.Empty);
var ex3 = new Rest.Azure.CloudException(string.Empty);
var cx3 = new ComputeCloudException(ex3);
Assert.True(string.IsNullOrEmpty(cx3.Message));
Assert.True(cx3.InnerException is CloudException);
Assert.True(cx3.InnerException is Rest.Azure.CloudException);
Assert.True(string.IsNullOrEmpty(cx3.InnerException.Message));

// Default message is used, if 'null' passed to the constructor.
var ex4 = new CloudException(null);
var ex4 = new Rest.Azure.CloudException(null);
var cx4 = new ComputeCloudException(ex4);
Assert.True(!string.IsNullOrEmpty(cx4.Message));
Assert.True(cx4.InnerException is CloudException);
Assert.True(cx4.InnerException is Rest.Azure.CloudException);
Assert.True(!string.IsNullOrEmpty(cx4.InnerException.Message));

ComputeTestController.NewInstance.RunPsTest("Run-ComputeCloudExceptionTests");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function Run-ComputeCloudExceptionTests
$loc = Get-ComputeVMLocation;
New-AzureRmResourceGroup -Name $rgname -Location $loc -Force;

$compare = "Resource*NotFound*OperationID : `'*`'";
$compare = "*Resource*not found*OperationID : `'*`'";
Assert-ThrowsLike { $s1 = Get-AzureRmVM -ResourceGroupName $rgname -Name 'test' } $compare;
Assert-ThrowsLike { $s2 = Get-AzureRmVM -ResourceGroupName 'foo' -Name 'bar' } $compare;
Assert-ThrowsLike { $s3 = Get-AzureRmAvailabilitySet -ResourceGroupName $rgname -Name 'test' } $compare;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ function Create-VirtualMachine($rgname, $vmname, $loc)
# VM Profile & Hardware
$vmsize = 'Standard_A2';
$p = New-AzureRmVMConfig -VMName $vmname -VMSize $vmsize;
Assert-AreEqual $p.HardwareProfile.VirtualMachineSize $vmsize;
Assert-AreEqual $p.HardwareProfile.VmSize $vmsize;

# NRP
$subnet = New-AzureRmVirtualNetworkSubnetConfig -Name ('subnet' + $rgname) -AddressPrefix "10.0.0.0/24";
Expand All @@ -136,7 +136,7 @@ function Create-VirtualMachine($rgname, $vmname, $loc)

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

# Storage Account (SA)
$stoname = 'sto' + $rgname;
Expand All @@ -159,18 +159,18 @@ function Create-VirtualMachine($rgname, $vmname, $loc)
$p = Add-AzureRmVMDataDisk -VM $p -Name 'testDataDisk3' -Caching 'ReadOnly' -DiskSizeInGB 12 -Lun 3 -VhdUri $dataDiskVhdUri3 -CreateOption Empty;
$p = Remove-AzureRmVMDataDisk -VM $p -Name 'testDataDisk3';

Assert-AreEqual $p.StorageProfile.OSDisk.Caching $osDiskCaching;
Assert-AreEqual $p.StorageProfile.OSDisk.Name $osDiskName;
Assert-AreEqual $p.StorageProfile.OSDisk.VirtualHardDisk.Uri $osDiskVhdUri;
Assert-AreEqual $p.StorageProfile.OsDisk.Caching $osDiskCaching;
Assert-AreEqual $p.StorageProfile.OsDisk.Name $osDiskName;
Assert-AreEqual $p.StorageProfile.OsDisk.Vhd.Uri $osDiskVhdUri;
Assert-AreEqual $p.StorageProfile.DataDisks.Count 2;
Assert-AreEqual $p.StorageProfile.DataDisks[0].Caching 'ReadOnly';
Assert-AreEqual $p.StorageProfile.DataDisks[0].DiskSizeGB 10;
Assert-AreEqual $p.StorageProfile.DataDisks[0].Lun 1;
Assert-AreEqual $p.StorageProfile.DataDisks[0].VirtualHardDisk.Uri $dataDiskVhdUri1;
Assert-AreEqual $p.StorageProfile.DataDisks[0].Vhd.Uri $dataDiskVhdUri1;
Assert-AreEqual $p.StorageProfile.DataDisks[1].Caching 'ReadOnly';
Assert-AreEqual $p.StorageProfile.DataDisks[1].DiskSizeGB 11;
Assert-AreEqual $p.StorageProfile.DataDisks[1].Lun 2;
Assert-AreEqual $p.StorageProfile.DataDisks[1].VirtualHardDisk.Uri $dataDiskVhdUri2;
Assert-AreEqual $p.StorageProfile.DataDisks[1].Vhd.Uri $dataDiskVhdUri2;

# OS & Image
$user = "Foo12";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function Test-GetAzureRmVMDscExtension
$vmsize = 'Standard_A2';
$vmname = 'vm' + $rgname;
$p = New-AzureRmVMConfig -VMName $vmname -VMSize $vmsize;
Assert-AreEqual $p.HardwareProfile.VirtualMachineSize $vmsize;
Assert-AreEqual $p.HardwareProfile.VmSize $vmsize;

# NRP
$subnet = New-AzureRmVirtualNetworkSubnetConfig -Name ('subnet' + $rgname) -AddressPrefix "10.0.0.0/24";
Expand All @@ -39,7 +39,7 @@ function Test-GetAzureRmVMDscExtension

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

# Storage Account
$stoname = 'sto' + $rgname;
Expand Down
Loading