def test_envs_with_rate_limit(self, TsuruLogWriter, gethostname): TsuruLogWriter.return_value = mock.Mock() gethostname.return_value = "myhost" stream = Stream(watcher_name="watcher", envs={ "LOG_RATE_LIMIT_WINDOW": "60", "LOG_RATE_LIMIT_COUNT": "1000", }) TsuruLogWriter.assert_called_with(mock.ANY, stream.queue, "60", "1000")
def test_envs_with_rate_limit(self, TsuruLogWriter, gethostname): TsuruLogWriter.return_value = mock.Mock() gethostname.return_value = "myhost" stream = Stream(watcher_name="watcher", envs={ "LOG_RATE_LIMIT_WINDOW": "60", "LOG_RATE_LIMIT_COUNT": "1000", }) TsuruLogWriter.assert_called_with(mock.ANY, stream.queue, "60", "1000", 'host2', '514', 'LOCAL0', 'udp', 'appname1')
def setUp(self, TsuruLogWriter, gethostname): TsuruLogWriter.return_value = log_writer = mock.Mock() gethostname.return_value = "myhost" l_out = "2012-11-06 17:13:55 [12019] [INFO] Starting gunicorn 0.15.0\n" l_err = "2012-11-06 17:13:55 [12019] [ERROR] Error starting gunicorn\n" self.data = {} self.data["stderr"] = {"pid": 12018, "data": l_err, "name": "stderr"} self.data["stdout"] = {"pid": 12018, "data": l_out, "name": "stdout"} self.stream = Stream(watcher_name="mywatcher") TsuruLogWriter.assert_called_with(mock.ANY, self.stream.queue, None, None, 'host2', '514', 'LOCAL0', 'udp', 'appname1') log_writer.start.assert_called_once()
def setUp(self, TsuruLogWriter, gethostname): TsuruLogWriter.return_value = log_writer = mock.Mock() gethostname.return_value = "myhost" l_out = "2012-11-06 17:13:55 [12019] [INFO] Starting gunicorn 0.15.0\n" l_err = "2012-11-06 17:13:55 [12019] [ERROR] Error starting gunicorn\n" self.data = {} self.data["stderr"] = { "pid": 12018, "data": l_err, "name": "stderr" } self.data["stdout"] = { "pid": 12018, "data": l_out, "name": "stdout" } self.stream = Stream(watcher_name="mywatcher") TsuruLogWriter.assert_called_with(mock.ANY, self.stream.queue, None, None) log_writer.start.assert_called_once()