Skip to content
Merged
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
37 changes: 25 additions & 12 deletions tools/toolsHCK.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1232,7 +1232,7 @@ function queuetest {
Write-Output ""
Write-Output "Usage:"
Write-Output ""
Write-Output "queuetest <testid> <targetkey> <projectname> <testmachine> <poolname> [-sup <name>]"
Write-Output "queuetest <testid> <targetkey> <projectname> <testmachine> <poolname> [-sup <json>]"
Write-Output " [-IPv6 <address>] [-help] [-parameters <parameters>]"
Write-Output ""
Write-Output "Any parameter in [] is optional."
Expand All @@ -1254,8 +1254,10 @@ function queuetest {
Write-Output ""
Write-Output " parameters = Additional parameters in JSON format '{ ParameterName1: ParameterValue, ParameterName2: ParameterValue2 }'."
Write-Output ""
Write-Output " sup = The support machine's name as registered with the HCK\HLK controller."
Write-Output " NOTE: test machine should be in a READY state."
Write-Output " sup = A JSON object mapping HLK role names to arrays of machine names."
Write-Output " Roles not listed default to the primary test machine."
Write-Output " Example: '{""MC"":[""CL2""],""SC"":[""CL3""]}'"
Write-Output " NOTE: support machines should be in a READY state."
Write-Output ""
Write-Output "NOTE: Windows HCK\HLK Studio should be installed on the machine running the script!"
}
Expand Down Expand Up @@ -1305,20 +1307,31 @@ function queuetest {
}

if (-Not [String]::IsNullOrEmpty($sup)) {
if (-Not ($WntdSMachine = $WntdPool.GetMachines()| Where-Object { $_.Name -eq $sup })) { throw "The support machine was not found, aborting..." }
$supData = ConvertFrom-Json $sup
$MachineSet = $WntdTest.GetMachineRole()
$RoleMachines = [System.Collections.Generic.List[object]]::new()

$roleAliases = @{ 'MasterClient' = 'MC'; 'StressClient' = 'SC' }

foreach ($Role in $MachineSet.Roles) {
$RoleMachines.AddRange($Role.GetMachines())
$RoleMachines | foreach { $Role.RemoveMachine($_) }
$RoleMachines.Clear()
if ($Role.Name -eq "Client") {
$Role.AddMachine($WntdMachine)
$existing = [System.Collections.Generic.List[object]]::new()
$existing.AddRange($Role.GetMachines())
$existing | ForEach-Object { $Role.RemoveMachine($_) }

$machineNames = $supData.PSObject.Properties[$Role.Name]
if (-Not $machineNames -and $roleAliases.ContainsKey($Role.Name)) {
$machineNames = $supData.PSObject.Properties[$roleAliases[$Role.Name]]
}
if ($Role.Name -eq "Support") {
$Role.AddMachine($WntdSMachine)
if ($machineNames) {
foreach ($machineName in $machineNames.Value) {
if (-Not ($sm = $WntdPool.GetMachines() | Where-Object { $_.Name -eq $machineName.Trim() })) { throw "Machine '$machineName' for role '$($Role.Name)' was not found, aborting..." }
$Role.AddMachine($sm)
}
} else {
# Roles not listed in $supData (e.g. "Client"/"SUT") default to the primary test machine.
$Role.AddMachine($WntdMachine)
}
}
Comment thread
kostyanf14 marked this conversation as resolved.
Resolved

$MachineSet.ApplyMachineDimensions()
$WntdTest.QueueTest($MachineSet) | Out-Null
} else {
Expand Down
Loading