Less flaky mine tests

This commit is contained in:
Daniel A. Wozniak 2019-04-30 19:26:01 +00:00 committed by Pedro Algarvio
parent 3709ed745e
commit 6e0b61baa9
No known key found for this signature in database
GPG key ID: BB36BF6584A298FF

View file

@ -72,6 +72,9 @@ class MineTest(ModuleCase):
'''
Test mine.flush
'''
# TODO The calls to sleep were added in an attempt to make this tests
# less flaky. If we still see it fail we need to look for a more robust
# solution.
for minion_id in ('minion', 'sub_minion'):
self.assertTrue(
self.run_function(
@ -80,7 +83,7 @@ class MineTest(ModuleCase):
minion_tgt=minion_id
)
)
time.sleep(1)
time.sleep(1)
for minion_id in ('minion', 'sub_minion'):
ret = self.run_function(
'mine.get',
@ -88,12 +91,14 @@ class MineTest(ModuleCase):
minion_tgt=minion_id
)
self.assertEqual(ret[minion_id]['id'], minion_id)
time.sleep(1)
self.assertTrue(
self.run_function(
'mine.flush',
minion_tgt='minion'
)
)
time.sleep(1)
ret_flushed = self.run_function(
'mine.get',
['*', 'grains.items']
@ -105,12 +110,16 @@ class MineTest(ModuleCase):
'''
Test mine.delete
'''
# TODO The calls to sleep were added in an attempt to make this tests
# less flaky. If we still see it fail we need to look for a more robust
# solution.
self.assertTrue(
self.run_function(
'mine.send',
['grains.items']
)
)
time.sleep(1)
# Smoke testing that grains should now exist in the mine
ret_grains = self.run_function(
'mine.get',
@ -123,6 +132,7 @@ class MineTest(ModuleCase):
['test.arg', 'foo=bar', 'fnord=roscivs'],
)
)
time.sleep(1)
ret_args = self.run_function(
'mine.get',
['minion', 'test.arg']
@ -144,6 +154,7 @@ class MineTest(ModuleCase):
['test.echo', 'foo']
)
)
time.sleep(1)
ret_echo = self.run_function(
'mine.get',
['minion', 'test.echo']
@ -156,6 +167,7 @@ class MineTest(ModuleCase):
['test.arg']
)
)
time.sleep(1)
ret_arg_deleted = self.run_function(
'mine.get',
['minion', 'test.arg']