Skip to content

Commit 56edc0c

Browse files
ogailogail
authored andcommitted
Merge branch 'dev' of github.com:Azure/azure-powershell into rp
2 parents 578b16b + 0e1387b commit 56edc0c

File tree

116 files changed

+89538
-53153
lines changed

Some content is hidden

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

116 files changed

+89538
-53153
lines changed

AzurePowershell.Test.targets

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@
216216
</Target>
217217

218218
<!-- Run the scenario tests -->
219-
<Target Name="ScenarioTest" DependsOnTargets="Clean;BuildDebug;BeforeRunTests">
219+
<Target Name="ScenarioTest" DependsOnTargets="Clean;Build;BeforeRunTests">
220220
<Message Importance="high" Text="Running scenario tests..." />
221221
<MSBuild Targets="InvokeMSTest"
222222
Properties="_testAssembly=$(ScenarioTestDebug);_testSettings=$(TestSettings);_testFilter=$(ScenarioTestFilter);_testResult=$(TestOutputDirectory)\ScenarioTestDebug.trx"
@@ -275,7 +275,7 @@
275275
IncludeTraits="$(XUnitIncludedTrait)" MaxParallelThreads="0" ParallelizeAssemblies="false" ParallelizeTestCollections="false" />
276276
</Target>
277277

278-
<Target Name="RunOneSDKCIT" DependsOnTargets="Clean;BuildDebug;BeforeRunTests">
278+
<Target Name="RunOneSDKCIT" DependsOnTargets="Clean;Build;BeforeRunTests">
279279
<Message Importance="high" Text="Running CIT Scenario tests..." />
280280
<Delete Files="$(TestOutputDirectory)\RunOneSDKCITDebug.trx" />
281281
<Exec
@@ -284,47 +284,47 @@
284284
</Target>
285285

286286
<!-- Run the AzureRT tests -->
287-
<Target Name="AzureRTBVTs" DependsOnTargets="Clean;BuildDebug;BeforeRunTests">
287+
<Target Name="AzureRTBVTs" DependsOnTargets="Clean;Build;BeforeRunTests">
288288
<Message Importance="high" Text="Running AzureRT BVT tests..." />
289289
<Delete Files="$(TestOutputDirectory)\RTBVTDebug.trx" />
290290
<Exec
291291
Command="MSTest.exe /testcontainer:$(AzureRTTestContainer) /testsettings:$(AzureRTTestSettings) /category:BVT /resultsfile:$(TestOutputDirectory)\RTBVTDebug.trx"
292292
ContinueOnError="false" />
293293
</Target>
294294

295-
<Target Name="AzureRTOne" DependsOnTargets="Clean;BuildDebug;BeforeRunTests">
295+
<Target Name="AzureRTOne" DependsOnTargets="Clean;Build;BeforeRunTests">
296296
<Message Importance="high" Text="Running a specific tests..." />
297297
<Delete Files="$(TestOutputDirectory)\RTFunctionalDebug.trx" />
298298
<Exec
299299
Command="MSTest.exe /testcontainer:$(AzureRTTestContainer) /testsettings:$(AzureRTSeqTestSettings) /test:$(TestName) /resultsfile:$(TestOutputDirectory)\RTFunctionalDebug.trx"
300300
ContinueOnError="false" />
301301
</Target>
302302

303-
<Target Name="AzureRTRepeat" DependsOnTargets="Clean;BuildDebug;BeforeRunTests">
303+
<Target Name="AzureRTRepeat" DependsOnTargets="Clean;Build;BeforeRunTests">
304304
<Message Importance="high" Text="Running a specific tests..." />
305305
<Delete Files="$(TestOutputDirectory)\RTFunctionalDebug.trx" />
306306
<Exec
307307
Command="for /l %%x in (1, 1, $(RepeatTimes)) do MSTest.exe /testcontainer:$(AzureRTTestContainer) /testsettings:$(AzureRTTestSettings) /test:$(TestName) /resultsfile:$(TestOutputDirectory)\RTFunctionalDebug%%x.trx"
308308
ContinueOnError="false" />
309309
</Target>
310310

