Skip to content

Commit c0400e5

Browse files
committed
Merge pull request Azure#710 from huangpf/dev
AzureRT S52 PR #1
2 parents 6b1a958 + 699553a commit c0400e5

File tree

22 files changed

+122482
-714
lines changed

22 files changed

+122482
-714
lines changed

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,12 @@
196196
<None Include="Resources\CredentialTests\Common.ps1">
197197
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
198198
</None>
199+
<None Include="Resources\ServiceManagement\Files\OneWebOneWorker.cscfg">
200+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
201+
</None>
202+
<None Include="Resources\ServiceManagement\Files\OneWebOneWorker.cspkg">
203+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
204+
</None>
199205
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ScenarioTest.AutomationTests\TestAutomationConfigureRunbook.json">
200206
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
201207
</None>
@@ -220,6 +226,9 @@
220226
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ScenarioTest.ServiceManagementTests\RunAutoGeneratedHostedServiceCmdletTests.json">
221227
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
222228
</None>
229+
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ScenarioTest.ServiceManagementTests\RunAutoGeneratedServiceExtensionCmdletTests.json">
230+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
231+
</None>
223232
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ScenarioTest.ServiceManagementTests\RunAutoGeneratedVirtualMachineCmdletTests.json">
224233
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
225234
</None>
@@ -232,6 +241,12 @@
232241
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ScenarioTest.ServiceManagementTests\RunNewAzureComputeParameterObjectTests.json">
233242
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
234243
</None>
244+
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ScenarioTest.ServiceManagementTests\RunServiceDeploymentExtensionCmdletTests.json">
245+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
246+
</None>
247+
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ScenarioTest.ServiceManagementTests\RunServiceExtensionSetCmdletTests.json">
248+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
249+
</None>
235250
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ScenarioTest.ServiceManagementTests\RunServiceManagementCloudExceptionTests.json">
236251
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
237252
</None>
@@ -567,4 +582,4 @@
567582
<Target Name="AfterBuild">
568583
</Target>
569584
-->
570-
</Project>
585+
</Project>

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,35 @@ function Cleanup-Storage
8989
}
9090
}
9191

92+
<#
93+
.SYNOPSIS
94+
Gets test mode - 'Record' or 'Playback'
95+
#>
96+
function Get-ComputeTestMode
97+
{
98+
$oldErrorActionPreferenceValue = $ErrorActionPreference;
99+
$ErrorActionPreference = "SilentlyContinue";
100+
101+
try
102+
{
103+
$testMode = [Microsoft.Azure.Test.HttpRecorder.HttpMockServer]::Mode;
104+
$testMode = $testMode.ToString();
105+
}
106+
catch
107+
{
108+
if (($Error.Count -gt 0) -and ($Error[0].Exception.Message -like '*Unable to find type*'))
109+
{
110+
$testMode = 'Record';
111+
}
112+
else
113+
{
114+
throw;
115+
}
116+
}
117+
finally
118+
{
119+
$ErrorActionPreference = $oldErrorActionPreferenceValue;
120+
}
121+
122+
return $testMode;
123+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
**********************************************************************************************
4+
5+
This file was generated by a tool from the project file: ServiceConfiguration.Cloud.cscfg
6+
7+
Changes to this file may cause incorrect behavior and will be lost if the file is regenerated.
8+
9+
**********************************************************************************************
10+
-->
11+
<ServiceConfiguration serviceName="OneWebOneWorker" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="2" osVersion="*" schemaVersion="2012-10.1.8">
12+
<Role name="WebRole1">
13+
<Instances count="1" />
14+
<ConfigurationSettings>
15+
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" />
16+
</ConfigurationSettings>
17+
</Role>
18+
<Role name="WorkerRole1">
19+
<Instances count="1" />
20+
<ConfigurationSettings>
21+
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" />
22+
</ConfigurationSettings>
23+
</Role>
24+
</ServiceConfiguration>

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

Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ function Run-NewAzureComputeParameterObjectTests
344344
}
345345
}
346346

