Log failure reason

This commit is contained in:
mvdbeek
2022-06-18 14:49:43 +02:00
parent 4d568234a4
commit c027c2d98d
+8 -1
View File
@@ -4,6 +4,7 @@
import collections
import json
import os
import shlex
import string
import subprocess
import tempfile
@@ -323,7 +324,13 @@ class BaseKubernetesIntegrationTestCase(BaseJobEnvironmentIntegrationTestCase, M
self._wait_for_external_state(sa_session=sa_session, job=job, expected=app.model.Job.states.RUNNING)
external_id = job.job_runner_external_id
output = unicodify(subprocess.check_output(["kubectl", "logs", "-l", f"job-name={external_id}"]))
log_cmd = ["kubectl", "logs", "-l", f"job-name={external_id}"]
p = subprocess.run(log_cmd)
if p.returncode:
raise Exception(
f"Command '{shlex.join(log_cmd)}' failed with exit code: {p.returncode}.\nstdout: {p.stdout}\nstderr: {p.stderr}"
)
output = p.stdout
EXPECTED_STDOUT = "The bool is not true"
EXPECTED_STDERR = "The bool is very not true"
assert EXPECTED_STDOUT in output