mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Test that an unknown argument to salt-minion exits with EX_USAGE
This commit is contained in:
parent
b5e66ad853
commit
920f062193
1 changed files with 26 additions and 0 deletions
|
@ -305,6 +305,32 @@ class MinionTest(integration.ShellCase, integration.ShellCaseCommonTestsMixIn):
|
|||
stderr=stderr
|
||||
)
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
def test_exit_status_unknown_argument(self):
|
||||
'''
|
||||
Ensure correct exit status when an unknown argument is passed to salt-minion.
|
||||
'''
|
||||
|
||||
user = getpass.getuser()
|
||||
|
||||
minion = testprogram.TestDaemonSaltMinion(
|
||||
name='unknown_argument',
|
||||
program=os.path.join(integration.CODE_DIR, 'scripts', 'salt-minion'),
|
||||
config={'user': user},
|
||||
parent_dir=self._test_dir,
|
||||
env={
|
||||
'PYTHONPATH': ':'.join(sys.path),
|
||||
},
|
||||
)
|
||||
# Call setup here to ensure config and script exist
|
||||
minion.setup()
|
||||
stdout, stderr, status = minion.run(
|
||||
args=['-d', '--unknown-argument'],
|
||||
catch_stderr=True,
|
||||
with_retcode=True,
|
||||
)
|
||||
self._assert_exit_status(status, 'EX_USAGE', message='unknown argument', stdout=stdout, stderr=stderr)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
integration.run_tests(MinionTest)
|
||||
|
|
Loading…
Add table
Reference in a new issue