Skip to content

Commit 537ccbc

Browse files
brnleehngcormacpayne
authored andcommitted
Added virtual network support for Batch cmdlets (#2724)
* Added new models mapping for ps generator * Models regenerated for new job auto completion and vnets * Added new models to csproj * Updated new pool cmdlet with network configuration * Added network configuration test * Updated doc for network configuration * Temporary for recording purposes * Test fixes for new updates on the service * Added recordings * Fixed versioning for Batch cmdlets * Updated ChangeLog.md for Batch * Added global filter * Added cert recordings as exceptions * Added ShouldProcess * Fixed test for ShouldProcess
1 parent b23c52e commit 537ccbc

File tree

147 files changed

+20105
-38953
lines changed

Some content is hidden

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

147 files changed

+20105
-38953
lines changed

ChangeLog.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,13 @@
3434
* ShouldContinue confirmation needed (suspress with -Force) only when there's data in the Container/Table to delete
3535
- Remove-AzureStorageContainer
3636
- Remove-AzureStorageTable
37-
38-
39-
40-
37+
* Azure Batch
38+
* Add virtual network support
39+
- New-AzureBatchPool
40+
* Change -Tag parameter type from HashTable[] to HashTable
41+
- Set-AzureRmBatchAccount
42+
- New-AzureRmBatchAccount
43+
- Get-AzureRmBatchAccount
4144

4245
##2016.07.11 version 1.6.0
4346
* **Behavioral change for -Force, –Confirm and $ConfirmPreference parameters for all cmdlets. We are changing this implementation to be in line with PowerShell guidelines. For most cmdlets, this means removing the Force parameter and to skip the ShouldProcess prompt, users will need to include the parameter: ‘-Confirm:$false’ in their PowerShell scripts.** This changes are addressing following issues:

src/ResourceManager/AzureBatch/BatchModelGenerator/Program.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ public class Program
9393
{"Microsoft.Azure.Batch.WindowsConfiguration", "PSWindowsConfiguration"},
9494
{"Microsoft.Azure.Batch.ApplicationPackageReference", "PSApplicationPackageReference"},
9595
{"Microsoft.Azure.Batch.TaskDependencies", "PSTaskDependencies"},
96+
{"Microsoft.Azure.Batch.NetworkConfiguration", "PSNetworkConfiguration"},
97+
{"Microsoft.Azure.Batch.ExitConditions", "PSExitConditions"},
98+
{"Microsoft.Azure.Batch.ExitOptions", "PSExitOptions"},
99+
{"Microsoft.Azure.Batch.ExitCodeRangeMapping", "PSExitCodeRangeMapping"},
100+
{"Microsoft.Azure.Batch.ExitCodeMapping", "PSExitCodeMapping"},
96101
};
97102

98103

src/ResourceManager/AzureBatch/Commands.Batch.Test/Commands.Batch.Test.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@
4444
<Reference Include="Hyak.Common">
4545
<HintPath>..\..\..\packages\Hyak.Common.1.0.3\lib\portable-net403+win+wpa81\Hyak.Common.dll</HintPath>
4646
</Reference>
47-
<Reference Include="Microsoft.Azure.Batch, Version=4.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
48-
<HintPath>..\..\..\packages\Azure.Batch.4.0.1\lib\net45\Microsoft.Azure.Batch.dll</HintPath>
49-
<Private>True</Private>
47+
<Reference Include="Microsoft.Azure.Batch, Version=5.0.0.0, Culture=neutral, processorArchitecture=MSIL">
48+
<HintPath>..\..\..\packages\Azure.Batch.5.0.0\lib\net45\Microsoft.Azure.Batch.dll</HintPath>
5049
</Reference>
5150
<Reference Include="Microsoft.Azure.Common">
5251
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll</HintPath>

