Skip to content

Commit d3d83a4

Browse files
committed
CI Error Fixes
Added default parameter set Added PSPoolSpecificiation alias property for MaxTasksPerComputeNode
1 parent 2411ef0 commit d3d83a4

File tree

5 files changed

+103
-6
lines changed

5 files changed

+103
-6
lines changed

src/Batch/Batch.Test/ScenarioTests/CertificateTests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,5 @@ function Test-TestCancelCertificateDelete
6565
$filter = "state eq 'active'";
6666
$cert = Get-AzBatchCertificate -Filter $filter -BatchContext $context
6767

68-
Assert-True { $cert.Thumbprint.ToLowerInvariant() -Contains $thumbprint }
68+
Assert-ContainsItem $cert.Thumbprint.ToLowerInvariant() $thumbprint
6969
}

src/Batch/Batch/ComputeNodeExtensions/GetBatchComputeNodeExtensionCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
namespace Microsoft.Azure.Commands.Batch
2323
{
24-
[Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzurePrefix + "BatchComputeNodeExtension"), OutputType(typeof(PSNodeVMExtension))]
24+
[Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzurePrefix + "BatchComputeNodeExtension", DefaultParameterSetName = Constants.IdParameterSet), OutputType(typeof(PSNodeVMExtension))]
2525
public class GetBatchComputeNodeExtensionCommand : BatchObjectModelCmdletBase
2626
{
2727
private int maxCount = Constants.DefaultMaxCount;
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
// <auto-generated>
16+
// This code was generated by a tool.
17+
// Runtime Version:5.0.13
18+
//
19+
// Changes to this file may cause incorrect behavior and will be lost if
20+
// the code is regenerated.
21+
// </auto-generated>
22+
//------------------------------------------------------------------------------
23+
24+
namespace Microsoft.Azure.Commands.Batch.Models
25+
{
26+
public partial class PSPoolSpecification
27+
{
28+
/// <summary>
29+
/// This property is an alias of TaskSlotsPerNode.
30+
/// </summary>
31+
public int? MaxTasksPerComputeNode
32+
{
33+
get
34+
{
35+
return TaskSlotsPerNode;
36+
}
37+
set
38+
{
39+
TaskSlotsPerNode = value;
40+
}
41+
}
42+
}
43+
}

src/Batch/Batch/help/Get-AzBatchComputeNodeExtension.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Gets Batch compute node extensions from a compute node.
1212

1313
## SYNTAX
1414

15-
### Id
15+
### Id (Default)
1616
```
1717
Get-AzBatchComputeNodeExtension [-PoolId] <String> [-ComputeNodeId] <String> [[-ExtensionName] <String>]
1818
[-Select <String>] [-MaxCount <Int32>] -BatchContext <BatchAccountContext>

tools/ScenarioTest.ResourceManager/Assert.ps1

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,30 @@ function Assert-NotNull
215215
return $true
216216
}
217217

218+
###################
219+
#
220+
# Verify that the given string is not null or empty
221+
#
222+
# param [string] $actual : The actual string
223+
# param [string] $message : The message to return if the given script does not return true
224+
####################
225+
function Assert-NotNullOrEmpty
226+
{
227+
param([string] $actual, [string] $message)
228+
229+
if (!$message)
230+
{
231+
$message = "Assertion failed because the string is null or empty: " + $actual
232+
}
233+
234+
if ([string]::IsNullOrEmpty($actual))
235+
{
236+
throw $message
237+
}
238+
239+
return $true
240+
}
241+
218242
######################
219243
#
220244
# Assert that the given file exists
@@ -390,7 +414,7 @@ function Assert-StartsWith
390414
{
391415
param([string] $expectedPrefix, [string] $actual, [string] $message)
392416

393-
Assert-NotNull $actual
417+
Assert-NotNullOrEmpty $actual
394418

395419
if (!$message)
396420
{
@@ -417,7 +441,7 @@ function Assert-Match
417441
{
418442
param([string] $regex, [string] $actual, [string] $message)
419443

420-
Assert-NotNull $actual
444+
Assert-NotNullOrEmpty $actual
421445

422446
if (!$message)
423447
{
@@ -444,7 +468,7 @@ function Assert-NotMatch
444468
{
445469
param([string] $regex, [string] $actual, [string] $message)
446470

447-
Assert-NotNull $actual
471+
Assert-NotNullOrEmpty $actual
448472

449473
if (!$message)
450474
{
@@ -456,5 +480,35 @@ function Assert-NotMatch
456480
throw $message
457481
}
458482

483+
return $true
484+
}
485+
486+
###################
487+
#
488+
# Verify that the a space-delimited string contains an item matching a specific value.
489+
#
490+
# param [string] $actual : The actual string
491+
# param [string] $expected : The expected value.
492+
# param [string] $message : The message to return if the actual string does not contain the expected value.
493+
####################
494+
function Assert-ContainsItem
495+
{
496+
param([string] $actual, [string] $expected, [string] $message)
497+
498+
Assert-NotNullOrEmpty $actual
499+
Assert-NotNullOrEmpty $expected
500+
501+
if (!$message)
502+
{
503+
$message = "Assertion failed because actual '$actual' does not contain an item matching '$expected'"
504+
}
505+
506+
$split = $actual -Split ' '
507+
508+
if (!$split.contains($expected))
509+
{
510+
throw $message
511+
}
512+
459513
return $true
460514
}

0 commit comments

Comments
 (0)