def test_process_state_sysmq_down(self): ''' testing Down for rabbitmq ''' appmon = AppMonitor() proc_mgr = "systemd" service_name = "rabbitmq-server" service_state_out = "ActiveState=failed" host_name = socket.getfqdn() expected_status = { "service_name": service_name, "service_status": "DOWN", "host_name": host_name } actual_status = appmon.process_state(proc_mgr, service_name, service_state_out) self.assertEqual(expected_status, actual_status)
def test_process_state_servmq(self): ''' testing Up for rabbitmq ''' appmon = AppMonitor() proc_mgr = "service" service_name = "rabbitmq-server" service_state_out = "pid: 1111; uptime: 192" host_name = socket.getfqdn() expected_status = { "service_name": service_name, "service_status": "UP", "host_name": host_name } actual_status = appmon.process_state(proc_mgr, service_name, service_state_out) self.assertEqual(expected_status, actual_status)