Skip to content

Commit

Permalink
Merge pull request #11243 from hyonholee/march
Browse files Browse the repository at this point in the history
[Compute] Show the exact string value for VM PowerState in the table format.
  • Loading branch information
isra-fel authored Mar 5, 2020
2 parents f247883 + 2785fdf commit 1e61d9b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2971,12 +2971,16 @@ function Test-VirtualMachineGetStatus
Assert-True {$a.Contains("Statuses");}

$vms = Get-AzVM -ResourceGroupName $rgname -Status;
Assert-AreEqual "VM running" ($vms | ? {$_.Name -eq $vmname}).PowerState;
$a = $vms | Out-String;
Write-Verbose($a);
Assert-True {$a.Contains("VM running")};

$vms = Get-AzVM -Status;
Assert-AreEqual "VM running" ($vms | ? {$_.Name -eq $vmname}).PowerState;
$a = $vms | Out-String;
Write-Verbose($a);
Assert-True {$a.Contains("VM running")};

# VM Compact output
$a = $vms[0] | Format-Custom | Out-String;
Expand Down Expand Up @@ -3685,13 +3689,13 @@ function Test-VirtualMachineStop
# Get VM
$vm = Get-AzVM -ResourceGroupName $rgname -Name $vmname;
$vmstate = Get-AzVM -ResourceGroupName $rgname -Name $vmname -Status;
Assert-AreEqual "PowerState/running" $vmstate.Statuses[1].Code
Assert-AreEqual "PowerState/running" $vmstate.Statuses[1].Code;

# Stop the VM
Stop-AzVM -ResourceGroupName $rgname -Name $vmname -StayProvisioned -SkipShutdown -Force;
$vm = Get-AzVM -ResourceGroupName $rgname -Name $vmname;
$vmstate = Get-AzVM -ResourceGroupName $rgname -Name $vmname -Status;
Assert-AreEqual "PowerState/stopped" $vmstate.Statuses[1].Code
Assert-AreEqual "PowerState/stopped" $vmstate.Statuses[1].Code;

Remove-AzVM -ResourceGroupName $rgname -Name $vmname -Force;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Compute/Compute/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
- Additional information about change #1
-->
## Upcoming Release

* Show the exact string value for VM PowerState in the table format.
## Version 3.5.0
* Allowed empty value for ProximityPlacementGroupId during update

Expand Down
2 changes: 1 addition & 1 deletion src/Compute/Compute/Compute.format.ps1xml
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@
<ScriptBlock>$_.Zones</ScriptBlock>
</TableColumnItem>
<TableColumnItem>
<ScriptBlock>$_.PowerState.Replace("VM ", "")</ScriptBlock>
<ScriptBlock>$_.PowerState</ScriptBlock>
</TableColumnItem>
<TableColumnItem>
<ScriptBlock>$_.MaintenanceRedeployStatus.IsCustomerInitiatedMaintenanceAllowed</ScriptBlock>
Expand Down

0 comments on commit 1e61d9b

Please sign in to comment.