Skip to content

Commit f6041af

Browse files
authored
Merge pull request #11243 from hyonholee/march
[Compute] Show the exact string value for VM PowerState in the table format.
2 parents 1b7bf02 + 68373c4 commit f6041af

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/Compute/Compute.Test/ScenarioTests/VirtualMachineTests.ps1

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2971,12 +2971,16 @@ function Test-VirtualMachineGetStatus
29712971
Assert-True {$a.Contains("Statuses");}
29722972

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

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

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

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

36963700
Remove-AzVM -ResourceGroupName $rgname -Name $vmname -Force;
36973701
}

src/Compute/Compute/ChangeLog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
- Additional information about change #1
2020
-->
2121
## Upcoming Release
22-
22+
* Show the exact string value for VM PowerState in the table format.
2323
## Version 3.5.0
2424
* Allowed empty value for ProximityPlacementGroupId during update
2525

src/Compute/Compute/Compute.format.ps1xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@
729729
<ScriptBlock>$_.Zones</ScriptBlock>
730730
</TableColumnItem>
731731
<TableColumnItem>
732-
<ScriptBlock>$_.PowerState.Replace("VM ", "")</ScriptBlock>
732+
<ScriptBlock>$_.PowerState</ScriptBlock>
733733
</TableColumnItem>
734734
<TableColumnItem>
735735
<ScriptBlock>$_.MaintenanceRedeployStatus.IsCustomerInitiatedMaintenanceAllowed</ScriptBlock>

0 commit comments

Comments
 (0)