311-
<Target Name="AzureRTMulti" DependsOnTargets="Clean;BuildDebug;BeforeRunTests">
311+
<Target Name="AzureRTMulti" DependsOnTargets="Clean;Build;BeforeRunTests">
312312
<Message Importance="high" Text="Running tests:" />
313313
<Delete Files="$(TestOutputDirectory)\RTFunctionalDebug.trx" />
314314
<Exec
315315
Command="MSTest.exe /testcontainer:$(AzureRTTestContainer) /testsettings:$(AzureRTSeqTestSettings) $(TestParams) /resultsfile:$(TestOutputDirectory)\RTFunctionalDebug.trx"
316316
ContinueOnError="false" />
317317
</Target>
318318

319-
<Target Name="AzureRTAll" DependsOnTargets="Clean;BuildDebug;BeforeRunTests">
319+
<Target Name="AzureRTAll" DependsOnTargets="Clean;Build;BeforeRunTests">
320320
<Message Importance="high" Text="Running AzureRT all tests..." />
321321
<Delete Files="$(TestOutputDirectory)\RTDebug.trx" />
322322
<Exec
323323
Command="MSTest.exe /testcontainer:$(AzureRTTestContainer) /testsettings:$(AzureRTSeqTestSettings) /category:$(AzureRTAllTestFilter) /resultsfile:$(TestOutputDirectory)\RTDebug.trx"
324324
ContinueOnError="false" />
325325
</Target>
326326

327-
<Target Name="AzureRTAllFast" DependsOnTargets="Clean;BuildDebug;BeforeRunTests">
327+
<Target Name="AzureRTAllFast" DependsOnTargets="Clean;Build;BeforeRunTests">
328328
<Message Importance="high" Text="Running AzureRT all tests..." />
329329

330330
<Delete Files="$(TestOutputDirectory)\RTSequentialDebug.trx" />
@@ -337,7 +337,7 @@
337337
ContinueOnError="false" />
338338
</Target>
339339

340-
<Target Name="AzureRTSeq" DependsOnTargets="Clean;BuildDebug;BeforeRunTests">
340+
<Target Name="AzureRTSeq" DependsOnTargets="Clean;Build;BeforeRunTests">
341341
<Message Importance="high" Text="Running AzureRT all tests..." />
342342

343343
<Delete Files="$(TestOutputDirectory)\RTSequentialDebug.trx" />
@@ -346,7 +346,7 @@
346346
ContinueOnError="true" />
347347
</Target>
348348

349-
<Target Name="AzureRTNetwork" DependsOnTargets="Clean;BuildDebug;BeforeRunTests">
349+
<Target Name="AzureRTNetwork" DependsOnTargets="Clean;Build;BeforeRunTests">
350350
<Message Importance="high" Text="Running AzureRT all tests..." />
351351

352352
<Delete Files="$(TestOutputDirectory)\RTSequentialDebug.trx" />
@@ -355,7 +355,7 @@
355355
ContinueOnError="false" />
356356
</Target>
357357

358-
<Target Name="AzureRTUploadSeq" DependsOnTargets="Clean;BuildDebug;BeforeRunTests">
358+
<Target Name="AzureRTUploadSeq" DependsOnTargets="Clean;Build;BeforeRunTests">
359359
<Message Importance="high" Text="Running AzureRT all tests..." />
360360

361361
<Delete Files="$(TestOutputDirectory)\RTSequentialDebug.trx" />
@@ -364,7 +364,7 @@
364364
ContinueOnError="false" />
365365
</Target>
366366

367-
<Target Name="AzureRTPar" DependsOnTargets="Clean;BuildDebug;BeforeRunTests">
367+
<Target Name="AzureRTPar" DependsOnTargets="Clean;Build;BeforeRunTests">
368368
<Message Importance="high" Text="Running AzureRT all tests..." />
369369

370370
<Delete Files="$(TestOutputDirectory)\RTDebug.trx" />
@@ -373,7 +373,7 @@
373373
ContinueOnError="false" />
374374
</Target>
375375