347+
# Run Set-AzurePlatformVMImage Cmdlet Negative Tests
347348
function Run-AzurePlatformVMImageNegativeTest
348349
{
349350
$location = Get-DefaultLocation;
@@ -363,4 +364,207 @@ function Run-AzurePlatformVMImageNegativeTest
363364
{ Set-AzurePlatformVMImage -ImageName $imgName -Permission $mode } `
364365
"ForbiddenError: This operation is not allowed for this subscription.";
365366
}
367+
}
368+
369+
# Run Auto-Generated Service Extension Cmdlet Tests
370+
function Run-AutoGeneratedServiceExtensionCmdletTests
371+
{
372+
# Setup
373+
$location = Get-DefaultLocation;
374+
375+
$storageName = 'pstest' + (getAssetName);
376+
New-AzureStorageAccount -StorageAccountName $storageName -Location $location;
377+
378+
# Associate the new storage account with the current subscription
379+
Set-CurrentStorageAccountName $storageName;
380+
381+
$svcName = 'pstest' + (Get-CloudServiceName);
382+
383+
try
384+
{
385+
# Create Hosted Service Parameters
386+
$svcCreateParams = New-AzureComputeParameterObject -FriendlyName 'HostedServiceCreateParameters';
387+
$svcCreateParams.ServiceName = $svcName;
388+
$svcCreateParams.Location = $location;
389+
$svcCreateParams.Description = $svcName;
390+
$svcCreateParams.Label = $svcName;
391+
392+
# Invoke Hosted Service Create
393+
$st = Invoke-AzureComputeMethod -MethodName 'HostedServiceCreate' -ArgumentList $svcCreateParams;
394+
Assert-AreEqual $st.StatusCode 'Created';
395+
Assert-NotNull $st.RequestId;
396+
397+
# New-AzureDeployment (in Azure.psd1)
398+
$testMode = Get-ComputeTestMode;
399+
if ($testMode.ToLower() -ne 'playback')
400+
{
401+
$cspkg = '.\Resources\ServiceManagement\Files\OneWebOneWorker.cspkg';
402+
}
403+
else
404+
{
405+
$cspkg = "https://${storageName}.blob.azure.windows.net/blob/OneWebOneWorker.cspkg";
406+
}
407+
$cscfg = '.\Resources\ServiceManagement\Files\OneWebOneWorker.cscfg';
408+
409+
$st = New-AzureDeployment -ServiceName $svcName -Package $cspkg -Configuration $cscfg -Label $svcName -Slot Production;
410+
411+
$deployment = Get-AzureDeployment -ServiceName $svcName -Slot Production;
412+
$config = $deployment.Configuration;
413+
414+
# Invoke Hosted Service Add Extension
415+
$p1 = New-AzureComputeArgumentList -MethodName HostedServiceAddExtension;
416+
$p1[0].Value = $svcName;
417+
$p1[1].Value.Id = 'test';
418+
$p1[1].Value.PublicConfiguration =
419+
@"
420+
<?xml version="1.0" encoding="UTF-8"?>
421+
<PublicConfig>
422+
<UserName>pstestuser</UserName>
423+
<Expiration></Expiration>
424+
</PublicConfig>
425+
"@;
426+
$p1[1].Value.PrivateConfiguration =
427+
@"
428+
<?xml version="1.0" encoding="UTF-8"?>
429+
<PrivateConfig>
430+
<Password>pstestuser</Password>
431+
</PrivateConfig>
432+
"@;
433+
$p1[1].Value.ProviderNamespace = 'Microsoft.Windows.Azure.Extensions';
434+
$p1[1].Value.Type = 'RDP';
435+
$p1[1].Value.Version = '1.*';
436+
$d1 = ($p1 | select -ExpandProperty Value);
437+
$st = Invoke-AzureComputeMethod -MethodName HostedServiceAddExtension -ArgumentList $d1;
438+
439+
# Invoke Deployment Change Configuration
440+
$p2 = New-AzureComputeArgumentList -MethodName DeploymentChangeConfigurationBySlot;
441+
$p2[0].Value = $svcName;
442+
$p2[1].Value = [Microsoft.WindowsAzure.Management.Compute.Models.DeploymentSlot]::Production;
443+
$p2[2].Value = New-Object -TypeName Microsoft.WindowsAzure.Management.Compute.Models.DeploymentChangeConfigurationParameters;
444+
$p2[2].Value.Configuration = $deployment.Configuration;
445+
$p2[2].Value.ExtensionConfiguration = New-Object -TypeName Microsoft.WindowsAzure.Management.Compute.Models.ExtensionConfiguration;
446+
$p2[2].Value.ExtensionConfiguration.AllRoles.Add('test');
447+
$d2 = ($p2 | select -ExpandProperty Value);
448+
$st = Invoke-AzureComputeMethod -MethodName DeploymentChangeConfigurationBySlot -ArgumentList $d2;
449+
450+
# Invoke Hosted Service Delete
451+
$st = Invoke-AzureComputeMethod -MethodName 'HostedServiceDeleteAll' -ArgumentList $svcName;
452+
Assert-AreEqual $st.StatusCode 'OK';
453+
Assert-NotNull $st.RequestId;
454+
}
455+
finally
456+
{
457+
# Cleanup
458+
Cleanup-CloudService $svcName;
459+
}
460+
}
461+
462+
# Run Service Extension Set Cmdlet Tests
463+
function Run-ServiceExtensionSetCmdletTests
464+
{
465+
# Setup
466+
$location = Get-DefaultLocation;
467+
$imgName = Get-DefaultImage $location;
468+
469+
$storageName = 'pstest' + (getAssetName);
470+
New-AzureStorageAccount -StorageAccountName $storageName -Location $location;
471+
472+
# Associate the new storage account with the current subscription
473+
Set-CurrentStorageAccountName $storageName;
474+
475+
$svcName = 'pstest' + (Get-CloudServiceName);
476+
$userName = "pstestuser";
477+
$password = "p@ssw0rd";
478+
$sPassword = ConvertTo-SecureString $password -AsPlainText -Force;
479+
$credential = New-Object System.Management.Automation.PSCredential ($userName, $sPassword);
480+
481+
# Test
482+
New-AzureService -ServiceName $svcName -Location $location;
483+
484+
try
485+
{
486+
# New-AzureDeployment (in Azure.psd1)
487+
$cspkg = '.\Resources\ServiceManagement\Files\OneWebOneWorker.cspkg';
488+
$cscfg = '.\Resources\ServiceManagement\Files\OneWebOneWorker.cscfg';
489+
490+
# Staging 1st
491+
$st = New-AzureDeployment -ServiceName $svcName -Package $cspkg -Configuration $cscfg -Label $svcName -Slot Staging;
492+
$st = Set-AzureServiceRemoteDesktopExtension -ServiceName $svcName -Slot Staging -Credential $credential;
493+
$ex = Get-AzureServiceExtension -ServiceName $svcName -Slot Staging;
494+
$st = Move-AzureDeployment -ServiceName $svcName;
495+
$ex = Get-AzureServiceExtension -ServiceName $svcName -Slot Production;
496+
497+
# Staging 2nd
498+
$st = New-AzureDeployment -ServiceName $svcName -Package $cspkg -Configuration $cscfg -Label $svcName -Slot Staging;
499+
$st = Set-AzureServiceRemoteDesktopExtension -ServiceName $svcName -Slot Staging -Credential $credential;
500+
$ex = Get-AzureServiceExtension -ServiceName $svcName -Slot Staging;
501+
$st = Move-AzureDeployment -ServiceName $svcName;
502+
$ex = Get-AzureServiceExtension -ServiceName $svcName -Slot Production;
503+
504+
# Set Extensions
505+
$st = Set-AzureServiceRemoteDesktopExtension -ServiceName $svcName -Slot Production -Credential $credential;
506+
$st = Set-AzureServiceRemoteDesktopExtension -ServiceName $svcName -Slot Staging -Credential $credential;
507+
}
508+
finally
509+
{
510+
# Cleanup
511+
Cleanup-CloudService $svcName;
512+
}
513+
}
514+
515+
516+
# Run Service Deployment Extension Cmdlet Tests
517+
function Run-ServiceDeploymentExtensionCmdletTests
518+
{
519+
# Setup
520+
$location = Get-DefaultLocation;
521+
$imgName = Get-DefaultImage $location;
522+
523+
$storageName = 'pstest' + (getAssetName);
524+
New-AzureStorageAccount -StorageAccountName $storageName -Location $location;
525+
526+
# Associate the new storage account with the current subscription
527+
Set-CurrentStorageAccountName $storageName;
528+
529+
$svcName = 'pstest' + (Get-CloudServiceName);
530+
$userName = "pstestuser";
531+
$password = "p@ssw0rd";
532+
$sPassword = ConvertTo-SecureString $password -AsPlainText -Force;
533+
$credential = New-Object System.Management.Automation.PSCredential ($userName, $sPassword);
534+
535+
# Test
536+
New-AzureService -ServiceName $svcName -Location $location;
537+
538+
try
539+
{
540+
# New-AzureDeployment (in Azure.psd1)
541+
$cspkg = '.\Resources\ServiceManagement\Files\OneWebOneWorker.cspkg';
542+
$cscfg = '.\Resources\ServiceManagement\Files\OneWebOneWorker.cscfg';
543+
544+
$rdpCfg1 = New-AzureServiceRemoteDesktopExtensionConfig -Credential $credential -Role WebRole1
545+
$rdpCfg2 = New-AzureServiceRemoteDesktopExtensionConfig -Credential $credential -Role WorkerRole1;
546+
$adCfg1 = New-AzureServiceADDomainExtensionConfig -Role WebRole1 -WorkgroupName 'test1';
547+
$adCfg2 = New-AzureServiceADDomainExtensionConfig -Role WorkerRole1 -WorkgroupName 'test2';
548+
549+
$st = New-AzureDeployment -ServiceName $svcName -Package $cspkg -Configuration $cscfg -Label $svcName -Slot Production -ExtensionConfiguration $rdpCfg1,$adCfg1;
550+
$exts = Get-AzureServiceExtension -ServiceName $svcName -Slot Production;
551+
Assert-True { $exts.Count -eq 2 };
552+
553+
$st = New-AzureDeployment -ServiceName $svcName -Package $cspkg -Configuration $cscfg -Label $svcName -Slot Staging -ExtensionConfiguration $rdpCfg2,$adCfg2;
554+
$exts = Get-AzureServiceExtension -ServiceName $svcName -Slot Staging;
555+
Assert-True { $exts.Count -eq 2 };
556+
557+
$st = Set-AzureDeployment -Config -ServiceName $svcName -Configuration $cscfg -Slot Production -ExtensionConfiguration $rdpCfg2;
558+
$exts = Get-AzureServiceExtension -ServiceName $svcName -Slot Production;
559+
Assert-True { $exts.Count -eq 1 };
560+
561+
$st = Set-AzureDeployment -Config -ServiceName $svcName -Configuration $cscfg -Slot Staging -ExtensionConfiguration $rdpCfg1,$adCfg1;
562+
$exts = Get-AzureServiceExtension -ServiceName $svcName -Slot Staging;
563+
Assert-True { $exts.Count -eq 2 };
564+
}
565+
finally
566+
{
567+
# Cleanup
568+
Cleanup-CloudService $svcName;
569+
}
366570
}

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,32 @@ public void RunAzurePlatformVMImageNegativeTest()
9898
{
9999
this.RunPowerShellTest("Run-AzurePlatformVMImageNegativeTest");
100100
}
101+
102+
[Fact]
103+
[Trait(Category.Service, Category.ServiceManagement)]
104+
[Trait(Category.AcceptanceType, Category.CheckIn)]
105+
[Trait(Category.AcceptanceType, Category.BVT)]
106+
public void RunAutoGeneratedServiceExtensionCmdletTests()
107+
{
108+
this.RunPowerShellTest("Run-AutoGeneratedServiceExtensionCmdletTests");
109+
}
110+
111+
[Fact]
112+
[Trait(Category.Service, Category.ServiceManagement)]
113+
[Trait(Category.AcceptanceType, Category.CheckIn)]
114+
[Trait(Category.AcceptanceType, Category.BVT)]
115+
public void RunServiceExtensionSetCmdletTests()
116+
{
117+
this.RunPowerShellTest("Run-ServiceExtensionSetCmdletTests");
118+
}
119+
120+
[Fact]
121+
[Trait(Category.Service, Category.ServiceManagement)]
122+
[Trait(Category.AcceptanceType, Category.CheckIn)]
123+
[Trait(Category.AcceptanceType, Category.BVT)]
124+
public void RunServiceDeploymentExtensionCmdletTests()
125+
{
126+
this.RunPowerShellTest("Run-ServiceDeploymentExtensionCmdletTests");
127+
}
101128
}
102129
}

src/Common/Commands.ScenarioTest/SessionRecords/Microsoft.WindowsAzure.Commands.ScenarioTest.ServiceManagementTests/RunAutoGeneratedServiceExtensionCmdletTests.json

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

src/Common/Commands.ScenarioTest/SessionRecords/Microsoft.WindowsAzure.Commands.ScenarioTest.ServiceManagementTests/RunServiceDeploymentExtensionCmdletTests.json

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

src/Common/Commands.ScenarioTest/SessionRecords/Microsoft.WindowsAzure.Commands.ScenarioTest.ServiceManagementTests/RunServiceExtensionSetCmdletTests.json

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

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@
6666
<SpecificVersion>False</SpecificVersion>
6767
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.0.19.2-preview\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
6868
</Reference>
69-
<Reference Include="Microsoft.Azure.Management.Compute, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
70-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Compute.7.0.0-preview\lib\net40\Microsoft.Azure.Management.Compute.dll</HintPath>
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>
7171
<Private>True</Private>
7272
</Reference>
7373
<Reference Include="Microsoft.Azure.Management.Network, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
@@ -299,6 +299,9 @@
299299
<None Include="SessionRecords\Microsoft.Azure.Commands.Compute.Test.ScenarioTests.VirtualMachineTests\TestVirtualMachineCapture.json">
300300
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
301301
</None>
302+
<None Include="SessionRecords\Microsoft.Azure.Commands.Compute.Test.ScenarioTests.VirtualMachineTests\TestVirtualMachineListWithPaging.json">
303+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
304+
</None>
302305
<None Include="SessionRecords\Microsoft.Azure.Commands.Compute.Test.ScenarioTests.VirtualMachineTests\TestVirtualMachinePIRv2.json">
303306
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
304307
</None>
@@ -323,6 +326,9 @@
323326
<None Include="SessionRecords\Microsoft.Azure.Commands.Compute.Test.ScenarioTests.VMDynamicTests\RunVMDynamicTests.json">
324327
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
325328
</None>
329+
<None Include="Templates\azuredeploy.json">
330+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
331+
</None>
326332
</ItemGroup>
327333
<ItemGroup>
328334
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />

0 commit comments

Comments
 (0)