Merge "Adding docker tests to cloudpulse"
This commit is contained in:
commit
e80d0602b9
cloudpulse
@ -192,7 +192,9 @@ class ansible_runner(object):
|
||||
if 'failed' in results['contacted'][node]:
|
||||
if results['contacted'][node]['failed'] is True:
|
||||
results['status'] = 'FAIL'
|
||||
results['status_message'] = ''
|
||||
results['status_message'] = " ".join(
|
||||
[("%s -> %s") % (key, results['dark'][key])
|
||||
for key in results['dark']])
|
||||
|
||||
for node in results['contacted'].keys():
|
||||
rc = results['contacted'][node].get('rc', None)
|
||||
|
@ -44,7 +44,10 @@ PERIODIC_TESTS_OPTS = [
|
||||
help='The galera periodic check'),
|
||||
cfg.IntOpt('ceph_check',
|
||||
default=0,
|
||||
help='The ceph periodic check')
|
||||
help='The ceph periodic check'),
|
||||
cfg.IntOpt('docker_check',
|
||||
default=0,
|
||||
help='The docker periodic check')
|
||||
]
|
||||
|
||||
CONF = cfg.CONF
|
||||
@ -143,6 +146,25 @@ class operator_scenario(base.Scenario):
|
||||
return (404, ("Galera Cluster Test Failed: %s" %
|
||||
results['status_message']), [])
|
||||
|
||||
@base.scenario(admin_only=False, operator=True)
|
||||
def docker_check(self):
|
||||
self.load()
|
||||
cmd = "docker ps -aq --filter 'status=exited'"
|
||||
out = self.ans_runner.execute(cmd)
|
||||
|
||||
results, failed_hosts = self.ans_runner.validate_results(out)
|
||||
if results['status'] is 'PASS':
|
||||
docker_failed = {key: results['contacted'][key]['stdout']
|
||||
for key in results['contacted']
|
||||
if results['contacted'][key]['stdout']}
|
||||
if docker_failed:
|
||||
docker_str = " ".join(["Containers failed in %s : %s" % (
|
||||
key, docker_failed[key]) for key in docker_failed])
|
||||
return (404, docker_str, [])
|
||||
else:
|
||||
return (200, "All docker containers are up",
|
||||
['Docker container Test Passed'])
|
||||
|
||||
@base.scenario(admin_only=False, operator=True)
|
||||
def ceph_check(self):
|
||||
self.load()
|
||||
|
Loading…
x
Reference in New Issue
Block a user