Skip to content

Commit 63a2d30

Browse files
committed
Merge pull request #196 from Azure/build
Merge late changes build -> ignite
2 parents c5585dc + e1c0bab commit 63a2d30

33 files changed

+9236
-1486
lines changed

src/ResourceManager/Compute/Commands.Compute.Test/Commands.Compute.Test.csproj

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,16 +146,11 @@
146146
<ItemGroup>
147147
<Compile Include="Common\ComputeTestController.cs" />
148148
<Compile Include="ScenarioTests\StorageAccountTests.cs" />
149-
<Compile Include="ScenarioTests\TestVirtualMachineImageList.cs" />
150-
<Compile Include="ScenarioTests\TestVirtualMachineList.cs" />
151-
<Compile Include="ScenarioTests\VirtualMachineDataDiskTests.cs" />
152-
<Compile Include="ScenarioTests\VirtualMachineCaptureTests.cs" />
153149
<Compile Include="ScenarioTests\VirtualMachineProfileTests.cs" />
154150
<Compile Include="ScenarioTests\AvailabilitySetTests.cs" />
155151
<Compile Include="ScenarioTests\VirtualMachineExtensionTests.cs" />
156152
<Compile Include="ScenarioTests\VirtualMachineNetworkInterfaceTests.cs" />
157-
<Compile Include="ScenarioTests\TestVirtualMachineSizeAndUsage.cs" />
158-
<Compile Include="ScenarioTests\VirtualMachinePIRv2Tests.cs" />
153+
<Compile Include="ScenarioTests\UtilityFunctionTests.cs" />
159154
<Compile Include="ScenarioTests\VirtualMachineTests.cs" />
160155
<Compile Include="Properties\Resources.Designer.cs">
161156
<AutoGen>True</AutoGen>
@@ -288,6 +283,12 @@
288283
<None Include="SessionRecords\Microsoft.Azure.Commands.Compute.Test.ScenarioTests.VirtualMachineTests\TestVirtualMachinePIRv2.json">
289284
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
290285
</None>
286+
<None Include="SessionRecords\Microsoft.Azure.Commands.Compute.Test.ScenarioTests.VirtualMachineTests\TestVirtualMachinePlan.json">
287+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
288+
</None>
289+
<None Include="SessionRecords\Microsoft.Azure.Commands.Compute.Test.ScenarioTests.VirtualMachineTests\TestVirtualMachinePlan2.json">
290+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
291+
</None>
291292
<None Include="SessionRecords\Microsoft.Azure.Commands.Compute.Test.ScenarioTests.VirtualMachineTests\TestVirtualMachineSizeAndUsage.json">
292293
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
293294
</None>

src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/ComputeTestCommon.ps1

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,28 @@ function Get-ComputeTestResourceName
2828
}
2929
}
3030

31-
$assetName = [Microsoft.Azure.Test.HttpRecorder.HttpMockServer]::GetAssetName($testName, "pstestrg")
31+
$oldErrorActionPreferenceValue = $ErrorActionPreference;
32+
$ErrorActionPreference = "SilentlyContinue";
33+
34+
try
35+
{
36+
$assetName = [Microsoft.Azure.Test.HttpRecorder.HttpMockServer]::GetAssetName($testName, "pstestrg");
37+
}
38+
catch
39+
{
40+
if (($Error.Count -gt 0) -and ($Error[0].Exception.Message -like '*Unable to find type*'))
41+
{
42+
$assetName = Get-RandomItemName;
43+
}
44+
else
45+
{
46+
throw;
47+
}
48+
}
49+
finally
50+
{
51+
$ErrorActionPreference = $oldErrorActionPreferenceValue;
52+
}
3253

3354
return $assetName
3455
}
@@ -144,7 +165,7 @@ function Get-DefaultRDFEImage
144165

145166
<#
146167
.SYNOPSIS
147-
Gets default RDFE Image
168+
Gets default CRP Image
148169
#>
149170
function Get-DefaultCRPImage
150171
{
@@ -195,6 +216,19 @@ function Get-DefaultCRPImage
195216
return $vmimg;
196217
}
197218

219+
<#
220+
.SYNOPSIS
221+
Gets VMM Images
222+
#>
223+
function Get-MarketplaceImage
224+
{
225+
param([string] $location = "eastasia", [string] $pubFilter = '*', [string] $offerFilter = '*')
226+
227+
$imgs = Get-AzureVMImagePublisher -Location $location | where { $_.PublisherName -like $pubFilter } | Get-AzureVMImageOffer | where { $_.Offer -like $offerFilter } | Get-AzureVMImageSku | Get-AzureVMImage | Get-AzureVMImageDetail | where { $_.PurchasePlan -ne $null };
228+
229+
return $imgs;
230+
}
231+
198232
<#
199233
.SYNOPSIS
200234
Gets default VM config object

src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/TestVirtualMachineSizeAndUsage.cs

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,36 @@
1313
// ----------------------------------------------------------------------------------
1414

1515
using Microsoft.WindowsAzure.Commands.ScenarioTest;
16+
using Microsoft.Azure.Commands.Compute.Models;
17+
using System;
1618
using Xunit;
1719