376-
<Target Name="AzureRTFunctional" DependsOnTargets="Clean;BuildDebug;BeforeRunTests">
376+
<Target Name="AzureRTFunctional" DependsOnTargets="Clean;Build;BeforeRunTests">
377377
<Message Importance="high" Text="Running AzureRT Functional tests..." />
378378

379379
<Delete Files="$(TestOutputDirectory)\RTFunctionalDebug.trx" />
@@ -382,7 +382,7 @@
382382
ContinueOnError="false" />
383383
</Target>
384384

385-
<Target Name="AzureRTScenario" DependsOnTargets="Clean;BuildDebug;BeforeRunTests">
385+
<Target Name="AzureRTScenario" DependsOnTargets="Clean;Build;BeforeRunTests">
386386
<Message Importance="high" Text="Running AzureRT Scenario tests..." />
387387

388388
<Delete Files="$(TestOutputDirectory)\RTScenarioDebug.trx" />
@@ -391,7 +391,7 @@
391391
ContinueOnError="false" />
392392
</Target>
393393

394-
<Target Name="AzureRTAllPreview" DependsOnTargets="Clean;BuildDebug;BeforeRunTests">
394+
<Target Name="AzureRTAllPreview" DependsOnTargets="Clean;Build;BeforeRunTests">
395395
<Message Importance="high" Text="Running AzureRT all tests..." />
396396
<Delete Files="$(TestOutputDirectory)\RTAddVhdDebug.trx" />
397397
<Delete Files="$(TestOutputDirectory)\RTDebug.trx" />
@@ -403,23 +403,23 @@
403403
ContinueOnError="false" />
404404
</Target>
405405

406-
<Target Name="AzureRTPreview" DependsOnTargets="Clean;BuildDebug;BeforeRunTests">
406+
<Target Name="AzureRTPreview" DependsOnTargets="Clean;Build;BeforeRunTests">
407407
<Message Importance="high" Text="Running AzureRT all tests..." />
408408
<Delete Files="$(TestOutputDirectory)\RTPreviewDebug.trx" />
409409
<Exec
410410
Command="MSTest.exe /testcontainer:$(AzureRTTestContainer) /testsettings:$(AzureRTTestSettings) /category:Preview /resultsfile:$(TestOutputDirectory)\RTPreviewDebug.trx"
411411
ContinueOnError="false" />
412412
</Target>
413413

414-
<Target Name="AzureRTCleanUp" DependsOnTargets="Clean;BuildDebug;BeforeRunTests">
414+
<Target Name="AzureRTCleanUp" DependsOnTargets="Clean;Build;BeforeRunTests">
415415
<Message Importance="high" Text="Running AzureRT clean up tests..." />
416416
<Delete Files="$(TestOutputDirectory)\RTCleanUpDebug.trx" />
417417
<Exec
418418
Command="MSTest.exe /testcontainer:$(AzureRTTestContainer) /testsettings:$(AzureRTTestSettings) /category:AzureRTCleanUp /resultsfile:$(TestOutputDirectory)\RTCleanUpDebug.trx"
419419
ContinueOnError="false" />
420420
</Target>
421421

422-
<Target Name="ComputeCodeCoverage" DependsOnTargets="ForceRestorePackages;Clean;BuildDebug">
422+
<Target Name="ComputeCodeCoverage" DependsOnTargets="RestoreNugetPackages;Clean;Build">
423423
<Message Importance="high" Text="Gathering Code Coverage data from Compute tests..." />
424424
<Delete Files="Project.covarage" />
425425
<Exec

setup-powershellget/Setup/ShortcutStartup.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ For a list of all Azure RM cmdlets type 'help azurerm'.
5959
6060
To start using Azure RM login via Login-AzureRmAccount cmdlet.
6161
To switch between subscriptions use Set-AzureRmContext.
62+
For more details, see http://aka.ms/azps-getting-started.
6263
6364
To use Azure Service Management cmdlets please execute the following cmdlet:
6465
Install-Module Azure

