Skip to content

Commit c47b208

Browse files
authored
Merge pull request #5301 from MiYanni/TestAutomation
Test automation
2 parents 359c7a6 + d0464dd commit c47b208

File tree

49 files changed

+86544
-8901
lines changed

Some content is hidden

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

49 files changed

+86544
-8901
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,4 +212,8 @@ FakesAssemblies/
212212
*.GhostDoc.xml
213213
pingme.txt
214214
groupMapping*.json
215-
.vscode/
215+
.vscode/
216+
/tools/AutomationTestFramework/RunBooks
217+
/tools/AutomationTestFramework/TestHelpers/TestHelpers.zip
218+
Results
219+
Package

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ function getRandomItemName {
364364
$prefix = "ps";
365365
}
366366

367-
$str = $prefix + ((Get-Random) % 10000);
367+
$str = $prefix + (([guid]::NewGuid().ToString() -replace '-','')[0..9] -join '');
368368
return $str;
369369
}
370370

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ Update-AzureRmVmssInstance 1.2.4 AzureRM.Compute
5151
<#
5252
.SYNOPSIS
5353
Test Virtual Machine Scale Set
54+
.DESCRIPTION
55+
Smoke[Ignore]Test
5456
#>
5557
function Test-VirtualMachineScaleSet
5658
{

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
<#
1616
.SYNOPSIS
1717
Test Virtual Machines
18+
.DESCRIPTION
19+
SmokeTest
1820
#>
1921
function Test-VirtualMachine
2022
{

src/ResourceManager/KeyVault/Commands.KeyVault.Test/Scripts/VaultSecretTests.ps1

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ function BulkCreateSecretVersions ($vault, $name, $total)
5151
<#
5252
.SYNOPSIS
5353
Create a secret with default attributes
54+
.DESCRIPTION
55+
SmokeTest
5456
#>
5557

5658
function Test_CreateSecret
@@ -67,6 +69,8 @@ function Test_CreateSecret
6769
<#
6870
.SYNOPSIS
6971
Create a secret with custom attributes
72+
.DESCRIPTION
73+
SmokeTest
7074
#>
7175

7276
function Test_CreateSecretWithCustomAttributes
@@ -84,6 +88,8 @@ function Test_CreateSecretWithCustomAttributes
8488
<#
8589
.SYNOPSIS
8690
Update a secret
91+
.DESCRIPTION
92+
SmokeTest
8793
#>
8894

8995
function Test_UpdateSecret
@@ -157,6 +163,8 @@ function Test_SetSecretInNoPermissionVault
157163
<#
158164
.SYNOPSIS
159165
Tests update individual secret attributes
166+
.DESCRIPTION
167+
SmokeTest
160168
#>
161169
function Test_UpdateIndividualSecretAttributes
162170
{
@@ -392,8 +400,9 @@ function Test_SetSecretAttrInNoPermissionVault
392400
<#
393401
.SYNOPSIS
394402
Tests get one secret from key vault
403+
.DESCRIPTION
404+
SmokeTest
395405
#>
396-
397406
function Test_GetOneSecret
398407
{
399408
$keyVault = Get-KeyVault
@@ -413,8 +422,9 @@ function Test_GetOneSecret
413422
<#
414423
.SYNOPSIS
415424
Tests get all secrets from key vault
425+
.DESCRIPTION
426+
SmokeTest
416427
#>
417-
418428
function Test_GetAllSecrets
419429
{
420430
$keyVault = Get-KeyVault
@@ -551,6 +561,8 @@ function Test_GetSecretInNoPermissionVault
551561
<#
552562
.SYNOPSIS
553563
Tests remove a secret
564+
.DESCRIPTION
565+
SmokeTest
554566
#>
555567
function Test_RemoveSecretWithoutPrompt
556568
{
@@ -660,6 +672,8 @@ function Test_RemoveSecretInNoPermissionVault
660672
<#
661673
.SYNOPSIS
662674
Tests backup and restoring of a secret by name
675+
.DESCRIPTION
676+
SmokeTest
663677
#>
664678
function Test_BackupRestoreSecretByName
665679
{
@@ -831,8 +845,9 @@ function Test_PipelineRemoveSecrets
831845
<#
832846
.SYNOPSIS
833847
Tests getting a previously deleted secret
848+
.DESCRIPTION
849+
SmokeTest
834850
#>
835-
836851
function Test_GetDeletedSecret
837852
{
838853
# Create a software secret for deleting
@@ -855,8 +870,9 @@ function Test_GetDeletedSecret
855870
<#
856871
.SYNOPSIS
857872
Tests listing all previously deleted secrets
873+
.DESCRIPTION
874+
SmokeTest
858875
#>
859-
860876
function Test_GetDeletedSecrets
861877
{
862878
$keyVault = Get-KeyVault
@@ -877,8 +893,9 @@ function Test_GetDeletedSecrets
877893
<#
878894
.SYNOPSIS
879895
Tests recovering a previously deleted secret.
896+
.DESCRIPTION
897+
SmokeTest
880898
#>
881-
882899
function Test_UndoRemoveSecret
883900
{
884901
# Create a software secret for updating
@@ -902,8 +919,9 @@ function Test_UndoRemoveSecret
902919
<#
903920
.SYNOPSIS
904921
Tests purging a deleted secret for good.
922+
.DESCRIPTION
923+
SmokeTest
905924
#>
906-
907925
function Test_RemoveDeletedSecret
908926
{
909927
# Create a software key for updating

src/ResourceManager/Network/Commands.Network.Test/ScenarioTests/VirtualNetworkTests.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
<#
1616
.SYNOPSIS
1717
Tests creating new simple virtualNetwork.
18+
.DESCRIPTION
19+
SmokeTest
1820
#>
1921
function Test-VirtualNetworkCRUD
2022
{
@@ -100,6 +102,8 @@ function Test-VirtualNetworkCRUD
100102
<#
101103
.SYNOPSIS
102104
Tests creating new simple virtualNetwork and subnets.
105+
.DESCRIPTION
106+
SmokeTest
103107
#>
104108
function Test-subnetCRUD
105109
{
@@ -425,6 +429,8 @@ function Test-ResourceNavigationLinksCRUD
425429
<#
426430
.SYNOPSIS
427431
Tests checking Virtual Network Usage feature.
432+
.DESCRIPTION
433+
SmokeTest
428434
#>
429435
function Test-VirtualNetworkUsage
430436
{

src/ResourceManager/Profile/Commands.Profile.Test/SubscriptionCmdletTests.ps1

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
<#
1616
.SYNOPSIS
1717
Tests each of the major parts of retrieving subscriptions in ARM mode
18+
.DESCRIPTION
19+
SmokeTest
1820
#>
1921
function Test-GetSubscriptionsEndToEnd
2022
{
@@ -44,6 +46,12 @@ function Test-GetSubscriptionsEndToEnd
4446
Assert-True {$tenantSubscriptions.Count -gt 0}
4547
}
4648

49+
<#
50+
.SYNOPSIS
51+
Tests each of the major parts of retrieving subscriptions in ARM mode
52+
.DESCRIPTION
53+
SmokeTest
54+
#>
4755
function Test-PipingWithContext
4856
{
4957
$allSubscriptions = Get-AzureRmSubscription
@@ -70,6 +78,10 @@ function Test-PipingWithContext
7078
Assert-AreEqual $contextByName.Subscription.Name $nameContext.Subscription.Name
7179
}
7280

81+
<#
82+
.SYNOPSIS
83+
Tests each of the major parts of retrieving subscriptions in ARM mode
84+
#>
7385
function Test-SetAzureRmContextEndToEnd
7486
{
7587
# This test requires that the tenant contains atleast two subscriptions
@@ -84,6 +96,12 @@ function Test-SetAzureRmContextEndToEnd
8496
Assert-ThrowsContains {Set-AzureRmContext -SubscriptionId $junkSubscriptionId} "provide a valid"
8597
}
8698

99+
<#
100+
.SYNOPSIS
101+
Tests each of the major parts of retrieving subscriptions in ARM mode
102+
.DESCRIPTION
103+
SmokeTest
104+
#>
87105
function Test-SetAzureRmContextWithoutSubscription
88106
{
89107
$allSubscriptions = Get-AzureRmSubscription

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ Gets the default location for a provider
3636
#>
3737
function Get-ProviderLocation($provider)
3838
{
39-
if ([Microsoft.Azure.Test.HttpRecorder.HttpMockServer]::Mode -ne [Microsoft.Azure.Test.HttpRecorder.HttpRecorderMode]::Playback)
39+
$assemblies = [AppDomain]::Currentdomain.GetAssemblies() | Select-Object FullName | ForEach-Object { $_.FullName.Substring(0, $_.FullName.IndexOf(',')) }
40+
if ($assemblies -notcontains 'Microsoft.Azure.Test.HttpRecorder.HttpMockServer' `
41+
-or $assemblies -notcontains 'Microsoft.Azure.Test.HttpRecorder.HttpRecorderMode' `
42+
-or [Microsoft.Azure.Test.HttpRecorder.HttpMockServer]::Mode -ne [Microsoft.Azure.Test.HttpRecorder.HttpRecorderMode]::Playback)
4043
{
4144
$namespace = $provider.Split("/")[0]
4245
if($provider.Contains("/"))
@@ -74,7 +77,10 @@ Cleans the created resource groups
7477
#>
7578
function Clean-ResourceGroup($rgname)
7679
{
77-
if ([Microsoft.Azure.Test.HttpRecorder.HttpMockServer]::Mode -ne [Microsoft.Azure.Test.HttpRecorder.HttpRecorderMode]::Playback) {
80+
$assemblies = [AppDomain]::Currentdomain.GetAssemblies() | Select-Object FullName | ForEach-Object { $_.FullName.Substring(0, $_.FullName.IndexOf(',')) }
81+
if ($assemblies -notcontains 'Microsoft.Azure.Test.HttpRecorder.HttpMockServer' `
82+
-or $assemblies -notcontains 'Microsoft.Azure.Test.HttpRecorder.HttpRecorderMode' `
83+
-or [Microsoft.Azure.Test.HttpRecorder.HttpMockServer]::Mode -ne [Microsoft.Azure.Test.HttpRecorder.HttpRecorderMode]::Playback) {
7884
Remove-AzureRmResourceGroup -Name $rgname -Force
7985
}
8086
}

src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/DeploymentTests.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ function Test-ValidateDeployment
3636
<#
3737
.SYNOPSIS
3838
Tests deployment via template file and parameter object.
39+
.DESCRIPTION
40+
Smoke[Broken]Test
3941
#>
4042
function Test-NewDeploymentFromTemplateFile
4143
{
@@ -70,6 +72,8 @@ function Test-NewDeploymentFromTemplateFile
7072
<#
7173
.SYNOPSIS
7274
Tests cross resource group deployment via template file.
75+
.DESCRIPTION
76+
Smoke[Broken]Test
7377
#>
7478
function Test-CrossResourceGroupDeploymentFromTemplateFile
7579
{
@@ -141,6 +145,8 @@ function Test-NestedErrorsDisplayed
141145
<#
142146
.SYNOPSIS
143147
Tests nested deployment.
148+
.DESCRIPTION
149+
Smoke[Broken]Test
144150
#>
145151
function Test-NestedDeploymentFromTemplateFile
146152
{
@@ -175,6 +181,8 @@ function Test-NestedDeploymentFromTemplateFile
175181
<#
176182
.SYNOPSIS
177183
Tests save deployment template file.
184+
.DESCRIPTION
185+
Smoke[Broken]Test
178186
#>
179187
function Test-SaveDeploymentTemplateFile
180188
{

0 commit comments

Comments
 (0)