Skip to content

Commit a6d6cfd

Browse files
added tests for new parameter in vmss
1 parent 5aedf36 commit a6d6cfd

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

src/Compute/Compute.Test/ScenarioTests/StrategiesVmssTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,13 @@ public void TestSimpleNewVmssPpg()
110110
TestRunner.RunTestScript("Test-SimpleNewVmssPpg");
111111
}
112112

113+
[Fact]
114+
[Trait(Category.AcceptanceType, Category.CheckIn)]
115+
public void TestSimpleNewVmssHostGroup()
116+
{
117+
TestRunner.RunTestScript("Test-SimpleNewVmssHostGroup");
118+
}
119+
113120
[Fact]
114121
[Trait(Category.AcceptanceType, Category.CheckIn)]
115122
public void TestSimpleNewVmssBilling()

src/Compute/Compute.Test/ScenarioTests/StrategiesVmssTests.ps1

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,47 @@ function Test-SimpleNewVmssPpg
405405
}
406406
}
407407

408+
<#
409+
.SYNOPSIS
410+
Test Simple Paremeter Set With HostGroup (automatic placement)
411+
#>
412+
function Test-SimpleNewVmssHostGroup
413+
{
414+
# Setup
415+
$rgname = Get-ResourceName
416+
417+
try
418+
{
419+
$vmssname = "MyVmss"
420+
$username = "admin01"
421+
$password = Get-PasswordForVM | ConvertTo-SecureString -AsPlainText -Force
422+
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
423+
424+
# Common
425+
$loc = "EastUS2EUAP"
426+
$rg = New-AzResourceGroup -Name $rgname -Location $loc
427+
428+
# Creating a host group
429+
$hostGroupName = $rgname + 'hostgroup'
430+
New-AzHostGroup -ResourceGroupName $rgname -Name $hostGroupName -Location $loc -PlatformFaultDomain 1 -Zone "1" -Tag @{key1 = "val1"};
431+
432+
$hostGroup = Get-AzHostGroup -ResourceGroupName $rgname -Name $hostGroupName;
433+
434+
# Creating a host for the hostgroup
435+
$hostName = $rgname + 'host'
436+
New-AzHost -ResourceGroupName $rgname -HostGroupName $hostGroupName -Name $hostName -Location $loc -Sku "ESv3-Type1" -Tag @{key1 = "val2"};
437+
438+
$vmss = New-AzVmss -Name $vmssname -ResourceGroup $rgname -Credential $cred -HostGroupId $hostGroup.Id
439+
440+
Assert-AreEqual $vmss.HostGroupId $hostGroup.Id
441+
}
442+
finally
443+
{
444+
# Cleanup
445+
Clean-ResourceGroup $rgname
446+
}
447+
}
448+
408449
<#
409450
.SYNOPSIS
410451
Test Simple Paremeter Set for New Vmss with eviction policy, priority, and max price.

0 commit comments

Comments
 (0)