Skip to content

Commit

Permalink
[Compute] New cmdlets Get-AzHostSize and Update-AzHost (#22381)
Browse files Browse the repository at this point in the history
* Get-AzHostSize and Update-AzHost

* fix help

* update help
  • Loading branch information
haagha authored Jul 24, 2023
1 parent 1fbcbac commit c8e54e2
Show file tree
Hide file tree
Showing 9 changed files with 1,754 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/Compute/Compute.Test/ScenarioTests/DedicatedHostTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,12 @@ public void TestDedicatedHostRestart()
{
TestRunner.RunTestScript("Test-DedicatedHostRestart");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestDedicatedHostUpdateAndSize()
{
TestRunner.RunTestScript("Test-DedicatedHostUpdateAndSize");
}
}
}
44 changes: 44 additions & 0 deletions src/Compute/Compute.Test/ScenarioTests/DedicatedHostTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -288,4 +288,48 @@ function Test-DedicatedHostRestart
# Cleanup
Clean-ResourceGroup $rgname
}
}


<#
.SYNOPSIS
Test Restart dedicated host Update and Size.
#>
function Test-DedicatedHostUpdateAndSize
{
# Setup
$rgname = Get-ComputeTestResourceName

try
{
# Common
# [string]$loc = Get-Location "Microsoft.Resources" "resourceGroups" "East US 2 EUAP";
# $loc = $loc.Replace(' ', '');
$loc = "eastus2euap";

New-AzResourceGroup -Name $rgname -Location $loc -Force;

$hostGroupName = $rgname + 'hostgroup';
New-AzHostGroup -ResourceGroupName $rgname -Name $hostGroupName -Location $loc -PlatformFaultDomain 1 -Zone "2" -Tag @{key1 = "val1"};

$hostGroup = Get-AzHostGroup -ResourceGroupName $rgname -Name $hostGroupName;
$hostName = $rgname + 'host';
New-AzHost -ResourceGroupName $rgname -HostGroupName $hostGroupName -Name $hostName -Location $loc -Sku "ESv3-Type1" -Tag @{key1 = "val2"};

$dedicatedHost = Get-AzHost -ResourceGroupName $rgname -HostGroupName $hostGroupName -Name $hostName;

# Restart the dedicated host
$hostSize = Get-AzHostSize -ResourceGroupName $rgname -HostGroupName $hostGroupName -Name $hostName;
Assert-NotNull $hostSize;

# Update DH
$dHUpdate = Update-AzHost -ResourceGroupName $rgname -HostGroupName $hostGroupName -Name $hostName -AutoReplaceOnFailure $false;
Assert-AreEqual $dHUpdate.AutoReplaceOnFailure $False ;

}
finally
{
# Cleanup
Clean-ResourceGroup $rgname
}
}
Loading

0 comments on commit c8e54e2

Please sign in to comment.