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

Write some more simple batch command tests #33985

Merged
merged 1 commit into from
Jun 14, 2016
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
48 changes: 48 additions & 0 deletions tests/integration/cli/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,54 @@ def test_batch_run(self):
cmd = sorted(self.run_salt('\'*\' test.echo \'batch testing\' -b 50%'))
self.assertListEqual(cmd, ret)

def test_batch_run_number(self):
'''
Tests executing a simple batch command using a number division instead of
a percentage with full batch CLI call.
'''
ret = ['',
"Executing run on ['sub_minion', 'minion']",
'',
'retcode:',
' 0',
'sub_minion:',
' True',
'minion:',
' True',
'retcode:',
' 0']
cmd = sorted(self.run_salt('\'*\' test.ping --batch-size 2'))
self.assertListEqual(cmd, sorted(ret))

def test_batch_run_grains_targeting(self):
'''
Tests executing a batch command using a percentage divisor as well as grains
targeting.
'''
os_grain = ''
ret = ['',
"Executing run on ['sub_minion']",
'',
'retcode:',
' 0',
'sub_minion:',
' True',
'',
"Executing run on ['minion']",
'',
'minion:',
' True',
'retcode:',
' 0']

for item in self.run_salt('minion grains.get os'):
if item != 'minion':
os_grain = item

os_grain = os_grain.strip()
cmd = sorted(self.run_salt('-G \'os:{0}\' -b 25% test.ping'.format(os_grain)))
self.assertListEqual(cmd, sorted(ret))


if __name__ == '__main__':
from integration import run_tests
Expand Down