1820
namespace Microsoft.Azure.Commands.Compute.Test.ScenarioTests
1921
{
20-
public partial class VirtualMachineTests
22+
public class UtilityFunctionTests
2123
{
2224
[Fact]
2325
[Trait(Category.AcceptanceType, Category.CheckIn)]
24-
public void TestVirtualMachineImageList()
26+
public void TestLocationStringExtension()
2527
{
26-
ComputeTestController.NewInstance.RunPsTest("Test-VirtualMachineImageList");
28+
string[] locations = new string[]
29+
{
30+
"West US",
31+
"eastus",
32+
"East Asia 2"
33+
};
34+
35+
Func<string, string> normalize = delegate(string s)
36+
{
37+
return string.IsNullOrEmpty(s) ? s : s.Replace(" ", string.Empty).ToLower();
38+
};
39+
40+
foreach (var loc in locations)
41+
{
42+
var s1 = loc.Canonicalize();
43+
var s2 = normalize(loc);
44+
Assert.True(string.Equals(s1, s2));
45+
}
2746
}
2847
}
2948
}

src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineCaptureTests.cs

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineDataDiskTests.cs

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineNetworkInterfaceTests.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ function Test-SingleNetworkInterface
102102
# Image Reference;
103103
$p.StorageProfile.SourceImage = $null;
104104
$imgRef = Get-DefaultCRPImage;
105-
$p = Set-AzureVMSourceImage -VM $p -ImageReference $imgRef;
105+
$p = ($imgRef | Set-AzureVMSourceImage -VM $p);
106106
Assert-NotNull $p.StorageProfile.ImageReference;
107107
Assert-Null $p.StorageProfile.SourceImageId;
108108

@@ -208,7 +208,7 @@ function Test-SingleNetworkInterfaceDnsSettings
208208
# Image Reference;
209209
$p.StorageProfile.SourceImage = $null;
210210
$imgRef = Get-DefaultCRPImage;
211-
$p = Set-AzureVMSourceImage -VM $p -ImageReference $imgRef;
211+
$p = ($imgRef | Set-AzureVMSourceImage -VM $p);
212212
Assert-NotNull $p.StorageProfile.ImageReference;
213213
Assert-Null $p.StorageProfile.SourceImageId;
214214

@@ -318,7 +318,7 @@ function Test-MultipleNetworkInterface
318318
# Image Reference;
319319
$p.StorageProfile.SourceImage = $null;
320320
$imgRef = Get-DefaultCRPImage;
321-
$p = Set-AzureVMSourceImage -VM $p -ImageReference $imgRef;
321+
$p = ($imgRef | Set-AzureVMSourceImage -VM $p);
322322
Assert-NotNull $p.StorageProfile.ImageReference;
323323
Assert-Null $p.StorageProfile.SourceImageId;
324324

src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachinePIRv2Tests.cs

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineTests.cs

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,61 @@ public void TestVirtualMachine()
2525
{
2626
ComputeTestController.NewInstance.RunPsTest("Test-VirtualMachine");
2727
}
28+
29+
[Fact]
30+
[Trait(Category.AcceptanceType, Category.CheckIn)]
31+
public void TestVirtualMachineImageList()
32+
{
33+
ComputeTestController.NewInstance.RunPsTest("Test-VirtualMachineImageList");
34+
}
35+
36+
[Fact]
37+
[Trait(Category.AcceptanceType, Category.CheckIn)]
38+
public void TestVirtualMachineList()
39+
{
40+
ComputeTestController.NewInstance.RunPsTest("Test-VirtualMachineList");
41+
}
42+
43+
[Fact]
44+
[Trait(Category.AcceptanceType, Category.CheckIn)]
45+
public void TestVirtualMachineSizeAndUsage()
46+
{
47+
ComputeTestController.NewInstance.RunPsTest("Test-VirtualMachineSizeAndUsage");
48+
}
49+
50+
[Fact]
51+
[Trait(Category.AcceptanceType, Category.CheckIn)]
52+
public void TestVirtualMachineCapture()
53+
{
54+
ComputeTestController.NewInstance.RunPsTest("Test-VirtualMachineCapture");
55+
}
56+
57+
[Fact]
58+
[Trait(Category.AcceptanceType, Category.CheckIn)]
59+
public void TestVirtualMachineDataDisk()
60+
{
61+
ComputeTestController.NewInstance.RunPsTest("Test-VirtualMachineDataDisk");
62+
}
63+
64+
[Fact]
65+
[Trait(Category.AcceptanceType, Category.CheckIn)]
66+
public void TestVirtualMachinePIRv2()
67+
{
68+
ComputeTestController.NewInstance.RunPsTest("Test-VirtualMachinePIRv2");
69+
}
70+
71+
[Fact]
72+
[Trait(Category.AcceptanceType, Category.CheckIn)]
73+
public void TestVirtualMachinePlan()
74+
{
75+
ComputeTestController.NewInstance.RunPsTest("Test-VirtualMachinePlan");
76+
}
77+
78+
[Fact]
79+
[Trait(Category.AcceptanceType, Category.CheckIn)]
80+
public void TestVirtualMachinePlan2()
81+
{
82+
ComputeTestController.NewInstance.RunPsTest("Test-VirtualMachinePlan2");
83+
}
2884
}
2985
}

0 commit comments

Comments
 (0)