mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #49020 from rallytime/fix-grains-test
Make grains integration test more robust
This commit is contained in:
commit
6b6d68c615
1 changed files with 10 additions and 3 deletions
|
@ -163,16 +163,23 @@ class GrainsAppendTestCase(ModuleCase):
|
|||
|
||||
def test_grains_append_val_already_present(self):
|
||||
'''
|
||||
Tests the return of a grains.append call when the value is already present in the grains list.
|
||||
Tests the return of a grains.append call when the value is already
|
||||
present in the grains list.
|
||||
'''
|
||||
messaging = 'The val {0} was already in the list salttesting-grain-key'.format(self.GRAIN_VAL)
|
||||
msg = 'The val {0} was already in the list ' \
|
||||
'salttesting-grain-key'.format(self.GRAIN_VAL)
|
||||
|
||||
# First, make sure the test grain is present
|
||||
self.run_function('grains.append', [self.GRAIN_KEY, self.GRAIN_VAL])
|
||||
|
||||
# Now try to append again
|
||||
ret = self.run_function('grains.append', [self.GRAIN_KEY, self.GRAIN_VAL])
|
||||
self.assertEqual(messaging, ret)
|
||||
if not ret or isinstance(ret, dict):
|
||||
# Sleep for a bit, sometimes the second "append" runs too quickly
|
||||
time.sleep(5)
|
||||
ret = self.run_function('grains.append', [self.GRAIN_KEY, self.GRAIN_VAL])
|
||||
|
||||
assert msg == ret
|
||||
|
||||
def test_grains_append_val_is_list(self):
|
||||
'''
|
||||
|
|
Loading…
Add table
Reference in a new issue