Skip to content

Commit c24ba1f

Browse files
authored
Merge branch 'preview' into filcopycontext
2 parents 72f99e8 + 2cb2c72 commit c24ba1f

File tree

140 files changed

+17551
-594
lines changed

Some content is hidden

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

140 files changed

+17551
-594
lines changed

src/ResourceManager/Automation/Commands.Automation.Test/Commands.Automation.Test.Netcore.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
<None Update="ScenarioTests\*.ps1">
4848
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
4949
</None>
50+
<None Update="ScenarioTests\*.cer">
51+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
52+
</None>
5053
<None Update="ScenarioTests\Resources\*.*">
5154
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
5255
</None>

src/ResourceManager/Automation/Commands.Automation.Test/Commands.Automation.Test.csproj

Lines changed: 13 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,18 @@
6262
<Compile Include="ScenarioTests\AccountTests.cs" />
6363
<Compile Include="ScenarioTests\AutomationScenarioTestsBase.cs" />
6464
<Compile Include="ScenarioTests\AutomationTests.cs" />
65+
<Compile Include="ScenarioTests\CertificateTests.cs" />
66+
<Compile Include="ScenarioTests\ConnectionTests.cs" />
67+
<Compile Include="ScenarioTests\CredentialTests.cs" />
6568
<Compile Include="ScenarioTests\HybridWorkerGroupTests.cs" />
69+
<Compile Include="ScenarioTests\JobScheduleTests.cs" />
70+
<Compile Include="ScenarioTests\ModuleTests.cs" />
71+
<Compile Include="ScenarioTests\ScheduleTests.cs" />
72+
<Compile Include="ScenarioTests\VariableTests.cs" />
6673
<Compile Include="ScenarioTests\RunbookJobTests.cs" />
6774
<Compile Include="ScenarioTests\SourceControlTests.cs" />
6875
<Compile Include="ScenarioTests\UpdateManagementTests.cs" />
76+
<Compile Include="ScenarioTests\WebhookTests.cs" />
6977
<Compile Include="UnitTests\GetAzureAutomationDscNodeConfigurationDeploymentSchedulesTest.cs" />
7078
<Compile Include="UnitTests\GetAzureAutomationDscNodeConfigurationTest.cs" />
7179
<Compile Include="UnitTests\GetAzureAutomationDscNodeReportTest.cs" />
@@ -126,122 +134,16 @@
126134
<ItemGroup>
127135
<None Include="MSSharedLibKey.snk" />
128136
<None Include="packages.config" />
129-
<None Include="ScenarioTests\AccountTests.ps1">
137+
<None Include="SessionRecords\**\*.json">
130138
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
131139
</None>
132-
<None Include="ScenarioTests\AutomationTests.ps1">
140+
<None Include="ScenarioTests\*.ps1">
133141
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
134142
</None>
135-
<None Include="ScenarioTests\HybridWorkerGroupTests.ps1">
143+
<None Include="ScenarioTests\*.cer">
136144
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
137-
</None>
138-
<None Include="ScenarioTests\Resources\RB-GraphTutorial.graphrunbook">
139-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
140-
</None>
141-
<None Include="ScenarioTests\Resources\RB-PowerShellScriptTutorial.ps1">
142-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
143-
</None>
144-
<None Include="ScenarioTests\RunbookJobTests.ps1">
145-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
146-
</None>
147-
<None Include="ScenarioTests\SourceControlTests.ps1">
148-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
149-
</None>
150-
<None Include="ScenarioTests\UpdateManagementTests.ps1">
151-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
152-
</None>
153-
<None Include="ScenarioTests\Resources\fastjob.ps1">
154-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
155-
</None>
156-
<None Include="ScenarioTests\Resources\ContosoDscConfiguration.ps1" />
157-
<None Include="ScenarioTests\Resources\Test-Workflow.ps1">
158-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
159-
</None>
160-
<None Include="ScenarioTests\Resources\Test-WorkflowV2.ps1">
161-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
162-
</None>
163-
<None Include="ScenarioTests\Resources\Test-WorkFlowWithVariousParameters.ps1">
164-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
165-
</None>
166-
<None Include="ScenarioTests\Resources\Use-WorkflowCheckpointSample.ps1">
167-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
168-
</None>
169-
<None Include="ScenarioTests\Resources\Write-DebugAndVerboseOutput.ps1">
170-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
171-
</None>
172-
</ItemGroup>
173-
<ItemGroup />
174-
<ItemGroup>
175-
<Content Include="SessionRecords\Microsoft.Azure.Commands.Automation.Test.AccountTests\*.json">
176-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
177-
</Content>
178-
<Content Include="SessionRecords\Commands.Automation.Test.SourceControlTests\CreateGitHubSourceControlAndSync.json">
179-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
180-
</Content>
181-
<Content Include="SessionRecords\Commands.Automation.Test.SourceControlTests\CreateVsoGitSourceControlAndSync.json">
182-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
183-
</Content>
184-
<Content Include="SessionRecords\Commands.Automation.Test.SourceControlTests\CreateVsoTfvcSourceControlAndSync.json">
185-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
186-
</Content>
187-
<Content Include="SessionRecords\Commands.Automation.Test.HybridWorkerGroupTests\E2EHybridWorkerGroup.json">
188-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
189-
</Content>
190-
<Content Include="SessionRecords\Commands.Automation.Test.UpdateManagementTests\CreateLinuxWeeklySUC.json">
191-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
192-
</Content>
193-
<Content Include="SessionRecords\Commands.Automation.Test.UpdateManagementTests\CreateWindowsMonthlySUC.json">
194-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
195-
</Content>
196-
<Content Include="SessionRecords\Commands.Automation.Test.UpdateManagementTests\CreateLinuxOneTimeSUCNonAzureOnly.json">
197-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
198-
</Content>
199-
<Content Include="SessionRecords\Commands.Automation.Test.UpdateManagementTests\CreateLinuxOneTimeSUCWithAllOption.json">
200-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
201-
</Content>
202-
<Content Include="SessionRecords\Commands.Automation.Test.UpdateManagementTests\CreateLinuxOneTimeSUCWithDefaults.json">
203-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
204-
</Content>
205-
<Content Include="SessionRecords\Commands.Automation.Test.UpdateManagementTests\CreateWindowsOneTimeSUCWithAllOption.json">
206-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
207-
</Content>
208-
<Content Include="SessionRecords\Commands.Automation.Test.UpdateManagementTests\CreateWindowsOneTimeSUCWithDefaults.json">
209-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
210-
</Content>
211-
<Content Include="SessionRecords\Commands.Automation.Test.UpdateManagementTests\DeleteSUC.json">
212-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
213-
</Content>
214-
<Content Include="SessionRecords\Commands.Automation.Test.UpdateManagementTests\GetAllMachineRuns.json">
215-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
216-
</Content>
217-
<Content Include="SessionRecords\Commands.Automation.Test.UpdateManagementTests\GetAllMachineRunsWithFilters.json">
218-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
219-
</Content>
220-
<Content Include="SessionRecords\Commands.Automation.Test.UpdateManagementTests\GetAllMachineRunsWithFiltersNoResults.json">
221-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
222-
</Content>
223-
<Content Include="SessionRecords\Commands.Automation.Test.UpdateManagementTests\GetAllRuns.json">
224-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
225-
</Content>
226-
<Content Include="SessionRecords\Commands.Automation.Test.UpdateManagementTests\GetAllRunsWithFilters.json">
227-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
228-
</Content>
229-
<Content Include="SessionRecords\Commands.Automation.Test.UpdateManagementTests\GetAllRunsWithFiltersNoResults.json">
230-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
231-
</Content>
232-
<Content Include="SessionRecords\Commands.Automation.Test.UpdateManagementTests\GetAllSUCs.json">
233-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
234-
</Content>
235-
<Content Include="SessionRecords\Commands.Automation.Test.UpdateManagementTests\GetAllSUCsForVM.json">
236-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
237-
</Content>
238-
<None Include="SessionRecords\Commands.Automation.Test.RunbookJobTests\TestCreateRunbookGraph.json">
239-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
240-
</None>
241-
<None Include="SessionRecords\Commands.Automation.Test.RunbookJobTests\TestImportAndDeleteRunbookGraphical.json">
242-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
243-
</None>
244-
<None Include="SessionRecords\Commands.Automation.Test.RunbookJobTests\TestImportRunbookPowerShell.json">
145+
</None>
146+
<None Include="ScenarioTests\Resources\*.*">
245147
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
246148
</None>
247149
</ItemGroup>

