Skip to content

Commit 46d05d1

Browse files
committed
Merge pull request #22 from huangpf/dev
AzureRT PR - S50
2 parents bc99988 + 97b91b3 commit 46d05d1

File tree

41 files changed

+4777
-2373
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+4777
-2373
lines changed

src/Common/Commands.ScenarioTest/Commands.ScenarioTest.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,9 @@
203203
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ScenarioTest.AutomationTests\TestAutomationSuspendAndResumeJob.json">
204204
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
205205
</None>
206+
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ScenarioTest.AzureVMTests\TestGetAzureLocation.json">
207+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
208+
</None>
206209
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ScenarioTest.AzureVMTests\TestGetAzureVM.json">
207210
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
208211
</None>
@@ -287,6 +290,7 @@
287290
<Compile Include="Resources\ResourceLocator.cs" />
288291
<Compile Include="Scheduler\SchedulerTests.cs" />
289292
<Compile Include="ServiceBusTests\ServiceBusAuthorizationRuleTests.cs" />
293+
<Compile Include="ServiceManagement\GetLocationTests.cs" />
290294
<Compile Include="ServiceManagement\GetVMTests.cs" />
291295
<Compile Include="StorageTests\StorageContainerTest.cs" />
292296
<Compile Include="StorageTests\StorageContextTest.cs" />

src/Common/Commands.ScenarioTest/Resources/ServiceManagement/AzureVMTests.ps1

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,52 @@
1212
# limitations under the License.
1313
# ----------------------------------------------------------------------------------
1414

15-
########################################################################### Create-AzureVM Scenario Tests ###########################################################################
16-
1715
<#
1816
.SYNOPSIS
1917
Tests Create-AzureVM with valid information.
2018
#>
2119
function Test-GetAzureVM
2220
{
23-
# Setup
21+
# Setup
2422

25-
$location = Get-DefaultLocation
26-
$imgName = Get-DefaultImage $location
23+
$location = Get-DefaultLocation
24+
$imgName = Get-DefaultImage $location
2725

2826

29-
$storageName = getAssetName
30-
New-AzureStorageAccount -StorageAccountName $storageName -Location $location
27+
$storageName = getAssetName
28+
New-AzureStorageAccount -StorageAccountName $storageName -Location $location
3129

32-
Set-CurrentStorageAccountName $storageName
30+
Set-CurrentStorageAccountName $storageName
3331

34-
$vmName = "vm1"
35-
$svcName = Get-CloudServiceName
32+
$vmName = "vm1"
33+
$svcName = Get-CloudServiceName
3634

37-
# Test
38-
New-AzureService -ServiceName $svcName -Location $location
39-
New-AzureQuickVM -Windows -ImageName $imgName -Name $vmName -ServiceName $svcName -AdminUsername "pstestuser" -Password "p@ssw0rd"
35+
# Test
36+
New-AzureService -ServiceName $svcName -Location $location
37+
New-AzureQuickVM -Windows -ImageName $imgName -Name $vmName -ServiceName $svcName -AdminUsername "pstestuser" -Password "p@ssw0rd"
4038

41-
Get-AzureVM -ServiceName $svcName -Name $vmName
39+
Get-AzureVM -ServiceName $svcName -Name $vmName
4240

4341

44-
# Cleanup
45-
Cleanup-CloudService $svcName
42+
# Cleanup
43+
Cleanup-CloudService $svcName
4644
}
4745

46+
47+
<#
48+
.SYNOPSIS
49+
Test Get-AzureLocation
50+
#>
51+
function Test-GetAzureLocation
52+
{
53+
$locations = Get-AzureLocation;
54+
55+
foreach ($loc in $locations)
56+
{
57+
$svcName = getAssetName;
58+
$st = New-AzureService -ServiceName $svcName -Location $loc.Name;
59+
60+
# Cleanup
61+
Cleanup-CloudService $svcName
62+
}
63+
}

src/Common/Commands.ScenarioTest/Resources/ServiceManagement/Common.ps1

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ Sets the default storage account
2020
function Set-CurrentStorageAccountName
2121
{
2222
param([string] $storageAccountName)
23-
$currentSubscription = Get-AzureSubscription -Current
23+
$currentSubscription = Get-AzureSubscription -Current
2424

25-
Set-AzureSubscription -SubscriptionId $currentSubscription.SubscriptionId -CurrentStorageAccountName $storageAccountName
25+
Set-AzureSubscription -SubscriptionId $currentSubscription.SubscriptionId -CurrentStorageAccountName $storageAccountName
2626
}
2727

