Fix integration.modules.test_mine.MineTest.test_get for sub_minion

Since the `sub_minion` does not have `mine_functions` defined,
`mine.update` returns `None` as opposed to `True` when `mine_functions`
are defined.
This commit is contained in:
Pedro Algarvio 2019-01-18 12:15:30 +00:00
parent 26314f58e5
commit eb5fd3ece2
No known key found for this signature in database
GPG key ID: BB36BF6584A298FF
2 changed files with 9 additions and 3 deletions

View file

@ -19,12 +19,16 @@ class MineTest(ModuleCase):
test mine.get and mine.update
'''
self.assertTrue(self.run_function('mine.update', minion_tgt='minion'))
self.assertTrue(
# The sub_minion does not have mine_functions defined in its configuration
# In this case, mine.update returns None
self.assertIsNone(
self.run_function(
'mine.update',
minion_tgt='sub_minion'
)
)
# Since the minion has mine_functions defined in its configuration,
# mine.update will return True
self.assertTrue(
self.run_function(
'mine.get',

View file

@ -800,9 +800,11 @@ class ModuleCase(TestCase, SaltClientTestCaseMixin):
Run a single salt function and condition the return down to match the
behavior of the raw function call
'''
know_to_return_none = (
known_to_return_none = (
'file.chown', 'file.chgrp', 'ssh.recv_known_host_entries'
)
if minion_tgt == 'sub_minion':
known_to_return_none += ('mine.update',)
if 'f_arg' in kwargs:
kwargs['arg'] = kwargs.pop('f_arg')
if 'f_timeout' in kwargs:
@ -820,7 +822,7 @@ class ModuleCase(TestCase, SaltClientTestCaseMixin):
minion_tgt, orig
)
)
elif orig[minion_tgt] is None and function not in know_to_return_none:
elif orig[minion_tgt] is None and function not in known_to_return_none:
self.skipTest(
'WARNING(SHOULD NOT HAPPEN #1935): Failed to get \'{0}\' from '
'the minion \'{1}\'. Command output: {2}'.format(