mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Wait for orphans in test_exit_status_correct_usage
Also ensure that the shutdown will be run even when assertions fail
This commit is contained in:
parent
cb91437b08
commit
0428617b52
4 changed files with 142 additions and 106 deletions
|
@ -95,16 +95,18 @@ class MasterTest(ShellCase, testprogram.TestProgramCase, ShellCaseCommonTestsMix
|
|||
catch_stderr=True,
|
||||
with_retcode=True,
|
||||
)
|
||||
self.assert_exit_status(
|
||||
status, 'EX_NOUSER',
|
||||
message='unknown user not on system',
|
||||
stdout=stdout,
|
||||
stderr=tests.integration.utils.decode_byte_list(stderr)
|
||||
)
|
||||
# Although the start-up should fail, call shutdown() to set the internal
|
||||
# _shutdown flag and avoid the registered atexit calls to cause timeout
|
||||
# exeptions and respective traceback
|
||||
master.shutdown()
|
||||
try:
|
||||
self.assert_exit_status(
|
||||
status, 'EX_NOUSER',
|
||||
message='unknown user not on system',
|
||||
stdout=stdout,
|
||||
stderr=tests.integration.utils.decode_byte_list(stderr)
|
||||
)
|
||||
finally:
|
||||
# Although the start-up should fail, call shutdown() to set the
|
||||
# internal _shutdown flag and avoid the registered atexit calls to
|
||||
# cause timeout exeptions and respective traceback
|
||||
master.shutdown()
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
def test_exit_status_unknown_argument(self):
|
||||
|
@ -123,16 +125,18 @@ class MasterTest(ShellCase, testprogram.TestProgramCase, ShellCaseCommonTestsMix
|
|||
catch_stderr=True,
|
||||
with_retcode=True,
|
||||
)
|
||||
self.assert_exit_status(
|
||||
status, 'EX_USAGE',
|
||||
message='unknown argument',
|
||||
stdout=stdout,
|
||||
stderr=tests.integration.utils.decode_byte_list(stderr)
|
||||
)
|
||||
# Although the start-up should fail, call shutdown() to set the internal
|
||||
# _shutdown flag and avoid the registered atexit calls to cause timeout
|
||||
# exeptions and respective traceback
|
||||
master.shutdown()
|
||||
try:
|
||||
self.assert_exit_status(
|
||||
status, 'EX_USAGE',
|
||||
message='unknown argument',
|
||||
stdout=stdout,
|
||||
stderr=tests.integration.utils.decode_byte_list(stderr)
|
||||
)
|
||||
finally:
|
||||
# Although the start-up should fail, call shutdown() to set the
|
||||
# internal _shutdown flag and avoid the registered atexit calls to
|
||||
# cause timeout exeptions and respective traceback
|
||||
master.shutdown()
|
||||
|
||||
def test_exit_status_correct_usage(self):
|
||||
'''
|
||||
|
@ -150,23 +154,28 @@ class MasterTest(ShellCase, testprogram.TestProgramCase, ShellCaseCommonTestsMix
|
|||
catch_stderr=True,
|
||||
with_retcode=True,
|
||||
)
|
||||
self.assert_exit_status(
|
||||
status, 'EX_OK',
|
||||
message='correct usage',
|
||||
stdout=stdout,
|
||||
stderr=tests.integration.utils.decode_byte_list(stderr)
|
||||
)
|
||||
master.shutdown()
|
||||
try:
|
||||
self.assert_exit_status(
|
||||
status, 'EX_OK',
|
||||
message='correct usage',
|
||||
stdout=stdout,
|
||||
stderr=tests.integration.utils.decode_byte_list(stderr)
|
||||
)
|
||||
finally:
|
||||
master.shutdown(wait_for_orphans=3)
|
||||
|
||||
# Do the test again to check does master shut down correctly
|
||||
stdout, stderr, status = master.run(
|
||||
args=['-d'],
|
||||
catch_stderr=True,
|
||||
with_retcode=True,
|
||||
)
|
||||
self.assert_exit_status(
|
||||
status, 'EX_OK',
|
||||
message='correct usage',
|
||||
stdout=stdout,
|
||||
stderr=tests.integration.utils.decode_byte_list(stderr)
|
||||
)
|
||||
master.shutdown()
|
||||
try:
|
||||
self.assert_exit_status(
|
||||
status, 'EX_OK',
|
||||
message='correct usage',
|
||||
stdout=stdout,
|
||||
stderr=tests.integration.utils.decode_byte_list(stderr)
|
||||
)
|
||||
finally:
|
||||
master.shutdown(wait_for_orphans=3)
|
||||
|
|
|
@ -292,16 +292,18 @@ class MinionTest(ShellCase, testprogram.TestProgramCase, ShellCaseCommonTestsMix
|
|||
catch_stderr=True,
|
||||
with_retcode=True,
|
||||
)
|
||||
self.assert_exit_status(
|
||||
status, 'EX_NOUSER',
|
||||
message='unknown user not on system',
|
||||
stdout=stdout,
|
||||
stderr=tests.integration.utils.decode_byte_list(stderr)
|
||||
)
|
||||
# Although the start-up should fail, call shutdown() to set the internal
|
||||
# _shutdown flag and avoid the registered atexit calls to cause timeout
|
||||
# exeptions and respective traceback
|
||||
minion.shutdown()
|
||||
try:
|
||||
self.assert_exit_status(
|
||||
status, 'EX_NOUSER',
|
||||
message='unknown user not on system',
|
||||
stdout=stdout,
|
||||
stderr=tests.integration.utils.decode_byte_list(stderr)
|
||||
)
|
||||
finally:
|
||||
# Although the start-up should fail, call shutdown() to set the
|
||||
# internal _shutdown flag and avoid the registered atexit calls to
|
||||
# cause timeout exeptions and respective traceback
|
||||
minion.shutdown()
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
def test_exit_status_unknown_argument(self):
|
||||
|
@ -320,16 +322,18 @@ class MinionTest(ShellCase, testprogram.TestProgramCase, ShellCaseCommonTestsMix
|
|||
catch_stderr=True,
|
||||
with_retcode=True,
|
||||
)
|
||||
self.assert_exit_status(
|
||||
status, 'EX_USAGE',
|
||||
message='unknown argument',
|
||||
stdout=stdout,
|
||||
stderr=tests.integration.utils.decode_byte_list(stderr)
|
||||
)
|
||||
# Although the start-up should fail, call shutdown() to set the internal
|
||||
# _shutdown flag and avoid the registered atexit calls to cause timeout
|
||||
# exeptions and respective traceback
|
||||
minion.shutdown()
|
||||
try:
|
||||
self.assert_exit_status(
|
||||
status, 'EX_USAGE',
|
||||
message='unknown argument',
|
||||
stdout=stdout,
|
||||
stderr=tests.integration.utils.decode_byte_list(stderr)
|
||||
)
|
||||
finally:
|
||||
# Although the start-up should fail, call shutdown() to set the
|
||||
# internal _shutdown flag and avoid the registered atexit calls to
|
||||
# cause timeout exeptions and respective traceback
|
||||
minion.shutdown()
|
||||
|
||||
def test_exit_status_correct_usage(self):
|
||||
'''
|
||||
|
@ -352,4 +356,4 @@ class MinionTest(ShellCase, testprogram.TestProgramCase, ShellCaseCommonTestsMix
|
|||
message='correct usage',
|
||||
stdout=stdout, stderr=stderr
|
||||
)
|
||||
minion.shutdown()
|
||||
minion.shutdown(wait_for_orphans=3)
|
||||
|
|
|
@ -45,13 +45,18 @@ class ProxyTest(testprogram.TestProgramCase):
|
|||
# without daemonizing - protect that with a timeout.
|
||||
timeout=60,
|
||||
)
|
||||
self.assert_exit_status(
|
||||
status, 'EX_USAGE',
|
||||
message='no --proxyid specified',
|
||||
stdout=stdout,
|
||||
stderr=tests.integration.utils.decode_byte_list(stderr)
|
||||
)
|
||||
# proxy.shutdown() should be unnecessary since the start-up should fail
|
||||
try:
|
||||
self.assert_exit_status(
|
||||
status, 'EX_USAGE',
|
||||
message='no --proxyid specified',
|
||||
stdout=stdout,
|
||||
stderr=tests.integration.utils.decode_byte_list(stderr)
|
||||
)
|
||||
finally:
|
||||
# Although the start-up should fail, call shutdown() to set the
|
||||
# internal _shutdown flag and avoid the registered atexit calls to
|
||||
# cause timeout exeptions and respective traceback
|
||||
proxy.shutdown()
|
||||
|
||||
def test_exit_status_unknown_user(self):
|
||||
'''
|
||||
|
@ -70,13 +75,18 @@ class ProxyTest(testprogram.TestProgramCase):
|
|||
catch_stderr=True,
|
||||
with_retcode=True,
|
||||
)
|
||||
self.assert_exit_status(
|
||||
status, 'EX_NOUSER',
|
||||
message='unknown user not on system',
|
||||
stdout=stdout,
|
||||
stderr=tests.integration.utils.decode_byte_list(stderr)
|
||||
)
|
||||
# proxy.shutdown() should be unnecessary since the start-up should fail
|
||||
try:
|
||||
self.assert_exit_status(
|
||||
status, 'EX_NOUSER',
|
||||
message='unknown user not on system',
|
||||
stdout=stdout,
|
||||
stderr=tests.integration.utils.decode_byte_list(stderr)
|
||||
)
|
||||
finally:
|
||||
# Although the start-up should fail, call shutdown() to set the
|
||||
# internal _shutdown flag and avoid the registered atexit calls to
|
||||
# cause timeout exeptions and respective traceback
|
||||
proxy.shutdown()
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
def test_exit_status_unknown_argument(self):
|
||||
|
@ -95,12 +105,17 @@ class ProxyTest(testprogram.TestProgramCase):
|
|||
catch_stderr=True,
|
||||
with_retcode=True,
|
||||
)
|
||||
self.assert_exit_status(
|
||||
status, 'EX_USAGE',
|
||||
message='unknown argument',
|
||||
stdout=stdout, stderr=stderr
|
||||
)
|
||||
# proxy.shutdown() should be unnecessary since the start-up should fail
|
||||
try:
|
||||
self.assert_exit_status(
|
||||
status, 'EX_USAGE',
|
||||
message='unknown argument',
|
||||
stdout=stdout, stderr=stderr
|
||||
)
|
||||
finally:
|
||||
# Although the start-up should fail, call shutdown() to set the
|
||||
# internal _shutdown flag and avoid the registered atexit calls to
|
||||
# cause timeout exeptions and respective traceback
|
||||
proxy.shutdown()
|
||||
|
||||
def test_exit_status_correct_usage(self):
|
||||
'''
|
||||
|
@ -118,10 +133,12 @@ class ProxyTest(testprogram.TestProgramCase):
|
|||
catch_stderr=True,
|
||||
with_retcode=True,
|
||||
)
|
||||
self.assert_exit_status(
|
||||
status, 'EX_OK',
|
||||
message='correct usage',
|
||||
stdout=stdout,
|
||||
stderr=tests.integration.utils.decode_byte_list(stderr)
|
||||
)
|
||||
proxy.shutdown()
|
||||
try:
|
||||
self.assert_exit_status(
|
||||
status, 'EX_OK',
|
||||
message='correct usage',
|
||||
stdout=stdout,
|
||||
stderr=tests.integration.utils.decode_byte_list(stderr)
|
||||
)
|
||||
finally:
|
||||
proxy.shutdown(wait_for_orphans=3)
|
||||
|
|
|
@ -102,15 +102,17 @@ class SyndicTest(ShellCase, testprogram.TestProgramCase, ShellCaseCommonTestsMix
|
|||
catch_stderr=True,
|
||||
with_retcode=True,
|
||||
)
|
||||
self.assert_exit_status(
|
||||
status, 'EX_NOUSER',
|
||||
message='unknown user not on system',
|
||||
stdout=stdout, stderr=stderr
|
||||
)
|
||||
# Although the start-up should fail, call shutdown() to set the internal
|
||||
# _shutdown flag and avoid the registered atexit calls to cause timeout
|
||||
# exeptions and respective traceback
|
||||
syndic.shutdown()
|
||||
try:
|
||||
self.assert_exit_status(
|
||||
status, 'EX_NOUSER',
|
||||
message='unknown user not on system',
|
||||
stdout=stdout, stderr=stderr
|
||||
)
|
||||
finally:
|
||||
# Although the start-up should fail, call shutdown() to set the
|
||||
# internal _shutdown flag and avoid the registered atexit calls to
|
||||
# cause timeout exeptions and respective traceback
|
||||
syndic.shutdown()
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
def test_exit_status_unknown_argument(self):
|
||||
|
@ -129,15 +131,17 @@ class SyndicTest(ShellCase, testprogram.TestProgramCase, ShellCaseCommonTestsMix
|
|||
catch_stderr=True,
|
||||
with_retcode=True,
|
||||
)
|
||||
self.assert_exit_status(
|
||||
status, 'EX_USAGE',
|
||||
message='unknown argument',
|
||||
stdout=stdout, stderr=stderr
|
||||
)
|
||||
# Although the start-up should fail, call shutdown() to set the internal
|
||||
# _shutdown flag and avoid the registered atexit calls to cause timeout
|
||||
# exeptions and respective traceback
|
||||
syndic.shutdown()
|
||||
try:
|
||||
self.assert_exit_status(
|
||||
status, 'EX_USAGE',
|
||||
message='unknown argument',
|
||||
stdout=stdout, stderr=stderr
|
||||
)
|
||||
finally:
|
||||
# Although the start-up should fail, call shutdown() to set the
|
||||
# internal _shutdown flag and avoid the registered atexit calls to
|
||||
# cause timeout exeptions and respective traceback
|
||||
syndic.shutdown()
|
||||
|
||||
def test_exit_status_correct_usage(self):
|
||||
'''
|
||||
|
@ -155,9 +159,11 @@ class SyndicTest(ShellCase, testprogram.TestProgramCase, ShellCaseCommonTestsMix
|
|||
catch_stderr=True,
|
||||
with_retcode=True,
|
||||
)
|
||||
self.assert_exit_status(
|
||||
status, 'EX_OK',
|
||||
message='correct usage',
|
||||
stdout=stdout, stderr=stderr
|
||||
)
|
||||
syndic.shutdown()
|
||||
try:
|
||||
self.assert_exit_status(
|
||||
status, 'EX_OK',
|
||||
message='correct usage',
|
||||
stdout=stdout, stderr=stderr
|
||||
)
|
||||
finally:
|
||||
syndic.shutdown(wait_for_orphans=3)
|
||||
|
|
Loading…
Add table
Reference in a new issue