2828
<#
@@ -31,7 +31,7 @@ Gets the default location
3131
#>
3232
function Get-DefaultLocation
3333
{
34-
return (Get-AzureLocation)[0].Name
34+
return (Get-AzureLocation)[0].Name
3535
}
3636

3737
<#
@@ -41,7 +41,7 @@ Gets the default image
4141
function Get-DefaultImage
4242
{
4343
param([string] $loc)
44-
return (Get-AzureVMImage | where {$_.OS -eq "Windows"} | where {$_.Location.Contains($loc)})[0].ImageName
44+
return (Get-AzureVMImage | where {$_.OS -eq "Windows"} | where {$_.Location.Contains($loc)})[0].ImageName
4545
}
4646

4747

@@ -51,7 +51,7 @@ Gets valid and available cloud service name.
5151
#>
5252
function Get-CloudServiceName
5353
{
54-
return getAssetName
54+
return getAssetName
5555
}
5656

5757
<#
@@ -61,14 +61,14 @@ Cleanup cloud service
6161
function Cleanup-CloudService
6262
{
6363
param([string] $name)
64-
try
65-
{
66-
Remove-AzureService -ServiceName $name -Force
67-
}
68-
catch
69-
{
70-
Write-Warning "Cannot Remove the Cloud Service"
71-
}
64+
try
65+
{
66+
Remove-AzureService -ServiceName $name -Force
67+
}
68+
catch
69+
{
70+
Write-Warning "Cannot Remove the Cloud Service"
71+
}
7272
}
7373