src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/ScenarioTests/Common.ps1

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,25 @@ Gets all locations for a provider
5050
#>
5151
function Get-ProviderLocations($provider)
5252
{
53-
$location = Get-AzureRmLocation | where {$_.Name -eq $provider}
54-
$location.Locations
53+
if ([Microsoft.Azure.Test.HttpRecorder.HttpMockServer]::Mode -ne [Microsoft.Azure.Test.HttpRecorder.HttpRecorderMode]::Playback)
54+
{
55+
$namespace = $provider.Split("/")[0]
56+
if($provider.Contains("/"))
57+
{
58+
$type = $provider.Substring($namespace.Length + 1)
59+
$location = Get-AzureRmResourceProvider -ProviderNamespace $namespace | where {$_.ResourceTypes[0].ResourceTypeName -eq $type}
60+
61+
if ($location -eq $null)
62+
{
63+
return @("Central US", "East US")
64+
} else
65+
{
66+
return $location.Locations[0]
67+
}
68+
}
69+
70+
return @("Central US", "East US")
71+
}
72+
73+
return @("Central US", "East US")
5574
}

src/ResourceManager/ApiManagement/Commands.SMAPI.Test/ScenarioTests/Common.ps1

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,25 @@ Gets all locations for a provider
5050
#>
5151
function Get-ProviderLocations($provider)
5252
{
53-
$location = Get-AzureRmLocation | where {$_.Name -eq $provider}
54-
$location.Locations
53+
if ([Microsoft.Azure.Test.HttpRecorder.HttpMockServer]::Mode -ne [Microsoft.Azure.Test.HttpRecorder.HttpRecorderMode]::Playback)
54+
{
55+
$namespace = $provider.Split("/")[0]
56+
if($provider.Contains("/"))
57+
{
58+
$type = $provider.Substring($namespace.Length + 1)
59+
$location = Get-AzureRmResourceProvider -ProviderNamespace $namespace | where {$_.ResourceTypes[0].ResourceTypeName -eq $type}
60+
61+
if ($location -eq $null)
62+
{
63+
return @("West US", "East US")
64+
} else
65+
{
66+
return $location.Locations[0]
67+
}
68+
}
69+
70+
return @("West US", "East US")
71+
}
72+
73+
return @("West US", "East US")
5574
}

src/ResourceManager/AzureBatch/Commands.Batch.Test/ScenarioTests/Common.ps1

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,27 @@ Gets the location for the Batch account provider. Default to West US if none fou
3636
#>
3737
function Get-BatchAccountProviderLocation($index)
3838
{
39-
$location = Get-AzureRmLocation | where {$_.Name -eq "Microsoft.Batch/batchAccounts"}
40-
if ($location -eq $null)
39+
if ([Microsoft.Azure.Test.HttpRecorder.HttpMockServer]::Mode -ne [Microsoft.Azure.Test.HttpRecorder.HttpRecorderMode]::Playback)
4140
{
42-
"West US"
43-
}
44-
else
45-
{
46-
if ($index -eq $null)
47-
{
48-
$location.Locations[0]
49-
}
50-
else
51-
{
52-
$location.Locations[$index]
41+
$namespace = $provider.Split("/")[0]
42+
if($provider.Contains("/"))
43+
{
44+
$type = $provider.Substring($namespace.Length + 1)
45+
$location = Get-AzureRmResourceProvider -ProviderNamespace $namespace | where {$_.ResourceTypes[0].ResourceTypeName -eq $type}
46+
47+
if ($location -eq $null)
48+
{
49+
return "West US"
50+
} else
51+
{
52+
return $location.Locations[0]
53+
}
5354
}
54-
}
55+
56+
return "West US"
57+
}
58+
59+
return "WestUS"
5560
}
5661

