mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Skip tests that fail on Windows
This commit is contained in:
parent
f4ae97f795
commit
7f1c22ce3a
1 changed files with 28 additions and 12 deletions
|
@ -25,7 +25,8 @@ from salt.ext import six
|
|||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@skipIf(not salt.utils.platform.is_linux(), 'These tests can only be run on linux')
|
||||
@skipIf(not salt.utils.platform.is_linux(),
|
||||
'These tests can only be run on linux')
|
||||
class SystemModuleTest(ModuleCase):
|
||||
'''
|
||||
Validate the date/time functions in the system module
|
||||
|
@ -362,7 +363,8 @@ class SystemModuleTest(ModuleCase):
|
|||
self.assertTrue(self._hwclock_has_compare())
|
||||
|
||||
|
||||
@skipIf(not salt.utils.platform.is_windows(), 'These tests can only be run on windows')
|
||||
@skipIf(not salt.utils.platform.is_windows(),
|
||||
'These tests can only be run on windows')
|
||||
class WinSystemModuleTest(ModuleCase):
|
||||
'''
|
||||
Validate the date/time functions in the win_system module
|
||||
|
@ -389,12 +391,16 @@ class WinSystemModuleTest(ModuleCase):
|
|||
'''
|
||||
Test setting the computer description
|
||||
'''
|
||||
current_desc = self.run_function('system.get_computer_desc')
|
||||
desc = 'test description'
|
||||
set_desc = self.run_function('system.set_computer_desc', [desc])
|
||||
self.assertTrue(set_desc)
|
||||
try:
|
||||
set_desc = self.run_function('system.set_computer_desc', [desc])
|
||||
self.assertTrue(set_desc)
|
||||
|
||||
get_desc = self.run_function('system.get_computer_desc')
|
||||
self.assertEqual(set_desc['Computer Description'], get_desc)
|
||||
get_desc = self.run_function('system.get_computer_desc')
|
||||
self.assertEqual(set_desc['Computer Description'], get_desc)
|
||||
finally:
|
||||
self.run_function('system.set_computer_desc', [current_desc])
|
||||
|
||||
def test_get_system_time(self):
|
||||
'''
|
||||
|
@ -404,17 +410,20 @@ class WinSystemModuleTest(ModuleCase):
|
|||
now = datetime.datetime.now()
|
||||
self.assertEqual(now.strftime("%I:%M"), ret.rsplit(':', 1)[0])
|
||||
|
||||
@flaky
|
||||
@skipIf(True, 'This test fails due to NTP settings')
|
||||
@destructiveTest
|
||||
@flaky
|
||||
def test_set_system_time(self):
|
||||
'''
|
||||
Test setting the system time
|
||||
'''
|
||||
test_time = '10:55'
|
||||
set_time = self.run_function('system.set_system_time', [test_time + ' AM'])
|
||||
get_time = self.run_function('system.get_system_time').rsplit(':', 1)[0]
|
||||
self.assertEqual(get_time, test_time)
|
||||
current_time = self.run_function('system.get_system_time')
|
||||
try:
|
||||
self.run_function('system.set_system_time', [test_time + ' AM'])
|
||||
get_time = self.run_function('system.get_system_time').rsplit(':', 1)[0]
|
||||
self.assertEqual(get_time, test_time)
|
||||
finally:
|
||||
self.run_function('system.set_system_time', [current_time])
|
||||
|
||||
def test_get_system_date(self):
|
||||
'''
|
||||
|
@ -424,9 +433,16 @@ class WinSystemModuleTest(ModuleCase):
|
|||
date = datetime.datetime.now().date().strftime("%m/%d/%Y")
|
||||
self.assertEqual(date, ret)
|
||||
|
||||
@skipIf(True, 'This test fails due to NTP settings')
|
||||
@destructiveTest
|
||||
def test_set_system_date(self):
|
||||
'''
|
||||
Test setting system date
|
||||
'''
|
||||
self.assertTrue(self.run_function('system.set_system_date', ['3/25/2018']))
|
||||
current_date = self.run_function('system.get_system_date')
|
||||
try:
|
||||
self.run_function('system.set_system_date', ['03/25/2018'])
|
||||
ret = self.run_function('system.get_system_date')
|
||||
self.assertEqual(ret, '03/25/2018')
|
||||
finally:
|
||||
self.run_function('system.set_system_date', [current_date])
|
||||
|
|
Loading…
Add table
Reference in a new issue