7474
<#
@@ -78,13 +78,13 @@ Cleanup storage
7878
function Cleanup-Storage
7979
{
8080
param([string] $name)
81-
Remove-AzureStorageAccount -StorageAccountName $name
82-
try
83-
{
84-
Remove-AzureStorageAccount -StorageAccountName $name
85-
}
86-
catch
87-
{
88-
Write-Warning "Cannot Remove the Storage Account"
89-
}
81+
Remove-AzureStorageAccount -StorageAccountName $name
82+
try
83+
{
84+
Remove-AzureStorageAccount -StorageAccountName $name
85+
}
86+
catch
87+
{
88+
Write-Warning "Cannot Remove the Storage Account"
89+
}
9090
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.WindowsAzure.Commands.ScenarioTest.Common;
16+
using Xunit;
17+
18+
namespace Microsoft.WindowsAzure.Commands.ScenarioTest
19+
{
20+
public partial class AzureVMTests
21+
{
22+
[Fact]
23+
[Trait(Category.Service, Category.ServiceManagement)]
24+
[Trait(Category.AcceptanceType, Category.CheckIn)]
25+
[Trait(Category.AcceptanceType, Category.BVT)]
26+
public void TestGetAzureLocation()
27+
{
28+
this.RunPowerShellTest("Test-GetAzureLocation");
29+
}
30+
}
31+
}

src/Common/Commands.ScenarioTest/ServiceManagement/GetVMTests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
namespace Microsoft.WindowsAzure.Commands.ScenarioTest
2323
{
24-
public class AzureVMTests
24+
public partial class AzureVMTests
2525
{
2626
private EnvironmentSetupHelper helper = new EnvironmentSetupHelper();
2727

@@ -50,9 +50,10 @@ protected void RunPowerShellTest(params string[] scripts)
5050

5151
List<string> modules = Directory.GetFiles("Resources\\ServiceManagement", "*.ps1").ToList();
5252
modules.Add("Common.ps1");
53+
modules.Add(@"..\..\..\..\Package\Debug\ServiceManagement\Azure\Azure.psd1");
5354

5455
helper.SetupEnvironment(AzureModule.AzureServiceManagement);
55-
helper.SetupModulesFromCommon(AzureModule.AzureServiceManagement, modules.ToArray());
56+
helper.SetupModules(modules.ToArray());
5657

5758
helper.RunPowerShellTest(scripts);
5859
}

src/Common/Commands.ScenarioTest/SessionRecords/Microsoft.WindowsAzure.Commands.ScenarioTest.AzureVMTests/TestGetAzureLocation.json

Lines changed: 2478 additions & 0 deletions
Large diffs are not rendered by default.

src/Common/Commands.ScenarioTest/SessionRecords/Microsoft.WindowsAzure.Commands.ScenarioTest.AzureVMTests/TestGetAzureVM.json

Lines changed: 244 additions & 244 deletions
Large diffs are not rendered by default.

src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/Commands.ApiManagement.Test.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@
6060
<SpecificVersion>False</SpecificVersion>
6161
<HintPath>..\..\..\Package\Debug\ResourceManager\AzureResourceManager\Resources\Microsoft.Azure.Management.Authorization.dll</HintPath>
6262
</Reference>
63-
<Reference Include="Microsoft.Azure.Management.Compute">
64-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Compute.5.0.1-preview\lib\net40\Microsoft.Azure.Management.Compute.dll</HintPath>
65-
</Reference>
6663
<Reference Include="Microsoft.Azure.Management.Storage">
6764
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Storage.2.4.0-preview\lib\net40\Microsoft.Azure.Management.Storage.dll</HintPath>
6865
</Reference>

src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/packages.config

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
<package id="Microsoft.Azure.Common.Authentication" version="1.0.26-preview" targetFramework="net45" />
66
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
77
<package id="Microsoft.Azure.Management.ApiManagement" version="0.3.2-preview" targetFramework="net45" />
8-
<package id="Microsoft.Azure.Management.Compute" version="5.0.1-preview" targetFramework="net45" />
98
<package id="Microsoft.Azure.Management.Resources" version="2.18.0-preview" targetFramework="net45" />
109
<package id="Microsoft.Azure.Management.Storage" version="2.4.0-preview" targetFramework="net45" />
1110
<package id="Microsoft.Azure.Test.Framework" version="1.0.5571.32271-prerelease" targetFramework="net45" />

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@
6666
<SpecificVersion>False</SpecificVersion>
6767
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.0.18.2-preview\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
6868
</Reference>
69-
<Reference Include="Microsoft.Azure.Management.Compute, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
70-
<SpecificVersion>False</SpecificVersion>
71-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Compute.5.0.1-preview\lib\net40\Microsoft.Azure.Management.Compute.dll</HintPath>
69+
<Reference Include="Microsoft.Azure.Management.Compute, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
70+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Compute.6.0.0-preview\lib\net40\Microsoft.Azure.Management.Compute.dll</HintPath>
71+
<Private>True</Private>
7272
</Reference>
7373
<Reference Include="Microsoft.Azure.Management.Network, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
7474
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.2.0.3-preview\lib\net40\Microsoft.Azure.Management.Network.dll</HintPath>

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,17 @@ function Get-ComputeTestMode
8888
return $testMode;
8989
}
9090

91+
92+
<#
93+
.SYNOPSIS
94+
Get Compute Test Location
95+
#>
96+
function Get-ComputTestLocation
97+
{
98+
return $env:AZURE_COMPUTE_TEST_LOCATION;
99+
}
100+
101+
91102
######################
92103
#
93104
# Retry the given code block until it succeeds or times out.

src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/Generated/VirtualMachineDynamicTest1.ps1

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function create_and_setup_nic_ids
6666
$nic_ids = @($null) * 1;
6767
$nic0 = New-AzureNetworkInterface -Force -Name ('nic0' + $rgname) -ResourceGroupName $rgname -Location $loc -SubnetId $subnetId;
6868
$nic_ids[0] = $nic0.Id;
69-
$vmconfig = Add-AzureVMNetworkInterface -VM $vmconfig -Id $nic0.Id;
69+
$vmconfig = Add-AzureVMNetworkInterface -VM $vmconfig -Id $nic0.Id -Primary;
7070
$st = Write-Verbose "Creating and getting NICs for '${loc}' and '${rgname}' - End";
7171

7272
return $nic_ids;
@@ -119,19 +119,19 @@ function setup_image_and_disks
119119
}
120120

121121

