test: Add a decode() to check_output for slow queries. (#4589)

In Python3, the output of subprocess.check_output is of type bytes.
That means calling print() on the output will print \n instead of an
actual newline. This PR adds decoding to the output of mysql in the slow
query test, bringing it into line with other check_output calls.

This also removes a redundant "def run" that is shadowed by the
definition in helpers.py (and was also missing a decode() call).
This commit is contained in:
Jacob Hoffman-Andrews 2019-12-03 06:10:05 -08:00 committed by Daniel McCarney
parent fc15f2f4cd
commit e29830ac33
2 changed files with 1 additions and 4 deletions

View File

@ -339,7 +339,7 @@ def check_slow_queries():
"""
output = subprocess.check_output(
["mysql", "-h", "boulder-mysql", "-e", query],
stderr=subprocess.STDOUT)
stderr=subprocess.STDOUT).decode()
if len(output) > 0:
print(output)
raise Exception("Found slow queries in the slow query log")

View File

@ -1285,6 +1285,3 @@ def test_blocked_key_cert():
if testPass is False:
raise(Exception("expected cert creation to fail with Error when using blocked key"))
def run(cmd, **kwargs):
return subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, **kwargs)