diff --git a/tests/test_mediaworker.py b/tests/test_mediaworker.py index 1cd97df7340ca98f20ba95dde084bc8719066c26..8e489986532b6e132bc82c95d0ac35ff471ca116 100755 --- a/tests/test_mediaworker.py +++ b/tests/test_mediaworker.py @@ -22,7 +22,7 @@ es_utils = imp.load_source('es_utils', '../utils.py') conf = es_utils.load_conf() def check_ssh(ip): - cmd = '/usr/bin/ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no %s ls /tmp' % ip + cmd = 'ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no %s ls /tmp' % ip print('Connecting: %s' % cmd) try: subprocess.check_output(cmd, shell=True, timeout=2) @@ -32,11 +32,21 @@ def check_ssh(ip): return False return True +def check_apt(ip): + cmd = 'ssh %s apt-get update' % ip + try: + subprocess.check_output(cmd, shell=True, timeout=10) + print('%sapt-get update success on MediaWorker%s' % (GREEN, DEF)) + except subprocess.CalledProcessError: + print('%apt-get update failed on MediaWorker%s' % (RED, DEF)) + return False + all_ok = True worker_ip = conf.get('CELERITY_WORKER_IP') if worker_ip != '127.0.1.1': if not check_ssh(worker_ip): all_ok = False - + if not check_apt(worker_ip): + all_ok = False sys.exit(int(not all_ok))