-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'preview' into feature/repairswagger
- Loading branch information
Showing
340 changed files
with
209,076 additions
and
1,626 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/ResourceManager/Automation/Commands.Automation.Test/ScenarioTests/AccountTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// ---------------------------------------------------------------------------------- | ||
// | ||
// Copyright Microsoft Corporation | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// ---------------------------------------------------------------------------------- | ||
|
||
using Microsoft.Azure.ServiceManagemenet.Common.Models; | ||
using Microsoft.WindowsAzure.Commands.ScenarioTest; | ||
using Xunit; | ||
|
||
namespace Microsoft.Azure.Commands.Automation.Test | ||
{ | ||
public class AccountTests : AutomationScenarioTestsBase | ||
{ | ||
public XunitTracingInterceptor _logger; | ||
|
||
public AccountTests(Xunit.Abstractions.ITestOutputHelper output) | ||
{ | ||
_logger = new XunitTracingInterceptor(output); | ||
XunitTracingInterceptor.AddToContext(_logger); | ||
} | ||
|
||
[Fact] | ||
[Trait(Category.AcceptanceType, Category.CheckIn)] | ||
[Trait(Category.Service, Category.Automation)] | ||
public void TestGetAutomationAccts() | ||
{ | ||
RunPowerShellTest(_logger, "Test-GetAutomationAccounts"); | ||
} | ||
|
||
[Fact] | ||
[Trait(Category.AcceptanceType, Category.CheckIn)] | ||
[Trait(Category.Service, Category.Automation)] | ||
public void TestAutomationAcctTags() | ||
{ | ||
RunPowerShellTest(_logger, "Test-AutomationAccountTags"); | ||
} | ||
} | ||
} |
109 changes: 109 additions & 0 deletions
109
src/ResourceManager/Automation/Commands.Automation.Test/ScenarioTests/AccountTests.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
# ---------------------------------------------------------------------------------- | ||
# | ||
# Copyright Microsoft Corporation | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# ---------------------------------------------------------------------------------- | ||
|
||
$newAccountName='account-powershell-test' | ||
$existingResourceGroup='PowerShellTest' | ||
$location = "West Central US" | ||
|
||
########################################################################### Automation Scenario Tests ########################################################################### | ||
|
||
######### $accountName and $subscriptionName should be provided in variables.yml in order to run the following Test Cases ####################### | ||
|
||
<# | ||
.SYNOPSIS | ||
Check if test account exists and remove it | ||
#> | ||
function CleanupExistingTestAccount | ||
{ | ||
$check = Get-AzureRmAutomationAccount -ResourceGroupName $existingResourceGroup -Name $newAccountName -ErrorAction SilentlyContinue | ||
if ($null -ne $check) | ||
{ | ||
Remove-AzureRmAutomationAccount -ResourceGroupName $existingResourceGroup -Name $newAccountName -Force | ||
} | ||
} | ||
|
||
function CreateResourceGroup | ||
{ | ||
$check = Get-AzureRmResourceGroup -Name $existingResourceGroup -Location $location -ErrorAction SilentlyContinue | ||
if ($null -eq $check) | ||
{ | ||
New-AzureRmResourceGroup -Name $existingResourceGroup -Location $location -Force | ||
} | ||
} | ||
<# | ||
.SYNOPSIS | ||
Create Test Automation Account | ||
#> | ||
function CreateTestAccount | ||
{ | ||
return New-AzureRmAutomationAccount -ResourceGroupName $existingResourceGroup -Name $newAccountName -Location $location | ||
} | ||
|
||
<# | ||
.SYNOPSIS | ||
Tests Runbook with Parameters | ||
#> | ||
function Test-GetAutomationAccounts | ||
{ | ||
# setup | ||
CreateResourceGroup | ||
CleanupExistingTestAccount | ||
|
||
# get all accounts | ||
$automationAccounts = Get-AzureRmAutomationAccount | ||
Assert-NotNull $automationAccounts "Get All automation accounts return null." | ||
|
||
$existingAccountCount = $automationAccounts.Count | ||
|
||
$newAutomationAccount = CreateTestAccount | ||
Assert-NotNull $newAutomationAccount "Create Account Failed." | ||
|
||
#Test | ||
$automationAccounts = Get-AzureRmAutomationAccount | ||
|
||
$newAccountCount = $automationAccounts.Count | ||
Assert-AreEqual ($existingAccountCount+1) $newAccountCount "There should have only 1 more account" | ||
|
||
CleanupExistingTestAccount | ||
} | ||
|
||
<# | ||
.SYNOPSIS | ||
Tests of Start and Stop RunBook | ||
#> | ||
function Test-AutomationAccountTags | ||
{ | ||
# setup | ||
CreateResourceGroup | ||
CleanupExistingTestAccount | ||
$newAutomationAccount = CreateTestAccount | ||
Assert-AreEqual $newAutomationAccount.Tags.Count 0 "Unexpected Tag Counts" | ||
|
||
# re-put using new | ||
$newAutomationAccount = New-AzureRmAutomationAccount -ResourceGroupName $existingResourceGroup -Name $newAccountName -Location $location -Tags @{"abc"="def"; "gg"="hh"} | ||
Assert-AreEqual $newAutomationAccount.Tags.Count 2 "Unexpected Tag Counts from new" | ||
Assert-AreEqual $newAutomationAccount.Tags["gg"] "hh" "Unexpected Tag Content from new" | ||
|
||
# use Set | ||
$newAutomationAccount = Set-AzureRmAutomationAccount -ResourceGroupName $existingResourceGroup -Name $newAccountName -Tags @{"lm"="jk"} | ||
Assert-AreEqual $newAutomationAccount.Tags.Count 1 "Unexpected Tag Counts from set" | ||
Assert-AreEqual $newAutomationAccount.Tags["lm"] "jk" "Unexpected Tag Content from set" | ||
|
||
# test tag from accounts | ||
$newAutomationAccount = Get-AzureRmAutomationAccount | Where-Object {$_.AutomationAccountName -eq $newAccountName } | ||
Assert-AreEqual $newAutomationAccount.Tags.Count 1 "Unexpected Tag Counts from get all" | ||
Assert-AreEqual $newAutomationAccount.Tags["lm"] "jk" "Unexpected Tag Content from get all" | ||
|
||
CleanupExistingTestAccount | ||
} |
Oops, something went wrong.