From c1791ee90fdd8adf219ae3d2b849f5f041284b7c Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Thu, 17 May 2018 18:38:25 -0600 Subject: [PATCH] mmkubernetes test python must encode response https://github.com/rsyslog/rsyslog/issues/2721 Was not working on python3 - must use `encode()` to convert the string to a `bytes` object. Also run the server with python -u to make sure we get the log output from the kubernetes test server. --- tests/mmkubernetes-basic.sh | 2 +- tests/mmkubernetes_test_server.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/mmkubernetes-basic.sh b/tests/mmkubernetes-basic.sh index 0bbfd08ca..d320c343f 100755 --- a/tests/mmkubernetes-basic.sh +++ b/tests/mmkubernetes-basic.sh @@ -4,7 +4,7 @@ . $srcdir/diag.sh init testsrv=mmk8s-test-server -python ./mmkubernetes_test_server.py 18443 rsyslog${testsrv}.pid rsyslogd${testsrv}.started > mmk8s_srv.log 2>&1 & +python -u ./mmkubernetes_test_server.py 18443 rsyslog${testsrv}.pid rsyslogd${testsrv}.started > mmk8s_srv.log 2>&1 & BGPROCESS=$! . $srcdir/diag.sh wait-startup $testsrv echo background mmkubernetes_test_server.py process id is $BGPROCESS diff --git a/tests/mmkubernetes_test_server.py b/tests/mmkubernetes_test_server.py index 0de215603..24f4e1b0e 100644 --- a/tests/mmkubernetes_test_server.py +++ b/tests/mmkubernetes_test_server.py @@ -104,7 +104,7 @@ def do_GET(self): self.log_error(resp) self.send_response(status) self.end_headers() - self.wfile.write(json.dumps(json.loads(resp), separators=(',',':'))) + self.wfile.write(json.dumps(json.loads(resp), separators=(',',':')).encode()) port = int(sys.argv[1])