Skip to content

Commit bae0919

Browse files
Modify New-AzVmss Vmss Flex defaulting logic to avoid null reference errors (#17610)
* dev and test * test json * changelog Co-authored-by: Dingmeng Xue <[email protected]>
1 parent db594dc commit bae0919

File tree

5 files changed

+766
-2
lines changed

5 files changed

+766
-2
lines changed

src/Compute/Compute.Test/ScenarioTests/VirtualMachineScaleSetTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,5 +263,12 @@ public void TestVirtualMachineScaleSetRepairsAction()
263263
TestRunner.RunTestScript("Test-VirtualMachineScaleSetRepairsAction");
264264
}
265265

266+
[Fact]
267+
[Trait(Category.AcceptanceType, Category.CheckIn)]
268+
public void TestVirtualMachineScaleSetOrchestrationModeNullChecks()
269+
{
270+
TestRunner.RunTestScript("Test-VirtualMachineScaleSetOrchestrationModeNullChecks");
271+
}
272+
266273
}
267274
}

src/Compute/Compute.Test/ScenarioTests/VirtualMachineScaleSetTests.ps1

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2874,6 +2874,37 @@ function Test-VirtualMachineScaleSetFlexibleOModeDefaulting
28742874
}
28752875
}
28762876

2877+
<#
2878+
.SYNOPSIS
2879+
Test Virtual Machine Scale Set OrchestrationMode NetworkAPIVersion null checks work
2880+
#>
2881+
function Test-VirtualMachineScaleSetOrchestrationModeNullChecks
2882+
{
2883+
# Setup
2884+
$rgname = Get-ComputeTestResourceName;
2885+
2886+
try
2887+
{
2888+
# Common
2889+
$loc = "eastus";
2890+
2891+
New-AzResourceGroup -Name $rgname -Location $loc -Force;
2892+
$VMSSName = "sap-flex";
2893+
$omode = "Flexible";
2894+
2895+
# Create Vmss
2896+
$vmssConfig = New-AzVmssConfig -Location $loc -PlatformFaultDomainCount 3 -OrchestrationMode $omode;
2897+
$vmss = New-AzVmss -ResourceGroupName $rgname -Name $VMSSName -VirtualMachineScaleSet $vmssConfig;
2898+
Assert-AreEqual $omode $vmss.OrchestrationMode;
2899+
2900+
}
2901+
finally
2902+
{
2903+
# Cleanup
2904+
Clean-ResourceGroup $rgname;
2905+
}
2906+
}
2907+
28772908
<#
28782909
.SYNOPSIS
28792910
Test Add and remove Vmss Run Command.

0 commit comments

Comments
 (0)