示例#1
0
    def stop(self, unexpected_messages=None):
        if self.__process:
            saved_pid = self.__process.pid
            # effective stop
            result = self.__syslog_ng_ctl.stop()

            # wait for stop and check stop result
            if result["exit_code"] != 0:
                self.__error_handling()
            if not wait_until_false(self.is_process_running):
                self.__error_handling()
                raise Exception("syslog-ng did not stop")
            if not self.__console_log_reader.wait_for_stop_message():
                self.__error_handling()
                raise Exception("Stop message not arrived")
            self.__console_log_reader.check_for_unexpected_messages(
                unexpected_messages)
            if self.__external_tool == "valgrind":
                self.__console_log_reader.handle_valgrind_log(
                    self.__instance_paths.get_external_tool_output_path(
                        self.__external_tool))
            self.__process = None
            logger.info(
                "syslog-ng process has been stopped with PID: {}\n".format(
                    saved_pid))
示例#2
0
    def stop(self, unexpected_messages=None):
        if self.__process:
            saved_pid = self.__process.pid
            # effective stop
            result = self.__syslog_ng_ctl.stop()

            # wait for stop and check stop result
            if result["exit_code"] != 0:
                self.__error_handling()
            if not wait_until_false(self.is_process_running):
                self.__error_handling()
                raise Exception("syslog-ng did not stop")
            if not self.__console_log_reader.wait_for_stop_message():
                self.__error_handling()
                raise Exception("Stop message not arrived")
            self.__console_log_reader.check_for_unexpected_messages(unexpected_messages)
            if self.__valgrind_usage:
                self.__console_log_reader.handle_valgrind_log(self.__instance_paths.get_valgrind_log_path())
            self.__process = None
            logger.info("syslog-ng process has been stopped with PID: {}\n".format(saved_pid))
示例#3
0
    def stop(self, unexpected_messages=None):
        self.__logger.info("Beginning of syslog-ng stop")
        if self.__process:
            # effective stop
            result = self.__syslog_ng_ctl.stop()

            # wait for stop and check stop result
            if result["exit_code"] != 0:
                self.__error_handling()
            if not wait_until_false(self.__is_process_running):
                self.__error_handling()
                raise Exception("syslog-ng did not stop")
            if not self.__console_log_reader.wait_for_stop_message():
                self.__error_handling()
                raise Exception("Stop message not arrived")
            self.__console_log_reader.check_for_unexpected_messages(
                unexpected_messages)
            if self.__valgrind_usage:
                self.__console_log_reader.handle_valgrind_log(
                    self.__instance_paths.get_valgrind_log_path())
            self.__process = None
            self.__logger.info("End of syslog-ng stop")
示例#4
0
 def wait_for_control_socket_stopped(self):
     return wait_until_false(self.__is_control_socket_alive)
示例#5
0
def test_wait_until_false_inner_function_returns_false():
    assert wait_until_false(inner_function_return_false)