Skip to content

Commit

Permalink
Merge pull request #20 from rallytime/2015.8.12_follow_up-batch-tests
Browse files Browse the repository at this point in the history
Clean up tests and docs for batch execution
  • Loading branch information
Nicole Thomas authored Jan 9, 2017
2 parents c80b20b + 3428232 commit f881f36
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 72 deletions.
2 changes: 1 addition & 1 deletion doc/topics/netapi/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ simply by creating a data structure. (And this is exactly how much of Salt's
own internals work!)

.. autoclass:: salt.netapi.NetapiClient
:members: local, local_async, local_batch, ssh, ssh_async, runner,
:members: local, local_async, ssh, ssh_async, runner,
runner_async, wheel, wheel_async
2 changes: 1 addition & 1 deletion salt/netapi/rest_tornado/saltnado.py
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ def get(self):
Content-Type: application/json
Content-Legnth: 83
{"clients": ["local", "local_batch", "local_async", "runner", "runner_async"], "return": "Welcome"}
{"clients": ["local", "local_async", "runner", "runner_async"], "return": "Welcome"}
'''
ret = {"clients": list(self.saltclients.keys()),
"return": "Welcome"}
Expand Down
77 changes: 7 additions & 70 deletions tests/integration/netapi/rest_tornado/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,12 @@ def test_root(self):
)
self.assertEqual(response.code, 200)
response_obj = json.loads(response.body)
self.assertEqual(response_obj['clients'],
['runner',
'runner_async',
'local_async',
'local',
'local_batch']
)
self.assertItemsEqual(response_obj['clients'],
['runner',
'runner_async',
'local_async',
'local']
)
self.assertEqual(response_obj['return'], 'Welcome')

def test_post_no_auth(self):
Expand Down Expand Up @@ -117,68 +116,6 @@ def test_simple_local_post_no_tgt(self):
response_obj = json.loads(response.body)
self.assertEqual(response_obj['return'], ["No minions matched the target. No command was sent, no jid was assigned."])

# local_batch tests
@skipIf(True, 'to be reenabled when #23623 is merged')
def test_simple_local_batch_post(self):
'''
Basic post against local_batch
'''
low = [{'client': 'local_batch',
'tgt': '*',
'fun': 'test.ping',
}]
response = self.fetch('/',
method='POST',
body=json.dumps(low),
headers={'Content-Type': self.content_type_map['json'],
saltnado.AUTH_TOKEN_HEADER: self.token['token']},
connect_timeout=30,
request_timeout=30,
)
response_obj = json.loads(response.body)
self.assertEqual(response_obj['return'], [{'minion': True, 'sub_minion': True}])

# local_batch tests
@skipIf(True, 'to be reenabled when #23623 is merged')
def test_full_local_batch_post(self):
'''
Test full parallelism of local_batch
'''
low = [{'client': 'local_batch',
'tgt': '*',
'fun': 'test.ping',
'batch': '100%',
}]
response = self.fetch('/',
method='POST',
body=json.dumps(low),
headers={'Content-Type': self.content_type_map['json'],
saltnado.AUTH_TOKEN_HEADER: self.token['token']},
connect_timeout=30,
request_timeout=30,
)
response_obj = json.loads(response.body)
self.assertEqual(response_obj['return'], [{'minion': True, 'sub_minion': True}])

def test_simple_local_batch_post_no_tgt(self):
'''
Local_batch testing with no tgt
'''
low = [{'client': 'local_batch',
'tgt': 'minion_we_dont_have',
'fun': 'test.ping',
}]
response = self.fetch('/',
method='POST',
body=json.dumps(low),
headers={'Content-Type': self.content_type_map['json'],
saltnado.AUTH_TOKEN_HEADER: self.token['token']},
connect_timeout=30,
request_timeout=30,
)
response_obj = json.loads(response.body)
self.assertEqual(response_obj['return'], [{}])

# local_async tests
def test_simple_local_async_post(self):
low = [{'client': 'local_async',
Expand Down Expand Up @@ -400,7 +337,7 @@ def test_post_with_incorrect_client(self):
make sure you get an error
'''
# get a token for this test
low = [{'client': 'local_batch',
low = [{'client': 'local',
'tgt': '*',
'fun': 'test.ping',
}]
Expand Down

0 comments on commit f881f36

Please sign in to comment.