src/ResourceManager/AzureBatch/Commands.Batch.Test/Jobs/SetBatchJobCommandTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
using System.Management.Automation;
2424
using Xunit;
2525
using BatchClient = Microsoft.Azure.Commands.Batch.Models.BatchClient;
26+
using OnAllTasksComplete = Microsoft.Azure.Batch.Common.OnAllTasksComplete;
2627

2728
namespace Microsoft.Azure.Commands.Batch.Test.Jobs
2829
{
@@ -55,7 +56,8 @@ public void SetBatchJobParametersTest()
5556
Assert.Throws<ArgumentNullException>(() => cmdlet.ExecuteCmdlet());
5657

5758
cmdlet.Job = new PSCloudJob(BatchTestHelpers.CreateFakeBoundJob(context));
58-
59+
cmdlet.Job.OnAllTasksComplete = OnAllTasksComplete.NoAction;
60+
5961
RequestInterceptor interceptor = BatchTestHelpers.CreateFakeServiceResponseInterceptor<
6062
JobUpdateParameter,
6163
JobUpdateOptions,

src/ResourceManager/AzureBatch/Commands.Batch.Test/Pools/NewBatchPoolCommandTests.cs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// ----------------------------------------------------------------------------------
1414

1515
using Microsoft.Azure.Batch;
16+
using Microsoft.Azure.Commands.Batch.Models;
1617
using Microsoft.Azure.Batch.Protocol;
1718
using Microsoft.Azure.Batch.Protocol.Models;
1819
using Microsoft.Rest.Azure;
@@ -68,5 +69,41 @@ public void NewBatchPoolParametersTest()
6869
// Verify no exceptions when required parameters are set
6970
cmdlet.ExecuteCmdlet();
7071
}
72+
73+
[Fact]
74+
[Trait(Category.AcceptanceType, Category.CheckIn)]
75+
public void NewBatchPoolNetworkConfigurationParameterTest()
76+
{
77+
BatchAccountContext context = BatchTestHelpers.CreateBatchContextWithKeys();
78+
cmdlet.BatchContext = context;
79+
80+
var networkConfiguration = new PSNetworkConfiguration();
81+
networkConfiguration.SubnetId = "fakeSubnetId";
82+
83+
cmdlet.Id = "testPool";
84+
cmdlet.VirtualMachineSize = "small";
85+
cmdlet.NetworkConfiguration = networkConfiguration;
86+
87+
commandRuntimeMock.Setup(f => f.ShouldProcess(It.IsAny<string>())).Returns(true);
88+
89+
string subnetId = null;
90+
91+
Action<BatchRequest<
92+
PoolAddParameter,
93+
PoolAddOptions,
94+
AzureOperationHeaderResponse<PoolAddHeaders>>> extractPoolAction =
95+
(request) =>
96+
{
97+
subnetId = request.Parameters.NetworkConfiguration.SubnetId;
98+
};
99+
100+
RequestInterceptor interceptor = BatchTestHelpers.CreateFakeServiceResponseInterceptor(requestAction: extractPoolAction);
101+
102+
cmdlet.AdditionalBehaviors = new List<BatchClientBehavior>() { interceptor };
103+
104+
cmdlet.ExecuteCmdlet();
105+
106+
Assert.Equal(cmdlet.NetworkConfiguration.SubnetId, subnetId);
107+
}
71108
}
72109
}

src/ResourceManager/AzureBatch/Commands.Batch.Test/ScenarioTests/PoolTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class PoolTests : WindowsAzure.Commands.Test.Utilities.Common.RMTestBase
2323
private const string testPoolId = ScenarioTestHelpers.SharedPool;
2424

2525
// Get from WATaskOSFamilyVersions table, which lags behind https://azure.microsoft.com/en-us/documentation/articles/cloud-services-guestos-update-matrix/
26-
private const string specificOSVersion = "WA-GUEST-OS-4.27_201512-01";
26+
private const string specificOSVersion = "WA-GUEST-OS-4.32_201605-01";
2727

2828
public PoolTests(Xunit.Abstractions.ITestOutputHelper output)
2929
{

0 commit comments

Comments
 (0)