mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add integration test for (mem|swap)_total grains on OpenBSD
This commit is contained in:
parent
93b44abd6c
commit
26417d8e83
1 changed files with 26 additions and 1 deletions
|
@ -19,6 +19,10 @@ if salt.utils.platform.is_windows():
|
|||
pass
|
||||
|
||||
|
||||
def _freebsd_or_openbsd():
|
||||
return salt.utils.platform.is_freebsd() or salt.utils.platform.is_openbsd()
|
||||
|
||||
|
||||
class TestGrainsCore(ModuleCase):
|
||||
'''
|
||||
Test the core grains grains
|
||||
|
@ -28,7 +32,6 @@ class TestGrainsCore(ModuleCase):
|
|||
'''
|
||||
test grains['cpu_model']
|
||||
'''
|
||||
opts = self.minion_opts
|
||||
cpu_model_text = salt.modules.reg.read_value(
|
||||
'HKEY_LOCAL_MACHINE',
|
||||
'HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0',
|
||||
|
@ -37,3 +40,25 @@ class TestGrainsCore(ModuleCase):
|
|||
self.run_function('grains.items')['cpu_model'],
|
||||
cpu_model_text
|
||||
)
|
||||
|
||||
@skipIf(not _freebsd_or_openbsd(), 'Only run on FreeBSD or OpenBSD')
|
||||
def test_freebsd_openbsd_mem_total(self):
|
||||
'''
|
||||
test grains['mem_total']
|
||||
'''
|
||||
physmem = self.run_function('sysctl.get', ['hw.physmem'])
|
||||
self.assertEqual(
|
||||
self.run_function('grains.items')['mem_total'],
|
||||
int(physmem) / 1048576
|
||||
)
|
||||
|
||||
@skipIf(not salt.utils.platform.is_openbsd(), 'Only run on OpenBSD')
|
||||
def test_openbsd_swap_total(self):
|
||||
'''
|
||||
test grains['swap_total']
|
||||
'''
|
||||
swapmem = self.run_function('cmd.run', ['swapctl -sk']).split(' ')[1]
|
||||
self.assertEqual(
|
||||
self.run_function('grains.items')['swap_total'],
|
||||
int(swapmem) / 1048576
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue