Skip to content

Commit c8e54e2

Browse files
authored
[Compute] New cmdlets Get-AzHostSize and Update-AzHost (Azure#22381)
* Get-AzHostSize and Update-AzHost * fix help * update help
1 parent 1fbcbac commit c8e54e2

File tree

9 files changed

+1754
-1
lines changed

9 files changed

+1754
-1
lines changed

src/Compute/Compute.Test/ScenarioTests/DedicatedHostTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,12 @@ public void TestDedicatedHostRestart()
4444
{
4545
TestRunner.RunTestScript("Test-DedicatedHostRestart");
4646
}
47+
48+
[Fact]
49+
[Trait(Category.AcceptanceType, Category.CheckIn)]
50+
public void TestDedicatedHostUpdateAndSize()
51+
{
52+
TestRunner.RunTestScript("Test-DedicatedHostUpdateAndSize");
53+
}
4754
}
4855
}

src/Compute/Compute.Test/ScenarioTests/DedicatedHostTests.ps1

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,4 +288,48 @@ function Test-DedicatedHostRestart
288288
# Cleanup
289289
Clean-ResourceGroup $rgname
290290
}
291+
}
292+
293+
294+
<#
295+
.SYNOPSIS
296+
Test Restart dedicated host Update and Size.
297+
#>
298+
function Test-DedicatedHostUpdateAndSize
299+
{
300+
# Setup
301+
$rgname = Get-ComputeTestResourceName
302+
303+
try
304+
{
305+
# Common
306+
# [string]$loc = Get-Location "Microsoft.Resources" "resourceGroups" "East US 2 EUAP";
307+
# $loc = $loc.Replace(' ', '');
308+
$loc = "eastus2euap";
309+
310+
New-AzResourceGroup -Name $rgname -Location $loc -Force;
311+
312+
$hostGroupName = $rgname + 'hostgroup';
313+
New-AzHostGroup -ResourceGroupName $rgname -Name $hostGroupName -Location $loc -PlatformFaultDomain 1 -Zone "2" -Tag @{key1 = "val1"};
314+
315+
$hostGroup = Get-AzHostGroup -ResourceGroupName $rgname -Name $hostGroupName;
316+
$hostName = $rgname + 'host';
317+
New-AzHost -ResourceGroupName $rgname -HostGroupName $hostGroupName -Name $hostName -Location $loc -Sku "ESv3-Type1" -Tag @{key1 = "val2"};
318+
319+
$dedicatedHost = Get-AzHost -ResourceGroupName $rgname -HostGroupName $hostGroupName -Name $hostName;
320+
321+
# Restart the dedicated host
322+
$hostSize = Get-AzHostSize -ResourceGroupName $rgname -HostGroupName $hostGroupName -Name $hostName;
323+
Assert-NotNull $hostSize;
324+
325+
# Update DH
326+
$dHUpdate = Update-AzHost -ResourceGroupName $rgname -HostGroupName $hostGroupName -Name $hostName -AutoReplaceOnFailure $false;
327+
Assert-AreEqual $dHUpdate.AutoReplaceOnFailure $False ;
328+
329+
}
330+
finally
331+
{
332+
# Cleanup
333+
Clean-ResourceGroup $rgname
334+
}
291335
}

0 commit comments

Comments
 (0)