Skip to content

Commit

Permalink
Merge pull request AzureRT#16 from balukambala/dev
Browse files Browse the repository at this point in the history
Scenario tests, DSC reportId/NodeId fixes
  • Loading branch information
safeermohammed committed Jan 26, 2016
2 parents 363e815 + a0a4924 commit 862f6ce
Show file tree
Hide file tree
Showing 15 changed files with 581 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@
<HintPath>..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5785.18045-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.Management.Automation">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Automation.2.0.0\lib\net40\Microsoft.Azure.Management.Automation.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Test.Framework">
<HintPath>..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5785.18045-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll</HintPath>
Expand Down Expand Up @@ -135,6 +141,8 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ScenarioTests\AutomationScenarioTestsBase.cs" />
<Compile Include="ScenarioTests\AutomationTests.cs" />
<Compile Include="UnitTests\GetAzureAutomationCertificateTest.cs" />
<Compile Include="UnitTests\GetAzureAutomationConnectionTest.cs" />
<Compile Include="UnitTests\GetAzureAutomationCredentialTest.cs" />
Expand Down Expand Up @@ -195,7 +203,29 @@
<ItemGroup>
<None Include="MSSharedLibKey.snk" />
<None Include="packages.config" />
<None Include="ScenarioTests\AutomationTests.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ScenarioTests\Resources\fastjob.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ScenarioTests\Resources\Test-Workflow.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ScenarioTests\Resources\Test-WorkflowV2.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ScenarioTests\Resources\Test-WorkFlowWithVariousParameters.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ScenarioTests\Resources\Use-WorkflowCheckpointSample.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ScenarioTests\Resources\Write-DebugAndVerboseOutput.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
</Project>
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());
}
}
}
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");
}
}
}
Loading

0 comments on commit 862f6ce

Please sign in to comment.