Last active
April 12, 2017 05:39
-
-
Save midacts/8f0c03394325f598eb6b46a4def40729 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 = 'Memory Limit' | |
# Test description: How New-VesterConfig explains this value to the user | |
$Description = 'Specify a VM Memory limit' | |
# The config entry stating the desired values | |
$Desired = $cfg.vm.memorylimit | |
# The test value's data type, to help with conversion: bool/string/int | |
$Type = 'int' | |
# 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.Config.MemoryAllocation.Limit | |
} | |
# The command(s) to match the environment to the config | |
# Use $Object to help filter, and $Desired to set the correct value | |
[ScriptBlock]$Fix = { | |
If ($Desired -eq -1) | |
{ | |
$Object | Get-VMResourceConfiguration | Set-VMResourceConfiguration -MemLimitMB $NULL | |
} | |
Else | |
{ | |
$Object | Get-VMResourceConfiguration | Set-VMResourceConfiguration -MemLimitMB $Desired | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment