Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make grains integration test more robust #49020

Merged
merged 1 commit into from
Aug 8, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions tests/integration/modules/test_grains.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,16 +163,23 @@ def test_grains_append(self):

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):
'''
Expand Down