def system_services_check_test(): """ Verify some system services """ services_to_commands = { "nginx": """ps -efx|grep nginx|grep -v grep""", "rabbitmq-server": """ps -ef|grep rabbitmq-|grep -v grep""", "memcached": """ps -ef|grep memcached|grep -v grep""", } errors = '' services_checked = 'Following services found running:\n' grid_ip = General.get_config().get('main', 'grid_ip') ssh_pass = General.get_config().get('mgmtcenter', 'password') client = SSHClient(grid_ip, username='******', password=ssh_pass) for service_to_check in services_to_commands.iterkeys(): out, err = client.run(services_to_commands[service_to_check], debug=True, allow_insecure=True, return_stderr=True) if len(err): errors += "Error when trying to run {0}:\n{1}".format(services_to_commands[service_to_check], err) else: if len(out): services_checked += "{0}\n".format(service_to_check) else: errors += "Couldn't find {0} running process\n".format(service_to_check) for non_running_service in GeneralSystem.list_non_running_ovs_services(grid_ip): errors += str(non_running_service) assert len(errors) == 0,\ "Found the following errors while checking for the system services:{0}\n".format(errors)
def services_check_test(): """ Verify some services """ env_ips = GeneralStorageRouter.get_all_ips() non_running_services = [] for env_ip in env_ips: non_running_services = GeneralSystem.list_non_running_ovs_services(env_ip) if len(non_running_services): non_running_services.append([env_ip, non_running_services]) assert len(non_running_services) == 0, "Found non running services on {0}".format(non_running_services)