Skip to content

Commit 0c0b56e

Browse files
authored
Merge branch 'release-4.3.0' into EHpwr2017
2 parents b700071 + f4c9f4d commit 0c0b56e

File tree

226 files changed

+248275
-10143
lines changed

Some content is hidden

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

226 files changed

+248275
-10143
lines changed

src/ResourceManager/Automation/ChangeLog.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,12 @@
1818
- Additional information about change #1
1919
-->
2020
## Current Release
21-
21+
* Made changes to AutomationDSC* cmdlets to pull more than 100 records
22+
* Resolved the issue where the Verbose streams stop working after calling some Automation cmdlets (for example Get-AzureRmAutomationVariable, Get-AzureRmAutomationJob).
2223
## Version 3.2.1
23-
2424
## Version 3.2.0
2525
* Properly setting TimeZone value for Weekly and Monthly schedules for New-AzureRmAutomationSchedule
2626
- More information can be found in this issue: https://github.com/Azure/azure-powershell/issues/3043
27-
2827
## Version 3.1.0
2928

3029
## Version 3.0.1

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@
155155
<Compile Include="Properties\AssemblyInfo.cs" />
156156
<Compile Include="ScenarioTests\AutomationScenarioTestsBase.cs" />
157157
<Compile Include="ScenarioTests\AutomationTests.cs" />
158+
<Compile Include="UnitTests\GetAzureAutomationDscNodeConfigurationTest.cs" />
159+
<Compile Include="UnitTests\GetAzureAutomationDscNodeReportTest.cs" />
160+
<Compile Include="UnitTests\GetAzureAutomationDscNodeTest.cs" />
161+
<Compile Include="UnitTests\GetAzureAutomationDscCompilationJobTest.cs" />
162+
<Compile Include="UnitTests\GetAzureAutomationConfigurationTest.cs" />
158163
<Compile Include="UnitTests\GetAzureAutomationCertificateTest.cs" />
159164
<Compile Include="UnitTests\GetAzureAutomationConnectionTest.cs" />
160165
<Compile Include="UnitTests\GetAzureAutomationCredentialTest.cs" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
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+
using Microsoft.Azure.Commands.Automation.Cmdlet;
16+
using Microsoft.Azure.Commands.Automation.Common;
17+
using Microsoft.Azure.Commands.Automation.Model;
18+
using Microsoft.VisualStudio.TestTools.UnitTesting;
19+
using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
20+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
21+
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
22+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
23+
using Moq;
24+
using System.Collections.Generic;
25+
using Xunit;
26+
27+
namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
28+
{
29+
public class GetAzureAutomationConfigurationTest : RMTestBase
30+
{
31+
private Mock<IAutomationClient> mockAutomationClient;
32+
33+
private MockCommandRuntime mockCommandRuntime;
34+
35+
private GetAzureAutomationDscConfiguration cmdlet;
36+
37+
38+
public GetAzureAutomationConfigurationTest()
39+
{
40+
this.mockAutomationClient = new Mock<IAutomationClient>();
41+
this.mockCommandRuntime = new MockCommandRuntime();
42+
this.cmdlet = new GetAzureAutomationDscConfiguration
43+
{
44+
AutomationClient = this.mockAutomationClient.Object,
45+
CommandRuntime = this.mockCommandRuntime
46+
};
47+
}
48+
49+
[Fact]
50+
[Trait(Category.AcceptanceType, Category.CheckIn)]
51+
52+
public void GetAzureAutomationAllConfigurationsSuccessfull()
53+
{
54+
// Setup
55+
string resourceGroupName = "resourceGroup";
56+
string accountName = "account";
57+
string nextLink = string.Empty;
58+
this.cmdlet.SetParameterSet("ByAll");
59+
60+
this.mockAutomationClient.Setup(f => f.ListDscConfigurations(resourceGroupName, accountName, ref nextLink)).Returns((string a, string b, string c) => new List<DscConfiguration>());
61+
62+
// Test
63+
this.cmdlet.ResourceGroupName = resourceGroupName;
64+
this.cmdlet.AutomationAccountName = accountName;
65+
this.cmdlet.ExecuteCmdlet();
66+
67+
// Assert
68+
this.mockAutomationClient.Verify(f => f.ListDscConfigurations(resourceGroupName, accountName, ref nextLink), Times.Once());
69+
}
70+
71+
[Fact]
72+
[Trait(Category.AcceptanceType, Category.CheckIn)]
73+
74+
public void GetAzureAutomationConfigurationByNameSuccessfull()
75+
{
76+
// Setup
77+
string resourceGroupName = "resourceGroup";
78+
string accountName = "account";
79+
string configurationName = "configuration";
80+
this.cmdlet.SetParameterSet("ByConfigurationName");
81+
82+
this.mockAutomationClient.Setup(f => f.GetConfiguration(resourceGroupName, accountName, configurationName));
83+
84+
// Test
85+
this.cmdlet.ResourceGroupName = resourceGroupName;
86+
this.cmdlet.AutomationAccountName = accountName;
87+
this.cmdlet.Name = configurationName;
88+
this.cmdlet.ExecuteCmdlet();
89+
90+
// Assert
91+
this.mockAutomationClient.Verify(f => f.GetConfiguration(resourceGroupName, accountName, configurationName), Times.Once());
92+
}
93+
}
94+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
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+
using System;
16+
using Microsoft.Azure.Commands.Automation.Cmdlet;
17+
using Microsoft.Azure.Commands.Automation.Common;
18+
using Microsoft.Azure.Commands.Automation.Model;
19+
using Microsoft.VisualStudio.TestTools.UnitTesting;
20+
using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
21+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
22+
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
23+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
24+
using Moq;
25+
using System.Collections.Generic;
26+
using Xunit;
27+
28+
namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
29+
{
30+
public class GetAzureAutomationDscCompilationJobTest : RMTestBase
31+
{
32+
private Mock<IAutomationClient> mockAutomationClient;
33+
34+
private MockCommandRuntime mockCommandRuntime;
35+
36+
private GetAzureAutomationDscCompilationJob cmdlet;
37+
38+
39+
public GetAzureAutomationDscCompilationJobTest()
40+
{
41+
this.mockAutomationClient = new Mock<IAutomationClient>();
42+
this.mockCommandRuntime = new MockCommandRuntime();
43+
this.cmdlet = new GetAzureAutomationDscCompilationJob
44+
{
45+
AutomationClient = this.mockAutomationClient.Object,
46+
CommandRuntime = this.mockCommandRuntime
47+
};
48+
}
49+
50+
[Fact]
51+
[Trait(Category.AcceptanceType, Category.CheckIn)]
52+
53+
public void GetAzureAutomationGetCompilationJobByIdSuccessfull()
54+
{
55+
// Setup
56+
string resourceGroupName = "resourceGroup";
57+
string accountName = "account";
58+
Guid id = Guid.NewGuid();
59+
60+
this.mockAutomationClient.Setup(f => f.GetCompilationJob(resourceGroupName, accountName, id)).Returns((string a, string b, Guid c) => new CompilationJob());
61+
62+
// Test
63+
this.cmdlet.ResourceGroupName = resourceGroupName;
64+
this.cmdlet.AutomationAccountName = accountName;
65+
this.cmdlet.Id = id;
66+
this.cmdlet.ExecuteCmdlet();
67+
68+
// Assert
69+
this.mockAutomationClient.Verify(f => f.GetCompilationJob(resourceGroupName, accountName, id), Times.Once());
70+
}
71+
72+
[Fact]
73+
[Trait(Category.AcceptanceType, Category.CheckIn)]
74+
75+
public void GetAzureAutomationCompilationJobsByConfigurationNameSuccessfull()
76+
{
77+
// Setup
78+
string resourceGroupName = "resourceGroup";
79+
string accountName = "account";
80+
string configurationName = "configuration";
81+
string nextLink = string.Empty;
82+
DateTimeOffset startTime = DateTimeOffset.Now;
83+
DateTimeOffset endTime = DateTimeOffset.Now;
84+
string status = "Completed";
85+
86+
this.mockAutomationClient.Setup(f => f.ListCompilationJobsByConfigurationName(resourceGroupName, accountName, configurationName, startTime, endTime, status, ref nextLink));
87+
88+
// Test
89+
this.cmdlet.ResourceGroupName = resourceGroupName;
90+
this.cmdlet.AutomationAccountName = accountName;
91+
this.cmdlet.ConfigurationName = configurationName;
92+
this.cmdlet.StartTime = startTime;
93+
this.cmdlet.EndTime = endTime;
94+
this.cmdlet.Status = status;
95+
this.cmdlet.ExecuteCmdlet();
96+
97+
// Assert
98+
this.mockAutomationClient.Verify(f => f.ListCompilationJobsByConfigurationName(resourceGroupName, accountName, configurationName, startTime, endTime, status, ref nextLink), Times.Once());
99+
}
100+
101+
[Fact]
102+
[Trait(Category.AcceptanceType, Category.CheckIn)]
103+
104+
public void GetAzureAutomationListCompilationJobs()
105+
{
106+
// Setup
107+
string resourceGroupName = "resourceGroup";
108+
string accountName = "account";
109+
string nextLink = string.Empty;
110+
DateTimeOffset startTime = DateTimeOffset.Now;
111+
DateTimeOffset endTime = DateTimeOffset.Now;
112+
string status = "Completed";
113+
114+
this.mockAutomationClient.Setup(f => f.ListCompilationJobs(resourceGroupName, accountName, startTime, endTime, status, ref nextLink));
115+
116+
// Test
117+
this.cmdlet.ResourceGroupName = resourceGroupName;
118+
this.cmdlet.AutomationAccountName = accountName;
119+
this.cmdlet.StartTime = startTime;
120+
this.cmdlet.EndTime = endTime;
121+
this.cmdlet.Status = status;
122+
this.cmdlet.ExecuteCmdlet();
123+
124+
// Assert
125+
this.mockAutomationClient.Verify(f => f.ListCompilationJobs(resourceGroupName, accountName, startTime, endTime, status, ref nextLink), Times.Once());
126+
}
127+
}
128+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
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+
using System;
16+
using Microsoft.Azure.Commands.Automation.Cmdlet;
17+
using Microsoft.Azure.Commands.Automation.Common;
18+
using Microsoft.Azure.Commands.Automation.Model;
19+
using Microsoft.VisualStudio.TestTools.UnitTesting;
20+
using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
21+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
22+
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
23+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
24+
using Moq;
25+
using System.Collections.Generic;
26+
using Xunit;
27+
28+
namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
29+
{
30+
public class GetAzureAutomationDscNodeConfigurationTest : RMTestBase
31+
{
32+
private Mock<IAutomationClient> mockAutomationClient;
33+
34+
private MockCommandRuntime mockCommandRuntime;
35+
36+
private GetAzureAutomationDscNodeConfiguration cmdlet;
37+
38+
39+
public GetAzureAutomationDscNodeConfigurationTest()
40+
{
41+
this.mockAutomationClient = new Mock<IAutomationClient>();
42+
this.mockCommandRuntime = new MockCommandRuntime();
43+
this.cmdlet = new GetAzureAutomationDscNodeConfiguration
44+
{
45+
AutomationClient = this.mockAutomationClient.Object,
46+
CommandRuntime = this.mockCommandRuntime
47+
};
48+
}
49+
50+
[Fact]
51+
[Trait(Category.AcceptanceType, Category.CheckIn)]
52+
53+
public void GetAzureAutomationGetDscNodeConfigurationByName()
54+
{
55+
// Setup
56+
string resourceGroupName = "resourceGroup";
57+
string accountName = "account";
58+
string nodeConfigurationName = "config.localhost";
59+
string rollupStatus = "Good";
60+
61+
this.mockAutomationClient.Setup(f => f.GetNodeConfiguration(resourceGroupName, accountName, nodeConfigurationName, rollupStatus));
62+
63+
// Test
64+
this.cmdlet.ResourceGroupName = resourceGroupName;
65+
this.cmdlet.AutomationAccountName = accountName;
66+
this.cmdlet.Name = nodeConfigurationName;
67+
this.cmdlet.RollupStatus = rollupStatus;
68+
this.cmdlet.ExecuteCmdlet();
69+
70+
// Assert
71+
this.mockAutomationClient.Verify(f => f.GetNodeConfiguration(resourceGroupName, accountName, nodeConfigurationName, rollupStatus), Times.Once());
72+
}
73+
74+
[Fact]
75+
[Trait(Category.AcceptanceType, Category.CheckIn)]
76+
77+
public void GetAzureAutomationDscNodeConfigurationByConfigurationName()
78+
{
79+
// Setup
80+
string resourceGroupName = "resourceGroup";
81+
string accountName = "account";
82+
string configurationName = "configuration";
83+
string rollupStatus = "Good";
84+
string nextLink = string.Empty;
85+
86+
this.mockAutomationClient.Setup(f => f.ListNodeConfigurationsByConfigurationName(resourceGroupName, accountName, configurationName, rollupStatus, ref nextLink));
87+
88+
// Test
89+
this.cmdlet.ResourceGroupName = resourceGroupName;
90+
this.cmdlet.AutomationAccountName = accountName;
91+
this.cmdlet.ConfigurationName = configurationName;
92+
this.cmdlet.RollupStatus = rollupStatus;
93+
this.cmdlet.ExecuteCmdlet();
94+
95+
// Assert
96+
this.mockAutomationClient.Verify(f => f.ListNodeConfigurationsByConfigurationName(resourceGroupName, accountName, configurationName, rollupStatus, ref nextLink), Times.Once());
97+
}
98+
99+
[Fact]
100+
[Trait(Category.AcceptanceType, Category.CheckIn)]
101+
102+
public void GetAzureAutomationDscNodeConfigurations()
103+
{
104+
// Setup
105+
string resourceGroupName = "resourceGroup";
106+
string accountName = "account";
107+
string rollupStatus = "Good";
108+
string nextLink = string.Empty;
109+
110+
this.mockAutomationClient.Setup(f => f.ListNodeConfigurations(resourceGroupName, accountName, rollupStatus, ref nextLink));
111+
112+
// Test
113+
this.cmdlet.ResourceGroupName = resourceGroupName;
114+
this.cmdlet.AutomationAccountName = accountName;
115+
this.cmdlet.RollupStatus = rollupStatus;
116+
this.cmdlet.ExecuteCmdlet();
117+
118+
// Assert
119+
this.mockAutomationClient.Verify(f => f.ListNodeConfigurations(resourceGroupName, accountName, rollupStatus, ref nextLink), Times.Once());
120+
}
121+
}
122+
}

0 commit comments

Comments
 (0)