Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,12 @@ public void TestDedicatedHostVirtualMachine()
{
TestRunner.RunTestScript("Test-DedicatedHostVirtualMachine");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestDedicatedHostRestart()
{
TestRunner.RunTestScript("Test-DedicatedHostRestart");
}
}
}
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 @@ -245,3 +245,47 @@ function Test-DedicatedHostVirtualMachine
Clean-ResourceGroup $rgname
}
}

<#
.SYNOPSIS
Test Restart dedicated host feature.
#>
function Test-DedicatedHostRestart
{
# 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
Restart-AzHost -ResourceGroupName $rgname -HostGroupName $hostGroupName -Name $hostName;

# Resource Id Parameter set
Restart-AzHost -ResourceId $dedicatedHost.Id;

# Object Parameter set
Restart-AzHost -Host $dedicatedHost;
}
finally
{
# Cleanup
Clean-ResourceGroup $rgname
}
}
Loading