Commit e0ee5993 authored by Rafael Monnerat's avatar Rafael Monnerat

resiliencytest: Truncate the portion of log that goes into erp5.

  The full log is available on suite.log at the erp5testnode anyway.
parent 342fd9d7
......@@ -268,7 +268,20 @@ def runUnitTest():
error_count = 1
test_duration = time.time() - start_time
test_line.stop(stdout=open(fname).read(),
max_size = 4096
fsize = os.stat(fname).st_size
with open(fname) as f:
if fsize <= max_size:
stdout = f.read()
else:
# Read only 2048 bytes from the file. The whole
# file will be available on the server.
stdout = f.read(2048)
stdout += "\n[...] File truncated\n"
f.seek(-2048, os.SEEK_END)
  • There are errors io.UnsupportedOperation: can't do nonzero end-relative seeks in test result.

    From python 3 documentation: in text files (those opened without a b in the mode string), only seeks relative to the beginning of the file are allowed.

    A easy, and probably enough, fix could be to open the file with the mode 'rb'

  • Yes, this sounds like the good fix

  • don't forget to also change this not to mix bytes and str

            stdout += b"\n[...] File truncated\n"
Please register or sign in to reply
stdout += f.read()
test_line.stop(stdout=stdout,
test_count=1,
error_count=error_count,
duration=test_duration)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment