Skip to content

Commit

Permalink
[Batch] Add CommunicationMode properties to CloudPool (Azure#20390)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
paterasMSFT authored Dec 20, 2022
1 parent 630163e commit 756a039
Show file tree
Hide file tree
Showing 164 changed files with 9,158 additions and 12,074 deletions.
4 changes: 2 additions & 2 deletions src/Batch/Batch.Test/Batch.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Batch" Version="15.3.0" />
<PackageReference Include="Microsoft.Azure.Management.Batch" Version="14.0.0" />
<PackageReference Include="Microsoft.Azure.Batch" Version="15.4.0" />
<PackageReference Include="Microsoft.Azure.Management.Batch" Version="15.0.0" />
<PackageReference Include="WindowsAzure.Storage" Version="9.3.0" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="25.0.0" />
</ItemGroup>
Expand Down
13 changes: 7 additions & 6 deletions src/Batch/Batch.Test/Pools/NewBatchPoolCommandTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void NewBatchPoolParametersGetPassedToRequestTest()
cmdlet.BatchContext = context;

cmdlet.Id = "testPool";
cmdlet.ApplicationLicenses = new List<string>() { "foo", "bar"};
cmdlet.ApplicationLicenses = new List<string>() { "foo", "bar" };
cmdlet.CertificateReferences = new PSCertificateReference[]
{
new PSCertificateReference()
Expand All @@ -94,20 +94,20 @@ public void NewBatchPoolParametersGetPassedToRequestTest()
cmdlet.DisplayName = "display name";
cmdlet.InterComputeNodeCommunicationEnabled = true;
cmdlet.TaskSlotsPerNode = 4;
cmdlet.Metadata = new Dictionary<string, string>();
cmdlet.Metadata.Add("meta1", "value1");
cmdlet.Metadata = new Dictionary<string, string> { { "meta1", "value1" } };
cmdlet.ResizeTimeout = TimeSpan.FromMinutes(20);
cmdlet.StartTask = new PSStartTask("cmd /c echo start task");
cmdlet.TargetDedicatedComputeNodes = 3;
cmdlet.TargetLowPriorityComputeNodes = 2;
cmdlet.TargetNodeCommunicationMode = Microsoft.Azure.Batch.Common.NodeCommunicationMode.Simplified;
cmdlet.TaskSchedulingPolicy = new PSTaskSchedulingPolicy(Azure.Batch.Common.ComputeNodeFillType.Spread);
cmdlet.VirtualMachineConfiguration = new PSVirtualMachineConfiguration(new PSImageReference("offer", "publisher", "sku"), "node agent");
cmdlet.VirtualMachineSize = "small";
cmdlet.MountConfiguration = new[] {
new PSMountConfiguration(new PSAzureBlobFileSystemConfiguration("foo", "bar", "baz", AzureStorageAuthenticationKey.FromAccountKey("abc"))),
new PSMountConfiguration(new PSAzureBlobFileSystemConfiguration("foo2", "bar2", "baz2", new PSComputeNodeIdentityReference(new Azure.Batch.ComputeNodeIdentityReference { ResourceId = "fake-identity"})))
};

PoolAddParameter requestParameters = null;

// Store the request parameters
Expand Down Expand Up @@ -141,6 +141,7 @@ public void NewBatchPoolParametersGetPassedToRequestTest()
Assert.Equal(cmdlet.TargetDedicatedComputeNodes, requestParameters.TargetDedicatedNodes);
Assert.Equal(cmdlet.TargetLowPriorityComputeNodes, requestParameters.TargetLowPriorityNodes);
Assert.Equal(cmdlet.TaskSchedulingPolicy.ComputeNodeFillType.ToString(), requestParameters.TaskSchedulingPolicy.NodeFillType.ToString());
Assert.Equal(cmdlet.TargetNodeCommunicationMode.ToString(), NodeCommunicationMode.Simplified.ToString());
Assert.Equal(cmdlet.VirtualMachineConfiguration.NodeAgentSkuId, requestParameters.VirtualMachineConfiguration.NodeAgentSKUId);
Assert.Equal(cmdlet.VirtualMachineConfiguration.ImageReference.Publisher, requestParameters.VirtualMachineConfiguration.ImageReference.Publisher);
Assert.Equal(cmdlet.VirtualMachineConfiguration.ImageReference.Offer, requestParameters.VirtualMachineConfiguration.ImageReference.Offer);
Expand Down Expand Up @@ -203,7 +204,7 @@ public void NewBatchPoolNetworkConfigurationParameterTest()
cmdlet.NetworkConfiguration = networkConfiguration;

commandRuntimeMock.Setup(f => f.ShouldProcess(It.IsAny<string>())).Returns(true);

string subnetId = null;

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

PoolAddParameter requestParameters = null;

Expand Down
2 changes: 1 addition & 1 deletion src/Batch/Batch.Test/ScenarioTests/BatchAccountTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function Test-CreateNewBatchAccountWithNoPublicIp

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

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

$connection = Get-AzPrivateEndpointConnection -PrivateLinkResourceId $createdAccount.Id
Expand Down
2 changes: 1 addition & 1 deletion src/Batch/Batch.Test/ScenarioTests/ComputeNodeTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function Test-RemoveComputeNodes
$select = "id,state"
$computeNodes = Get-AzBatchComputeNode -PoolId $poolId -Select $select -BatchContext $context
$start = [DateTime]::Now
$timeout = Compute-TestTimeout 30
$timeout = Compute-TestTimeout 60
$end = $start.AddSeconds($timeout)
while ($computeNodes[0].State -ne 'LeavingPool' -and $computeNodes[1].State -ne 'LeavingPool')
{
Expand Down
4 changes: 4 additions & 0 deletions src/Batch/Batch.Test/ScenarioTests/JobTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,13 @@ public void IfJobSetsAutoFailure_ItCompletesWhenAnyTaskFails()
string taskId = "taskId-1";
PSCloudJob completedJob = null;
TestRunner.RunTestScript(
null,
mockContext =>
{
context = new ScenarioTestContext();
},
() =>
{
completedJob = ScenarioTestHelpers.WaitForJobCompletion(this, context, jobId, taskId);
AssertJobIsCompleteDueToTaskFailure(completedJob);
ScenarioTestHelpers.DeleteJob(this, context, jobId);
Expand Down
1 change: 1 addition & 0 deletions src/Batch/Batch.Test/ScenarioTests/PoolTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public void TestResizeAndStopResizePool()
},
() =>
{
ScenarioTestHelpers.WaitForSteadyPoolAllocation(this, context, poolId);
ScenarioTestHelpers.DeletePool(this, context, poolId);
},
$"Test-ResizeAndStopResizePool '{poolId}'"
Expand Down
3 changes: 2 additions & 1 deletion src/Batch/Batch.Test/ScenarioTests/ScenarioTestHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ public static void CreateTestPool(
TargetLowPriorityComputeNodes = targetLowPriority,
CertificateReferences = certReferences,
StartTask = psStartTask,
InterComputeNodeCommunicationEnabled = true
InterComputeNodeCommunicationEnabled = true,
TargetCommunicationMode = NodeCommunicationMode.Classic
};

CreatePoolIfNotExists(runner, parameters);
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading

0 comments on commit 756a039

Please sign in to comment.