def test_zzzzz_shutdown(self): """test shutdown""" _LOGGER.info("start shutdown") assert not PolicyReceiver.is_running() audit = Audit(job_name="test_zzzzz_shutdown", req_message="start shutdown") PolicyReceiver.run(audit) _LOGGER.info("sleep before send_notification...") time.sleep(2) MockWebSocket.send_notification([1, 3, 5]) _LOGGER.info("sleep after send_notification...") time.sleep(3) result = self.getPage("/healthcheck") _LOGGER.info("healthcheck result: %s", result) WebServer2018Test.do_gc_test = False _LOGGER.info("shutdown...") audit.audit_done("shutdown") result = self.getPage("/shutdown") _LOGGER.info("shutdown result: %s", result) self.assertStatus('200 OK') _LOGGER.info("got shutdown: %s", self.body) time.sleep(1) assert not PolicyReceiver.is_running() Tracker.validate()
def test_zzz_catch_up_on_deploy_handler_changed(self): """test run policy handler with deployment-handler changed underneath""" _LOGGER.info("start zzz_catch_up_on_deploy_handler_changed") assert not PolicyReceiver.is_running() audit = Audit( job_name="test_zzz_catch_up_on_deploy_handler_changed", req_message="start zzz_catch_up_on_deploy_handler_changed") PolicyReceiver.run(audit) _LOGGER.info("sleep before send_notification...") time.sleep(2) MockWebSocket.send_notification([1]) _LOGGER.info("sleep after send_notification...") time.sleep(3) MockSettings.deploy_handler_instance_uuid = str(uuid.uuid4()) _LOGGER.info("new deploy-handler uuid=%s", MockSettings.deploy_handler_instance_uuid) MockWebSocket.send_notification([2, 4]) _LOGGER.info("sleep after send_notification...") time.sleep(3) _LOGGER.info("sleep 3 before shutdown...") time.sleep(3) result = self.getPage("/healthcheck") _LOGGER.info("healthcheck result: %s", result) PolicyReceiver.shutdown(audit) time.sleep(1) assert not PolicyReceiver.is_running() Tracker.validate()
def test_zzz_policy_updates_and_catch_ups(self): """test run policy handler with policy updates and catchups""" _LOGGER.info("start policy_updates_and_catch_ups") assert not PolicyReceiver.is_running() audit = Audit(job_name="test_zzz_policy_updates_and_catch_ups", req_message="start policy_updates_and_catch_ups") PolicyReceiver.run(audit) _LOGGER.info("sleep before send_notification...") time.sleep(2) MockWebSocket.send_notification([1, 3, 5]) _LOGGER.info("sleep after send_notification...") time.sleep(3) _LOGGER.info("sleep 10 before shutdown...") time.sleep(10) result = self.getPage("/healthcheck") _LOGGER.info("healthcheck result: %s", result) PolicyReceiver.shutdown(audit) time.sleep(1) assert not PolicyReceiver.is_running() Tracker.validate()
def test_catch_up_dh_404(): """test run policy handler with catchups and failed deployment-handler""" _LOGGER.info("start test_catch_up_dh_404") assert not PolicyReceiver.is_running() audit = Audit(job_name="test_catch_up_dh_404", req_message="start test_catch_up_dh_404") PolicyReceiver.run(audit) _LOGGER.info("sleep 12 before shutdown...") time.sleep(12) health = audit.health(full=True) audit.audit_done(result=json.dumps(health)) _LOGGER.info("healthcheck: %s", json.dumps(health)) assert bool(health) PolicyReceiver.shutdown(audit) time.sleep(1) assert not PolicyReceiver.is_running() health = audit.health(full=True) _LOGGER.info("healthcheck: %s", json.dumps(health)) Tracker.validate()
def test_zzz_get_catch_up(self): """test /catch_up""" _LOGGER.info("start /catch_up") assert not PolicyReceiver.is_running() audit = Audit(job_name="test_zzz_get_catch_up", req_message="start /catch_up") PolicyReceiver.run(audit) time.sleep(5) result = self.getPage("/catch_up") _LOGGER.info("catch_up result: %s", result) self.assertStatus('200 OK') _LOGGER.info("got catch_up: %s", self.body) _LOGGER.info("sleep 5 before shutdown...") time.sleep(5) result = self.getPage("/healthcheck") _LOGGER.info("healthcheck result: %s", result) PolicyReceiver.shutdown(audit) time.sleep(1) assert not PolicyReceiver.is_running() Tracker.validate()
def test_zzzzz_shutdown(self): """test shutdown""" _LOGGER.info("testing the shutdown") assert not PolicyReceiver.is_running() audit = Audit(job_name="test_zzzzz_shutdown", req_message="testing the shutdown") PolicyReceiver.run(audit) result = self.getPage("/healthcheck") _LOGGER.info("healthcheck result: %s", result) time.sleep(1) WebServerTest.do_gc_test = False _LOGGER.info("shutdown...") audit.audit_done("shutdown") result = self.getPage("/shutdown") _LOGGER.info("shutdown result: %s", result) self.assertStatus('200 OK') _LOGGER.info("got shutdown: %s", self.body) time.sleep(5) assert not PolicyReceiver.is_running() Tracker.validate()