mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 00:55:19 +00:00
tests: recognize OpenBSD
This commit is contained in:
parent
8b48542214
commit
1ef276575f
@ -70,7 +70,7 @@ class CMDModuleTest(integration.ModuleCase):
|
||||
from salt.modules import cmdmod
|
||||
|
||||
cmdmod.__grains__ = {'os': 'darwin'}
|
||||
if sys.platform.startswith('freebsd'):
|
||||
if sys.platform.startswith(('freebsd', 'openbsd')):
|
||||
shell = '/bin/sh'
|
||||
else:
|
||||
shell = '/bin/bash'
|
||||
@ -102,7 +102,7 @@ class CMDModuleTest(integration.ModuleCase):
|
||||
'''
|
||||
cmd.run_stderr
|
||||
'''
|
||||
if sys.platform.startswith('freebsd'):
|
||||
if sys.platform.startswith(('freebsd', 'openbsd')):
|
||||
shell = '/bin/sh'
|
||||
else:
|
||||
shell = '/bin/bash'
|
||||
@ -119,7 +119,7 @@ class CMDModuleTest(integration.ModuleCase):
|
||||
'''
|
||||
from salt._compat import string_types
|
||||
|
||||
if sys.platform.startswith('freebsd'):
|
||||
if sys.platform.startswith(('freebsd', 'openbsd')):
|
||||
shell = '/bin/sh'
|
||||
else:
|
||||
shell = '/bin/bash'
|
||||
|
@ -58,7 +58,7 @@ class FileModuleTest(integration.ModuleCase):
|
||||
user = getpass.getuser()
|
||||
if sys.platform == 'darwin':
|
||||
group = 'staff'
|
||||
elif sys.platform.startswith(('linux', 'freebsd')):
|
||||
elif sys.platform.startswith(('linux', 'freebsd', 'openbsd')):
|
||||
group = grp.getgrgid(pwd.getpwuid(os.getuid()).pw_gid).gr_name
|
||||
ret = self.run_function('file.chown', arg=[self.myfile, user, group])
|
||||
self.assertIsNone(ret)
|
||||
@ -86,7 +86,7 @@ class FileModuleTest(integration.ModuleCase):
|
||||
user = getpass.getuser()
|
||||
if sys.platform == 'darwin':
|
||||
group = 'staff'
|
||||
elif sys.platform.startswith(('linux', 'freebsd')):
|
||||
elif sys.platform.startswith(('linux', 'freebsd', 'openbsd')):
|
||||
group = grp.getgrgid(pwd.getpwuid(os.getuid()).pw_gid).gr_name
|
||||
ret = self.run_function('file.chown',
|
||||
arg=['/tmp/nosuchfile', user, group])
|
||||
@ -106,7 +106,7 @@ class FileModuleTest(integration.ModuleCase):
|
||||
def test_chgrp(self):
|
||||
if sys.platform == 'darwin':
|
||||
group = 'everyone'
|
||||
elif sys.platform.startswith(('linux', 'freebsd')):
|
||||
elif sys.platform.startswith(('linux', 'freebsd', 'openbsd')):
|
||||
group = grp.getgrgid(pwd.getpwuid(os.getuid()).pw_gid).gr_name
|
||||
ret = self.run_function('file.chgrp', arg=[self.myfile, group])
|
||||
self.assertIsNone(ret)
|
||||
|
@ -37,6 +37,14 @@ class SysctlModuleTest(integration.ModuleCase):
|
||||
1,
|
||||
'Multiline value was parsed wrong')
|
||||
|
||||
@skipIf(not sys.platform.startswith('openbsd'), 'OpenBSD specific')
|
||||
def test_show_openbsd(self):
|
||||
ret = self.run_function('sysctl.show')
|
||||
self.assertIn('kern.ostype', ret, 'kern.ostype absent')
|
||||
self.assertEqual(
|
||||
ret.get('kern.ostype'), 'OpenBSD', 'Incorrect kern.ostype'
|
||||
)
|
||||
|
||||
@skipIf(not sys.platform.startswith('darwin'), 'Darwin (OS X) specific')
|
||||
def test_show_darwin(self):
|
||||
ret = self.run_function('sysctl.show')
|
||||
|
@ -229,7 +229,7 @@ class TestFind(TestCase):
|
||||
ValueError, salt.utils.find.GroupOption, 'group', 'notexist'
|
||||
)
|
||||
|
||||
if sys.platform.startswith(('darwin', 'freebsd')):
|
||||
if sys.platform.startswith(('darwin', 'freebsd', 'openbsd')):
|
||||
group_name = 'wheel'
|
||||
else:
|
||||
group_name = 'root'
|
||||
@ -238,7 +238,7 @@ class TestFind(TestCase):
|
||||
|
||||
@skipIf(sys.platform.startswith('win'), 'No /dev/null on Windows')
|
||||
def test_group_option_match(self):
|
||||
if sys.platform.startswith(('darwin', 'freebsd')):
|
||||
if sys.platform.startswith(('darwin', 'freebsd', 'openbsd')):
|
||||
group_name = 'wheel'
|
||||
else:
|
||||
group_name = 'root'
|
||||
@ -414,7 +414,7 @@ class TestPrintOption(TestCase):
|
||||
@skipIf(sys.platform.startswith('Windows'), "no /dev/null on windows")
|
||||
def test_print_group(self):
|
||||
option = salt.utils.find.PrintOption('print', 'group')
|
||||
if sys.platform.startswith(('darwin', 'freebsd')):
|
||||
if sys.platform.startswith(('darwin', 'freebsd', 'openbsd')):
|
||||
group_name = 'wheel'
|
||||
else:
|
||||
group_name = 'root'
|
||||
@ -508,7 +508,7 @@ class TestFinder(TestCase):
|
||||
str(finder.criteria[0].__class__)[-13:-2], 'OwnerOption'
|
||||
)
|
||||
|
||||
if sys.platform.startswith(('darwin', 'freebsd')):
|
||||
if sys.platform.startswith(('darwin', 'freebsd', 'openbsd')):
|
||||
group_name = 'wheel'
|
||||
else:
|
||||
group_name = 'root'
|
||||
|
Loading…
Reference in New Issue
Block a user