Skip to content

Commit

Permalink
New test for DPM state
Browse files Browse the repository at this point in the history
Tests if Distributed Power Management (DPM) is enabled.
  • Loading branch information
doogleit committed Oct 8, 2019
1 parent bc03fed commit a6f688f
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Vester/Tests/Cluster/DPM-Enabled.Vester.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Test file for the Vester module - https://github.com/WahlNetwork/Vester
# Called via Invoke-Pester VesterTemplate.Tests.ps1

# Test title, e.g. 'DNS Servers'
$Title = 'DPM State'

# Test description: How New-VesterConfig explains this value to the user
$Description = 'Enables Distributed Power Managment (DPM) on the cluster'

# The config entry stating the desired values
$Desired = $cfg.cluster.dpmenable

# The test value's data type, to help with conversion: bool/string/int
$Type = 'bool'

# The command(s) to pull the actual value for comparison
# $Object will scope to the folder this test is in (Cluster, Host, etc.)
[ScriptBlock]$Actual = {
$Object.ExtensionData.ConfigurationEx.DpmConfigInfo.Enabled
}

# The command(s) to match the environment to the config
# Use $Object to help filter, and $Desired to set the correct value
[ScriptBlock]$Fix = {
$spec = New-Object VMware.Vim.ClusterConfigSpecEx
$spec.dpmConfig = New-Object VMware.Vim.ClusterDpmConfigInfo
$spec.dpmConfig.enabled = $Desired
(Get-View -VIObject $Object).ReconfigureComputeResource_Task($spec, $true)
}

0 comments on commit a6f688f

Please sign in to comment.