5762
<#

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

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@
6666
<Reference Include="Microsoft.Azure.Management.Authorization">
6767
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.1.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
6868
</Reference>
69-
<Reference Include="Microsoft.Azure.Management.Compute, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
70-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Compute.8.2.0\lib\net40\Microsoft.Azure.Management.Compute.dll</HintPath>
69+
<Reference Include="Microsoft.Azure.Management.Compute, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
70+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Compute.9.0.0\lib\net40\Microsoft.Azure.Management.Compute.dll</HintPath>
7171
<Private>True</Private>
7272
</Reference>
7373
<Reference Include="Microsoft.Azure.Management.Network, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
@@ -157,6 +157,7 @@
157157
<Compile Include="ScenarioTests\AddVhdTests.cs" />
158158
<Compile Include="ScenarioTests\ComputeCloudExceptionTests.cs" />
159159
<Compile Include="ScenarioTests\DscExtensionTests.cs" />
160+
<Compile Include="ScenarioTests\VirtualMachineBootDiagnosticsTests.cs" />
160161
<Compile Include="ScenarioTests\VMDynamicTests.cs" />
161162
<Compile Include="ScenarioTests\VirtualMachineProfileTests.cs" />
162163
<Compile Include="ScenarioTests\AvailabilitySetTests.cs" />
@@ -223,6 +224,9 @@
223224
<None Include="ScenarioTests\Generated\VirtualMachineDynamicTest3.ps1">
224225
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
225226
</None>
227+
<None Include="ScenarioTests\VirtualMachineBootDiagnosticsTests.ps1">
228+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
229+
</None>
226230
<None Include="ScenarioTests\VMDynamicTests.ps1">
227231
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
228232
</None>
@@ -258,6 +262,18 @@
258262
<None Include="SessionRecords\Microsoft.Azure.Commands.Compute.Test.ScenarioTests.DscExtensionTests\TestGetAzureRmVMDscExtension.json">
259263
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
260264
</None>
265+
<None Include="SessionRecords\Microsoft.Azure.Commands.Compute.Test.ScenarioTests.VirtualMachineBootDiagnosticsTests\TestLinuxVirtualMachineBootDiagnostics.json">
266+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
267+
</None>
268+
<None Include="SessionRecords\Microsoft.Azure.Commands.Compute.Test.ScenarioTests.VirtualMachineBootDiagnosticsTests\TestVirtualMachineBootDiagnostics.json">
269+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
270+
</None>
271+
<None Include="SessionRecords\Microsoft.Azure.Commands.Compute.Test.ScenarioTests.VirtualMachineBootDiagnosticsTests\TestVirtualMachineBootDiagnosticsPremium.json">
272+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
273+
</None>
274+
<None Include="SessionRecords\Microsoft.Azure.Commands.Compute.Test.ScenarioTests.VirtualMachineBootDiagnosticsTests\TestVirtualMachineBootDiagnosticsSet.json">
275+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
276+
</None>
261277
<None Include="SessionRecords\Microsoft.Azure.Commands.Compute.Test.ScenarioTests.VirtualMachineExtensionTests\TestVirtualMachineAccessExtension.json">
262278
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
263279
</None>

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,18 @@ function Test-AddVhd
6464

6565
$destBlobHandle = GetBlobHandle $vhdDestUri $storageKey.Key1;
6666
Assert-True {VerifyMD5hash $destBlobHandle $testItem.md5hash};
67+
68+
$vhdDownloadPath = $vhdLocalPath + "-download.vhd";
69+
70+
$vhdDownloadContext = Save-AzureRmVhd -ResourceGroupName $rgname -SourceUri $vhdDestUri -LocalFilePath $vhdDownloadPath;
71+
Write-Output ("Source :" +$vhdDownloadContext.Source);
72+
Write-Output ("LocalFilePath :" +$vhdDownloadContext.LocalFilePath);
73+
Assert-AreEqual $vhdDestUri $vhdDownloadContext.Source;
74+
Assert-AreEqual $vhdDownloadPath $vhdDownloadContext.LocalFilePath;
75+
76+
$vhdDownloadContext = Save-AzureRmVhd -ResourceGroupName $rgname -SourceUri $vhdDestUri -LocalFilePath $vhdDownloadPath -Overwrite;
77+
Assert-AreEqual $vhdDestUri $vhdDownloadContext.Source;
78+
Assert-AreEqual $vhdDownloadPath $vhdDownloadContext.LocalFilePath;
6779
}
6880
}
6981
finally

0 commit comments

Comments
 (0)