Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

fix: wrong toggling of autopush_rs's json_logging #1174

Merged
merged 1 commit into from
Apr 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions autopush/tests/test_log_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,8 @@ def test_get_crit(self):
assert payload.get('error') == "Test Failure"

self.flushLoggedErrors()

@inlineCallbacks
def test_invalid(self):
resp = yield self.client.get('/v1/err/bogus')
assert resp.get_status() == 404
1 change: 1 addition & 0 deletions autopush/tests/test_rs_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,7 @@ def setUp(self):
mock_server_thread = Thread(target=mock_server.serve_forever)
mock_server_thread.setDaemon(True)
mock_server_thread.start()
self.addCleanup(mock_server.shutdown)
self.mock_server_thread = mock_server_thread
self.mock_megaphone = MockMegaphoneRequestHandler

Expand Down
4 changes: 3 additions & 1 deletion autopush/web/log_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def get(self, err_type=None):
client_info=self._client_info)
self._write_response(418, 999, message="ERROR:Success",
error="Test Error")
if 'crit' in err_type:
elif 'crit' in err_type:
try:
raise LogCheckError("LogCheck")
except LogCheckError:
Expand All @@ -47,3 +47,5 @@ def get(self, err_type=None):
client_info=self._client_info)
self._write_response(418, 999, message="FAILURE:Success",
error="Test Failure")
else:
self._write_response(404, 0)
2 changes: 1 addition & 1 deletion autopush_rs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__(self, conf, queue):
cfg.ssl_cert = ffi_from_buffer(conf.ssl.cert)
cfg.ssl_dh_param = ffi_from_buffer(conf.ssl.dh_param)
cfg.ssl_key = ffi_from_buffer(conf.ssl.key)
cfg.json_logging = conf.human_logs
cfg.json_logging = not conf.human_logs
cfg.statsd_host = ffi_from_buffer(conf.statsd_host)
cfg.statsd_port = conf.statsd_port
cfg.megaphone_api_url = ffi_from_buffer(conf.megaphone_api_url)
Expand Down