mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Merge pull request #47184 from Ch3LL/status_test
Add status module integration modules tests for Windows
This commit is contained in:
commit
65f344e371
@ -10,6 +10,7 @@ from tests.support.unit import skipIf
|
||||
|
||||
# Import Salt libs
|
||||
import salt.utils
|
||||
from salt.ext import six
|
||||
|
||||
|
||||
class StatusModuleTest(ModuleCase):
|
||||
@ -26,3 +27,49 @@ class StatusModuleTest(ModuleCase):
|
||||
random_pid = random.choice(grab_pids)
|
||||
grep_salt = self.run_function('cmd.run', ['ps aux | grep salt'])
|
||||
self.assertIn(random_pid, grep_salt)
|
||||
|
||||
@skipIf(not salt.utils.is_windows(), 'windows only test')
|
||||
def test_status_cpuload(self):
|
||||
'''
|
||||
status.cpuload
|
||||
'''
|
||||
ret = self.run_function('status.cpuload')
|
||||
self.assertTrue(isinstance(ret, float))
|
||||
|
||||
@skipIf(not salt.utils.is_windows(), 'windows only test')
|
||||
def test_status_saltmem(self):
|
||||
'''
|
||||
status.saltmem
|
||||
'''
|
||||
ret = self.run_function('status.saltmem')
|
||||
self.assertTrue(isinstance(ret, int))
|
||||
|
||||
def test_status_diskusage(self):
|
||||
'''
|
||||
status.diskusage
|
||||
'''
|
||||
ret = self.run_function('status.diskusage')
|
||||
if salt.utils.is_windows():
|
||||
self.assertTrue(isinstance(ret['percent'], float))
|
||||
else:
|
||||
self.assertIn('total', str(ret))
|
||||
self.assertIn('available', str(ret))
|
||||
|
||||
def test_status_procs(self):
|
||||
'''
|
||||
status.procs
|
||||
'''
|
||||
ret = self.run_function('status.procs')
|
||||
for x, y in six.iteritems(ret):
|
||||
self.assertIn('cmd', y)
|
||||
|
||||
def test_status_uptime(self):
|
||||
'''
|
||||
status.uptime
|
||||
'''
|
||||
ret = self.run_function('status.uptime')
|
||||
|
||||
if salt.utils.is_windows():
|
||||
self.assertTrue(isinstance(ret, float))
|
||||
else:
|
||||
self.assertTrue(isinstance(ret['days'], int))
|
||||
|
@ -18,6 +18,7 @@ integration.modules.test_pillar
|
||||
integration.modules.test_pkg
|
||||
integration.modules.test_publish
|
||||
integration.modules.test_state
|
||||
integration.modules.test_status
|
||||
integration.modules.test_sysmod
|
||||
integration.modules.test_test
|
||||
integration.modules.test_useradd
|
||||
|
Loading…
Reference in New Issue
Block a user