Skip to content

Commit 7fc96a1

Browse files
committed
Add tests
1 parent 2bb4cb3 commit 7fc96a1

File tree

7 files changed

+3149
-0
lines changed

7 files changed

+3149
-0
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,16 @@
224224
<None Include="Resources\DiagnosticsExtension\Files\diagnostics.wadcfgx">
225225
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
226226
</None>
227+
<None Include="Resources\ServiceManagement\Files\dSMSTest.cscfg">
228+
<SubType>Designer</SubType>
229+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
230+
</None>
231+
<None Include="Resources\ServiceManagement\Files\dSMSTest.cspkg">
232+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
233+
</None>
234+
<None Include="Resources\ServiceManagement\Files\example.pfx">
235+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
236+
</None>
227237
<None Include="Resources\SqlIaaSExtension\SqlIaaSExtensionTests.ps1">
228238
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
229239
</None>
@@ -302,6 +312,9 @@
302312
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ScenarioTest.ServiceManagementTests\RunAzurePlatformVMImageNegativeTest.json">
303313
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
304314
</None>
315+
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ScenarioTest.ServiceManagementTests\RunDSMSHostedServiceTest.json">
316+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
317+
</None>
305318
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ScenarioTest.ServiceManagementTests\RunEnableAndDisableDataCollectionTests.json">
306319
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
307320
</None>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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="AzureCloudService1" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="5" osVersion="*" schemaVersion="2015-04.2.6">
12+
<Role name="WorkerRole1">
13+
<Instances count="1" />
14+
<ConfigurationSettings>
15+
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" />
16+
<Setting name="DummySetting" value="Foo" />
17+
</ConfigurationSettings>
18+
<Certificates>
19+
<Certificate name="ThumbprintCert" thumbprint="6CAE49B8166D5ADA04EDA09616CEDC88A091289E" thumbprintAlgorithm="sha1" />
20+
<Certificate name="dSMSCert" sourceLocation="/genevacustomers/monitoring/prod/warmpath/test/auxweb/certificates/chained/portaldogfoodmdscert.pfx" />
21+
</Certificates>
22+
</Role>
23+
</ServiceConfiguration>

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

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,64 @@ function Run-AutoGeneratedVirtualMachineCmdletTests
296296
}
297297
}
298298

299+
# Run dSMS Hosted Service test
300+
function Run-DSMSHostedServiceTest
301+
{
302+
# Setup
303+
$svcName = 'pstest' + (Get-CloudServiceName);
304+
$location = Get-DefaultLocation;
305+
306+
$storageName = 'pstest' + (getAssetName);
307+
New-AzureStorageAccount -StorageAccountName $storageName -Location $location;
308+
309+
# Associate the new storage account with the current subscription
310+
Set-CurrentStorageAccountName $storageName;
311+
312+
$testMode = Get-ComputeTestMode;
313+
if ($testMode.ToLower() -ne 'playback')
314+
{
315+
$cspkg = '.\Resources\ServiceManagement\Files\dSMSTest.cspkg';
316+
}
317+
else
318+
{
319+
$cspkg = "https://${storageName}.blob.azure.windows.net/blob/dSMSTest.cspkg";
320+
}
321+
$cscfg = "$TestOutputRoot\Resources\ServiceManagement\Files\dSMSTest.cscfg";
322+
$cscfgChanged = "$TestOutputRoot\Resources\ServiceManagement\Files\dSMSTest-changed.cscfg";
323+
$certFile = "$TestOutputRoot\Resources\ServiceManagement\Files\example.pfx";
324+
325+
try
326+
{
327+
# Create Hosted Service
328+
$result = New-AzureService -ServiceName $svcName -Location $location -Label $svcName -Description $svcName;
329+
330+
# Upload the certificate
331+
Add-AzureCertificate -ServiceName $svcName -CertToDeploy $certFile -Password "pass@word1*";
332+
333+
# Deploy to staging
334+
$result = New-AzureDeployment -ServiceName $svcName -Package $cspkg -Configuration $cscfg -Label $svcName -Slot Staging;
335+
336+
# Get Deployment
337+
$deploy = Get-AzureDeployment -ServiceName $svcName -Slot Staging;
338+
339+
# Make a change
340+
$newConfig = $deploy.Configuration -replace 'Setting name="DummySetting" value="Foo"', 'Setting name="DummySetting" value="Bar"';
341+
$newConfig | Set-Content $cscfgChanged;
342+
343+
# Update configuration
344+
$result = Set-AzureDeployment -Config -ServiceName $svcName -Configuration $cscfgChanged -Slot Staging;
345+
}
346+
finally
347+
{
348+
# Cleanup
349+
Cleanup-CloudService $svcName;
350+
Cleanup-Storage $storageName;
351+
if (Test-Path $cscfgChanged)
352+
{
353+
Remove-Item $cscfgChanged;
354+
}
355+
}
356+
}
299357

300358
# Run New-AzureComputeArgumentList Cmdlet Tests Using Method Names
301359
function Run-NewAzureComputeArgumentListTests

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,15 @@ public void RunAutoGeneratedVirtualMachineCmdletTests()
7979
this.RunPowerShellTest("Run-AutoGeneratedVirtualMachineCmdletTests");
8080
}
8181

82+
[Fact]
83+
[Trait(Category.Service, Category.ServiceManagement)]
84+
[Trait(Category.AcceptanceType, Category.CheckIn)]
85+
[Trait(Category.AcceptanceType, Category.BVT)]
86+
public void RunDSMSHostedServiceTest()
87+
{
88+
this.RunPowerShellTest("Run-DSMSHostedServiceTest");
89+
}
90+
8291
[Fact]
8392
[Trait(Category.Service, Category.ServiceManagement)]
8493
[Trait(Category.AcceptanceType, Category.CheckIn)]

src/ServiceManagement/Common/Commands.ScenarioTest/SessionRecords/Microsoft.WindowsAzure.Commands.ScenarioTest.ServiceManagementTests/RunDSMSHostedServiceTest.json

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

0 commit comments

Comments
 (0)