From 5b952b43d51e0c324be904d5bcebb9480c09d533 Mon Sep 17 00:00:00 2001 From: Amar Zavery Date: Tue, 3 Mar 2015 18:48:10 -0800 Subject: [PATCH] modified installation tests --- tools/InstallationTests/InstallationTest.ps1 | 12 ++++----- .../RunInstallationTests.ps1 | 27 +++++++++++++++++-- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/tools/InstallationTests/InstallationTest.ps1 b/tools/InstallationTests/InstallationTest.ps1 index 779312ea6632..06ca950e68c3 100644 --- a/tools/InstallationTests/InstallationTest.ps1 +++ b/tools/InstallationTests/InstallationTest.ps1 @@ -43,12 +43,10 @@ function Test-UpdateStorageAccount Assert-AreEqual $storageAccountName $accounts[1].StorageAccountName } -function Test-GetBatchAccountWithSubscriptionDataFile +[CmdletBinding] +function Get-IncompleteHelp { - param([PSCredential] $credential) - Get-AzureSubscription | Remove-AzureSubscription -Force - $account = Add-AzureAccount -Credential $credential -SubscriptionDataFile "File.txt" - Select-AzureSubscription -SubscriptionId $account.Subscriptions.Split("`r`n")[0] -SubscriptionDataFile "File.txt" - Get-AzureBatchAccount - Add-AzureAccount -Credential $credential + Get-Help azure | where {[System.String]::IsNullOrEmpty($_.Synopsis) -or ` + [System.String]::Equals($_.Synopsis, (Get-Command $_.Name).Definition, ` + [System.StringComparison]::OrdinalIgnoreCase)} | % {Write-Output $_.Name} } \ No newline at end of file diff --git a/tools/InstallationTests/RunInstallationTests.ps1 b/tools/InstallationTests/RunInstallationTests.ps1 index e0b238ecc4c5..4371338900df 100644 --- a/tools/InstallationTests/RunInstallationTests.ps1 +++ b/tools/InstallationTests/RunInstallationTests.ps1 @@ -24,6 +24,8 @@ $global:passedTests = @() $global:failedTests = @() $global:times = @{} $VerbosePreference = "SilentlyContinue" + + function Run-TestProtected { param([ScriptBlock]$script, [string] $testName) @@ -100,6 +102,9 @@ Get-AzureSubscription | Remove-AzureSubscription -Force Add-AzureAccount -Credential $credential $ErrorActionPreference = "Stop" Switch-AzureMode AzureServiceManagement +$subscription = $(Get-AzureSubscription -Current).SubscriptionName +$profile = $(New-AzureProfile -SubscriptionId $subscription -Credential $credential) +Select-AzureProfile $profile $global:startTime = Get-Date Run-TestProtected { Test-SetAzureStorageBlobContent } "Test-SetAzureStorageBlobContent" Run-TestProtected { Test-GetModuleVersion $expectedVersion} "Test-GetModuleVersion" @@ -107,7 +112,9 @@ Run-TestProtected { Test-UpdateStorageAccount } "Test-UpdateStorageAccount" $serviceCommands | % { Run-TestProtected $_ $_.ToString() } Write-Host -ForegroundColor Green "STARTING RESOURCE MANAGER TESTS" Switch-AzureMode AzureResourceManager > $null -Run-TestProtected { Test-GetBatchAccountWithSubscriptionDataFile $credential} "Test-GetBatchAccountWithSubscriptionDataFile" +$subscription = $(Get-AzureSubscription -Current).SubscriptionName +$profile = $(New-AzureProfile -SubscriptionId $subscription -Credential $credential) +Select-AzureProfile $profile $resourceCommands | % { Run-TestProtected $_ $_.ToString() } Write-Host Write-Host -ForegroundColor Green "$global:passedCount / $global:totalCount Installation Tests Pass" @@ -134,5 +141,21 @@ Write-Host Write-Host -ForegroundColor Green "Start Time: $global:startTime" Write-Host -ForegroundColor Green "End Time: $global:endTime" Write-Host -ForegroundColor Green "Elapsed: "($global:endTime - $global:startTime).ToString() +Write-Host "=============================================================================================" +Write-Host +Write-Host "====================" +Write-Host "Help Check: ARM Mode" +Write-Host "====================" +Switch-AzureMode AzureResourceManager +Get-IncompleteHelp +Write-Host +Write-Host "====================" +Write-Host "Help Check: ASM Mode" +Write-Host "====================" +Switch-AzureMode AzureServiceManagement +Get-IncompleteHelp +Write-Host +Write-Host "=============================================================================================" +Write-Host -$ErrorActionPreference = "Continue" +$ErrorActionPreference = "Continue" \ No newline at end of file