122-
function ps_vm_dynamic_test_func_1_pstestrg1016
122+
function ps_vm_dynamic_test_func_1_pstestrg592
123123
{
124124
# Setup
125-
$rgname = 'pstestrg1016';
125+
$rgname = 'pstestrg592';
126126

127127
try
128128
{
129-
$loc = 'West US';
130-
$vmsize = 'Standard_A3';
129+
$loc = 'Japan East';
130+
$vmsize = 'Standard_A2';
131131

132-
$st = Write-Verbose "Running Test ps_vm_dynamic_test_func_1_pstestrg1016 - Start ${rgname}, ${loc} & ${vmsize}";
132+
$st = Write-Verbose "Running Test ps_vm_dynamic_test_func_1_pstestrg592 - Start ${rgname}, ${loc} & ${vmsize}";
133133

134-
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_1_pstestrg1016 - Creating Resource Group';
134+
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_1_pstestrg592 - Creating Resource Group';
135135
$st = New-AzureResourceGroup -Location $loc -Name $rgname -Force;
136136

137137
$vmconfig = create_and_setup_vm_config_object $loc $rgname $vmsize;
@@ -146,20 +146,20 @@ function ps_vm_dynamic_test_func_1_pstestrg1016
146146
$st = setup_image_and_disks $loc $rgname $stoname $vmconfig;
147147

148148
# Virtual Machine
149-
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_1_pstestrg1016 - Creating VM';
149+
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_1_pstestrg592 - Creating VM';
150150

151151
$vmname = 'vm' + $rgname;
152152
$st = New-AzureVM -ResourceGroupName $rgname -Location $loc -Name $vmname -VM $vmconfig;
153153

154154
# Get VM
155-
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_1_pstestrg1016 - Getting VM';
155+
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_1_pstestrg592 - Getting VM';
156156
$vm1 = Get-AzureVM -Name $vmname -ResourceGroupName $rgname;
157157

158158
# Remove
159-
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_1_pstestrg1016 - Removing VM';
159+
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_1_pstestrg592 - Removing VM';
160160
$st = Remove-AzureVM -Name $vmname -ResourceGroupName $rgname -Force;
161161

162-
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_1_pstestrg1016 - End';
162+
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_1_pstestrg592 - End';
163163
}
164164
finally
165165
{

src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/Generated/VirtualMachineDynamicTest2.ps1

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function create_and_setup_nic_ids
6666
$nic_ids = @($null) * 1;
6767
$nic0 = New-AzureNetworkInterface -Force -Name ('nic0' + $rgname) -ResourceGroupName $rgname -Location $loc -SubnetId $subnetId;
6868
$nic_ids[0] = $nic0.Id;
69-
$vmconfig = Add-AzureVMNetworkInterface -VM $vmconfig -Id $nic0.Id;
69+
$vmconfig = Add-AzureVMNetworkInterface -VM $vmconfig -Id $nic0.Id -Primary;
7070
$st = Write-Verbose "Creating and getting NICs for '${loc}' and '${rgname}' - End";
7171

7272
return $nic_ids;
@@ -119,19 +119,19 @@ function setup_image_and_disks
119119
}
120120

121121

122-
function ps_vm_dynamic_test_func_2_pstestrg4940
122+
function ps_vm_dynamic_test_func_2_pstestrg2115
123123
{
124124
# Setup
125-
$rgname = 'pstestrg4940';
125+
$rgname = 'pstestrg2115';
126126

127127
try
128128
{
129-
$loc = 'West Europe';
129+
$loc = 'East Asia';
130130
$vmsize = 'Standard_A3';
131131

132-
$st = Write-Verbose "Running Test ps_vm_dynamic_test_func_2_pstestrg4940 - Start ${rgname}, ${loc} & ${vmsize}";
132+
$st = Write-Verbose "Running Test ps_vm_dynamic_test_func_2_pstestrg2115 - Start ${rgname}, ${loc} & ${vmsize}";
133133

134-
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_2_pstestrg4940 - Creating Resource Group';
134+
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_2_pstestrg2115 - Creating Resource Group';
135135
$st = New-AzureResourceGroup -Location $loc -Name $rgname -Force;
136136

137137
$vmconfig = create_and_setup_vm_config_object $loc $rgname $vmsize;
@@ -146,20 +146,20 @@ function ps_vm_dynamic_test_func_2_pstestrg4940
146146
$st = setup_image_and_disks $loc $rgname $stoname $vmconfig;
147147

148148
# Virtual Machine
149-
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_2_pstestrg4940 - Creating VM';
149+
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_2_pstestrg2115 - Creating VM';
150150

151151
$vmname = 'vm' + $rgname;
152152
$st = New-AzureVM -ResourceGroupName $rgname -Location $loc -Name $vmname -VM $vmconfig;
153153

154154
# Get VM
155-
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_2_pstestrg4940 - Getting VM';
155+
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_2_pstestrg2115 - Getting VM';
156156
$vm1 = Get-AzureVM -Name $vmname -ResourceGroupName $rgname;
157157

158158
# Remove
159-
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_2_pstestrg4940 - Removing VM';
159+
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_2_pstestrg2115 - Removing VM';
160160
$st = Remove-AzureVM -Name $vmname -ResourceGroupName $rgname -Force;
161161

162-
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_2_pstestrg4940 - End';
162+
$st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_2_pstestrg2115 - End';
163163
}
164164
finally
165165
{

0 commit comments

Comments
 (0)