-
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 pull request #16 from balukambala/dev
Scenario tests, DSC reportId/NodeId fixes
- Loading branch information
Showing
15 changed files
with
581 additions
and
7 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
65 changes: 65 additions & 0 deletions
65
...eManager/Automation/Commands.Automation.Test/ScenarioTests/AutomationScenarioTestsBase.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,65 @@ | ||
// ---------------------------------------------------------------------------------- | ||
// | ||
// 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.Common.Authentication; | ||
using Microsoft.Azure.Management.Resources; | ||
using Microsoft.Azure.Subscriptions; | ||
using Microsoft.WindowsAzure.Commands.ScenarioTest; | ||
using Microsoft.Azure.Test; | ||
using Microsoft.Azure.Management.Automation; | ||
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; | ||
|
||
namespace Microsoft.Azure.Commands.Automation.Test | ||
{ | ||
public abstract class AutomationScenarioTestsBase : RMTestBase | ||
{ | ||
private EnvironmentSetupHelper helper; | ||
|
||
protected AutomationScenarioTestsBase() | ||
{ | ||
helper = new EnvironmentSetupHelper(); | ||
} | ||
|
||
protected void SetupManagementClients() | ||
{ | ||
var automationManagementClient = GetAutomationManagementClient(); | ||
|
||
helper.SetupManagementClients(automationManagementClient); | ||
} | ||
|
||
protected void RunPowerShellTest(params string[] scripts) | ||
{ | ||
using (UndoContext context = UndoContext.Current) | ||
{ | ||
context.Start(TestUtilities.GetCallingClass(2), TestUtilities.GetCurrentMethodName(2)); | ||
|
||
SetupManagementClients(); | ||
|
||
helper.SetupEnvironment(AzureModule.AzureResourceManager); | ||
|
||
helper.SetupModules(AzureModule.AzureResourceManager, | ||
"ScenarioTests\\" + this.GetType().Name + ".ps1", | ||
helper.RMProfileModule, | ||
helper.GetRMModulePath(@"AzureRM.Automation.psd1")); | ||
|
||
helper.RunPowerShellTest(scripts); | ||
} | ||
} | ||
|
||
protected AutomationManagementClient GetAutomationManagementClient() | ||
{ | ||
return TestBase.GetServiceClient<AutomationManagementClient>(new CSMTestEnvironmentFactory()); | ||
} | ||
} | ||
} |
78 changes: 78 additions & 0 deletions
78
src/ResourceManager/Automation/Commands.Automation.Test/ScenarioTests/AutomationTests.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,78 @@ | ||
// ---------------------------------------------------------------------------------- | ||
// | ||
// 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.WindowsAzure.Commands.ScenarioTest; | ||
using Xunit; | ||
|
||
namespace Microsoft.Azure.Commands.Automation.Test | ||
{ | ||
public class AutomationTests : AutomationScenarioTestsBase | ||
{ | ||
[Fact(Skip = "Fix to make x86 compatible.")] | ||
[Trait(Category.AcceptanceType, Category.CheckIn)] | ||
[Trait(Category.Service, Category.Automation)] | ||
public void TestAutomationStartAndStopRunbook() | ||
{ | ||
RunPowerShellTest("Test-AutomationStartAndStopRunbook -runbookPath ScenarioTests\\Resources\\Test-Workflow.ps1"); | ||
} | ||
|
||
[Fact(Skip = "Fix to make x86 compatible.")] | ||
[Trait(Category.AcceptanceType, Category.CheckIn)] | ||
[Trait(Category.Service, Category.Automation)] | ||
public void TestAutomationPublishAndEditRunbook() | ||
{ | ||
RunPowerShellTest("Test-AutomationPublishAndEditRunbook -runbookPath ScenarioTests\\Resources\\Test-Workflow.ps1 -editRunbookPath Resources\\Automation\\Test-WorkflowV2.ps1"); | ||
} | ||
|
||
[Fact(Skip = "Fix to make x86 compatible.")] | ||
[Trait(Category.AcceptanceType, Category.CheckIn)] | ||
[Trait(Category.Service, Category.Automation)] | ||
public void TestAutomationConfigureRunbook() | ||
{ | ||
RunPowerShellTest("Test-AutomationConfigureRunbook -runbookPath ScenarioTests\\Resources\\Write-DebugAndVerboseOutput.ps1"); | ||
} | ||
|
||
[Fact] | ||
[Trait(Category.Service, Category.Automation)] | ||
[Trait(Category.RunType, Category.LiveOnly)] | ||
public void TestAutomationSuspendAndResumeJob() | ||
{ | ||
RunPowerShellTest("Test-AutomationSuspendAndResumeJob -runbookPath ScenarioTests\\Resources\\Use-WorkflowCheckpointSample.ps1"); | ||
} | ||
|
||
[Fact] | ||
[Trait(Category.Service, Category.Automation)] | ||
[Trait(Category.RunType, Category.LiveOnly)] | ||
public void TestAutomationStartRunbookOnASchedule() | ||
{ | ||
RunPowerShellTest("Test-AutomationStartRunbookOnASchedule -runbookPath ScenarioTests\\Resources\\Test-Workflow.ps1"); | ||
} | ||
|
||
[Fact(Skip = "Fix to make x86 compatible.")] | ||
[Trait(Category.AcceptanceType, Category.CheckIn)] | ||
[Trait(Category.Service, Category.Automation)] | ||
public void TestAutomationStartUnpublishedRunbook() | ||
{ | ||
RunPowerShellTest("Test-AutomationStartUnpublishedRunbook -runbookPath ScenarioTests\\Resources\\Test-WorkFlowWithVariousParameters.ps1"); | ||
} | ||
|
||
[Fact(Skip = "Fix to make x86 compatible.")] | ||
[Trait(Category.AcceptanceType, Category.CheckIn)] | ||
[Trait(Category.Service, Category.Automation)] | ||
public void TestAutomationRunbookWithParameter() | ||
{ | ||
RunPowerShellTest("Test-RunbookWithParameter -runbookPath ScenarioTests\\Resources\\fastJob.ps1 @{'nums'='[1,2,3,4,5,6,7]'} 28"); | ||
} | ||
} | ||
} |
Oops, something went wrong.