src/ResourceManager/Automation/Commands.Automation.Test/ScenarioTests/AccountTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15+
using Microsoft.Azure.Commands.Automation.Test;
1516
using Microsoft.Azure.ServiceManagemenet.Common.Models;
1617
using Microsoft.WindowsAzure.Commands.ScenarioTest;
1718
using Xunit;
1819

19-
namespace Microsoft.Azure.Commands.Automation.Test
20+
namespace Commands.Automation.Test
2021
{
2122
public class AccountTests : AutomationScenarioTestsBase
2223
{

src/ResourceManager/Automation/Commands.Automation.Test/ScenarioTests/AutomationScenarioTestsBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,13 @@ protected void RunPowerShellTest(XunitTracingInterceptor logger, params string[]
5050
var sf = new StackTrace().GetFrame(1);
5151
var callingClassType = sf.GetMethod().ReflectedType?.ToString();
5252
var mockName = sf.GetMethod().Name;
53+
5354
HttpMockServer.RecordsDirectory = GetSessionRecordsDirectory();
5455
using (var context = MockContext.Start(callingClassType, mockName))
5556
{
5657
SetupManagementClients(context);
5758

58-
var callingClassName = callingClassType?
59+
var callingClassName = callingClassType ?
5960
.Split(new[] { "." }, StringSplitOptions.RemoveEmptyEntries)
6061
.Last();
6162

@@ -88,7 +89,6 @@ private string GetSessionRecordsDirectory()
8889
{
8990
// Note: if you are developing new tests, set the recording directory to a local path.
9091
// this is the location where the json files will be created.
91-
// var recordsDirectory = Path.Combine("e:\\", "SessionRecords");
9292
var recordsDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SessionRecords");
9393
return recordsDirectory;
9494
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
namespace Commands.Automation.Test
16+
{
17+
using System;
18+
using System.Collections.Generic;
19+
using System.Linq;
20+
using System.Text;
21+
using System.Threading.Tasks;
22+
using Microsoft.Azure.Commands.Automation.Test;
23+
using Microsoft.Azure.ServiceManagemenet.Common.Models;
24+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
25+
using Xunit;
26+
public class CertificateTests : AutomationScenarioTestsBase
27+
{
28+
public XunitTracingInterceptor logger;
29+
30+
public CertificateTests(Xunit.Abstractions.ITestOutputHelper output)
31+
{
32+
logger = new XunitTracingInterceptor(output);
33+
XunitTracingInterceptor.AddToContext(logger);
34+
}
35+
36+
[Fact]
37+
[Trait(Category.Service, Category.Automation)]
38+
[Trait(Category.RunType, Category.LiveOnly)]
39+
[Trait(Category.AcceptanceType, Category.CheckIn)]
40+
[Trait(Category.AcceptanceType, Category.BVT)]
41+
public void TestE2ECertificates()
42+
{
43+
RunPowerShellTest(logger, "Test-E2ECertificates");
44+
}
45+
46+
}
47+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# ----------------------------------------------------------------------------------
2+
#
3+
# Copyright Microsoft Corporation
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
# ----------------------------------------------------------------------------------
14+
15+
<#
16+
.SYNOPSIS
17+
Tests create new automation variable with string value.
18+
#>
19+
function Test-E2ECertificates
20+
{
21+
$resourceGroupName = "to-delete-01"
22+
$automationAccountName = "fbs-aa-01"
23+
$thumprint = "3a7dfabed24f7443e79e815239c51826042737dc"
24+
$thumbprint2 = "38dae807ad6fb1f42bde1658b5abec85ace5615e"
25+
$Password = ConvertTo-SecureString -String "Password" -AsPlainText -Force
26+
27+
New-AzureRmAutomationCertificate -AutomationAccountName $automationAccountName `
28+
-Name "ContosoCertificate" `
29+
-Path "./ScenarioTests/sdkTestCert.cer" `
30+
-Password $Password `
31+
-ResourceGroupName $resourceGroupName `
32+
-Description "Hello"
33+
34+
$getCertificate = Get-AzureRmAutomationCertificate -ResourceGroupName $resourceGroupName `
35+
-AutomationAccountName $automationAccountName `
36+
-Name "ContosoCertificate"
37+
38+
Assert-AreEqual $thumprint $getCertificate.Thumbprint
39+
40+
Set-AzureRmAutomationCertificate -ResourceGroupName $resourceGroupName `
41+
-AutomationAccountName $automationAccountName `
42+
-Name "ContosoCertificate" `
43+
-Description "Goodbye" `
44+
-Path "./ScenarioTests/sdkTestCert2.cer"
45+
46+
$getCertificate = Get-AzureRmAutomationCertificate -ResourceGroupName $resourceGroupName `
47+
-AutomationAccountName $automationAccountName `
48+
-Name "ContosoCertificate"
49+
50+
Assert-AreEqual "Goodbye" $getCertificate.Description
51+
Assert-AreEqual $thumbprint2 $getCertificate.Thumbprint
52+
53+
Remove-AzureRmAutomationCertificate -ResourceGroupName $resourceGroupName `
54+
-AutomationAccountName $automationAccountName `
55+
-Name "ContosoCertificate"
56+
57+
$output = Get-AzureRmAutomationCertificate -ResourceGroupName $resourceGroupName `
58+
-AutomationAccountName $automationAccountName `
59+
-Name "ContosoCertificate" -ErrorAction SilentlyContinue
60+
61+
Assert-True {$output -eq $null}
62+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
namespace Commands.Automation.Test
16+
{
17+
using System;
18+
using System.Collections.Generic;
19+
using System.Linq;
20+
using System.Text;
21+
using System.Threading.Tasks;
22+
using Microsoft.Azure.Commands.Automation.Test;
23+
using Microsoft.Azure.ServiceManagemenet.Common.Models;
24+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
25+
using Xunit;
26+
public class ConnectionTests : AutomationScenarioTestsBase
27+
{
28+
public XunitTracingInterceptor logger;
29+
30+
public ConnectionTests(Xunit.Abstractions.ITestOutputHelper output)
31+
{
32+
logger = new XunitTracingInterceptor(output);
33+
XunitTracingInterceptor.AddToContext(logger);
34+
}
35+
36+
[Fact]
37+
[Trait(Category.Service, Category.Automation)]
38+
[Trait(Category.RunType, Category.LiveOnly)]
39+
[Trait(Category.AcceptanceType, Category.CheckIn)]
40+
[Trait(Category.AcceptanceType, Category.BVT)]
41+
public void TestE2EConnections()
42+
{
43+
RunPowerShellTest(logger, "Test-E2EConnections");
44+
}
45+
}
46+
}

0 commit comments

Comments
 (0)