Skip to content

Commit 756a039

Browse files
authored
[Batch] Add CommunicationMode properties to CloudPool (#20390)
* Models generated * Update Batch .Net SDK version * Add new parameters. Add completer, fix accessor * Update unit tests * Test fixes * Test recordings Updated recordings * Updated help and change log. Updated change log Readme fix * PR Feedback - Fixed ActionsRequired property name. minor Restored and deprecated old property.
1 parent 630163e commit 756a039

File tree

164 files changed

+9158
-12074
lines changed

Some content is hidden

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

164 files changed

+9158
-12074
lines changed

src/Batch/Batch.Test/Batch.Test.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
</PropertyGroup>
1414

1515
<ItemGroup>
16-
<PackageReference Include="Microsoft.Azure.Batch" Version="15.3.0" />
17-
<PackageReference Include="Microsoft.Azure.Management.Batch" Version="14.0.0" />
16+
<PackageReference Include="Microsoft.Azure.Batch" Version="15.4.0" />
17+
<PackageReference Include="Microsoft.Azure.Management.Batch" Version="15.0.0" />
1818
<PackageReference Include="WindowsAzure.Storage" Version="9.3.0" />
1919
<PackageReference Include="Microsoft.Azure.Management.Network" Version="25.0.0" />
2020
</ItemGroup>

src/Batch/Batch.Test/Pools/NewBatchPoolCommandTests.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public void NewBatchPoolParametersGetPassedToRequestTest()
7878
cmdlet.BatchContext = context;
7979

8080
cmdlet.Id = "testPool";
81-
cmdlet.ApplicationLicenses = new List<string>() { "foo", "bar"};
81+
cmdlet.ApplicationLicenses = new List<string>() { "foo", "bar" };
8282
cmdlet.CertificateReferences = new PSCertificateReference[]
8383
{
8484
new PSCertificateReference()
@@ -94,20 +94,20 @@ public void NewBatchPoolParametersGetPassedToRequestTest()
9494
cmdlet.DisplayName = "display name";
9595
cmdlet.InterComputeNodeCommunicationEnabled = true;
9696
cmdlet.TaskSlotsPerNode = 4;
97-
cmdlet.Metadata = new Dictionary<string, string>();
98-
cmdlet.Metadata.Add("meta1", "value1");
97+
cmdlet.Metadata = new Dictionary<string, string> { { "meta1", "value1" } };
9998
cmdlet.ResizeTimeout = TimeSpan.FromMinutes(20);
10099
cmdlet.StartTask = new PSStartTask("cmd /c echo start task");
101100
cmdlet.TargetDedicatedComputeNodes = 3;
102101
cmdlet.TargetLowPriorityComputeNodes = 2;
102+
cmdlet.TargetNodeCommunicationMode = Microsoft.Azure.Batch.Common.NodeCommunicationMode.Simplified;
103103
cmdlet.TaskSchedulingPolicy = new PSTaskSchedulingPolicy(Azure.Batch.Common.ComputeNodeFillType.Spread);
104104
cmdlet.VirtualMachineConfiguration = new PSVirtualMachineConfiguration(new PSImageReference("offer", "publisher", "sku"), "node agent");
105105
cmdlet.VirtualMachineSize = "small";
106106
cmdlet.MountConfiguration = new[] {
107107
new PSMountConfiguration(new PSAzureBlobFileSystemConfiguration("foo", "bar", "baz", AzureStorageAuthenticationKey.FromAccountKey("abc"))),
108108
new PSMountConfiguration(new PSAzureBlobFileSystemConfiguration("foo2", "bar2", "baz2", new PSComputeNodeIdentityReference(new Azure.Batch.ComputeNodeIdentityReference { ResourceId = "fake-identity"})))
109109
};
110-
110+
111111
PoolAddParameter requestParameters = null;
112112

113113
// Store the request parameters
@@ -141,6 +141,7 @@ public void NewBatchPoolParametersGetPassedToRequestTest()
141141
Assert.Equal(cmdlet.TargetDedicatedComputeNodes, requestParameters.TargetDedicatedNodes);
142142
Assert.Equal(cmdlet.TargetLowPriorityComputeNodes, requestParameters.TargetLowPriorityNodes);
143143
Assert.Equal(cmdlet.TaskSchedulingPolicy.ComputeNodeFillType.ToString(), requestParameters.TaskSchedulingPolicy.NodeFillType.ToString());
144+
Assert.Equal(cmdlet.TargetNodeCommunicationMode.ToString(), NodeCommunicationMode.Simplified.ToString());
144145
Assert.Equal(cmdlet.VirtualMachineConfiguration.NodeAgentSkuId, requestParameters.VirtualMachineConfiguration.NodeAgentSKUId);
145146
Assert.Equal(cmdlet.VirtualMachineConfiguration.ImageReference.Publisher, requestParameters.VirtualMachineConfiguration.ImageReference.Publisher);
146147
Assert.Equal(cmdlet.VirtualMachineConfiguration.ImageReference.Offer, requestParameters.VirtualMachineConfiguration.ImageReference.Offer);
@@ -203,7 +204,7 @@ public void NewBatchPoolNetworkConfigurationParameterTest()
203204
cmdlet.NetworkConfiguration = networkConfiguration;
204205

205206
commandRuntimeMock.Setup(f => f.ShouldProcess(It.IsAny<string>())).Returns(true);
206-
207+
207208
string subnetId = null;
208209

209210
Action<BatchRequest<
@@ -238,7 +239,7 @@ public void NewBatchPoolUserAccountsGetPassedToRequest()
238239
PSUserAccount adminUser = new PSUserAccount("admin", "password1", Azure.Batch.Common.ElevationLevel.Admin);
239240
PSUserAccount nonAdminUser = new PSUserAccount("user2", "password2", Azure.Batch.Common.ElevationLevel.NonAdmin);
240241
PSUserAccount sshUser = new PSUserAccount("user3", "password3", linuxUserConfiguration: new PSLinuxUserConfiguration(uid: 1, gid: 2, sshPrivateKey: "my ssh key"));
241-
cmdlet.UserAccount = new [] { adminUser, nonAdminUser, sshUser };
242+
cmdlet.UserAccount = new[] { adminUser, nonAdminUser, sshUser };
242243

243244
PoolAddParameter requestParameters = null;
244245

src/Batch/Batch.Test/ScenarioTests/BatchAccountTests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ function Test-CreateNewBatchAccountWithNoPublicIp
137137

138138
$privateLinkResource = Get-AzPrivateLinkResource -PrivateLinkResourceId $createdAccount.Id
139139

140-
$plsConnection = New-AzPrivateLinkServiceConnection -Name "myplsconnection" -PrivateLinkServiceId $createdAccount.Id -GroupId $privateLinkResource.GroupId
140+
$plsConnection = New-AzPrivateLinkServiceConnection -Name "myplsconnection" -PrivateLinkServiceId $createdAccount.Id -GroupId "batchAccount"
141141
New-AzPrivateEndpoint -ResourceGroupName $resourceGroup -Name "mypec" -Location $location -Subnet $vnet.subnets[0] -PrivateLinkServiceConnection $plsConnection -ByManualRequest
142142

143143
$connection = Get-AzPrivateEndpointConnection -PrivateLinkResourceId $createdAccount.Id

src/Batch/Batch.Test/ScenarioTests/ComputeNodeTests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function Test-RemoveComputeNodes
3535
$select = "id,state"
3636
$computeNodes = Get-AzBatchComputeNode -PoolId $poolId -Select $select -BatchContext $context
3737
$start = [DateTime]::Now
38-
$timeout = Compute-TestTimeout 30
38+
$timeout = Compute-TestTimeout 60
3939
$end = $start.AddSeconds($timeout)
4040
while ($computeNodes[0].State -ne 'LeavingPool' -and $computeNodes[1].State -ne 'LeavingPool')
4141
{

src/Batch/Batch.Test/ScenarioTests/JobTests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,13 @@ public void IfJobSetsAutoFailure_ItCompletesWhenAnyTaskFails()
6565
string taskId = "taskId-1";
6666
PSCloudJob completedJob = null;
6767
TestRunner.RunTestScript(
68+
null,
6869
mockContext =>
6970
{
7071
context = new ScenarioTestContext();
72+
},
73+
() =>
74+
{
7175
completedJob = ScenarioTestHelpers.WaitForJobCompletion(this, context, jobId, taskId);
7276
AssertJobIsCompleteDueToTaskFailure(completedJob);
7377
ScenarioTestHelpers.DeleteJob(this, context, jobId);

src/Batch/Batch.Test/ScenarioTests/PoolTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public void TestResizeAndStopResizePool()
5151
},
5252
() =>
5353
{
54+
ScenarioTestHelpers.WaitForSteadyPoolAllocation(this, context, poolId);
5455
ScenarioTestHelpers.DeletePool(this, context, poolId);
5556
},
5657
$"Test-ResizeAndStopResizePool '{poolId}'"

src/Batch/Batch.Test/ScenarioTests/ScenarioTestHelpers.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,8 @@ public static void CreateTestPool(
215215
TargetLowPriorityComputeNodes = targetLowPriority,
216216
CertificateReferences = certReferences,
217217
StartTask = psStartTask,
218-
InterComputeNodeCommunicationEnabled = true
218+
InterComputeNodeCommunicationEnabled = true,
219+
TargetCommunicationMode = NodeCommunicationMode.Classic
219220
};
220221

221222
CreatePoolIfNotExists(runner, parameters);

src/Batch/Batch.Test/SessionRecords/Microsoft.Azure.Commands.Batch.Test.ScenarioTests.BatchAccountTests/TestBatchAccountEndToEnd.json

Lines changed: 278 additions & 278 deletions
Large diffs are not rendered by default.

src/Batch/Batch.Test/SessionRecords/Microsoft.Azure.Commands.Batch.Test.ScenarioTests.BatchAccountTests/TestCreateNewBatchAccountWithNoPublicIp.json

Lines changed: 333 additions & 561 deletions
Large diffs are not rendered by default.

src/Batch/Batch.Test/SessionRecords/Microsoft.Azure.Commands.Batch.Test.ScenarioTests.BatchAccountTests/TestCreateNewBatchAccountWithSystemIdentity.json

Lines changed: 135 additions & 135 deletions
Large diffs are not rendered by default.

src/Batch/Batch.Test/SessionRecords/Microsoft.Azure.Commands.Batch.Test.ScenarioTests.BatchAccountTests/TestGetBatchSupportedImages.json

Lines changed: 16 additions & 16 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)