Unverified Commit c027c2d9 authored by mvdbeek's avatar mvdbeek
Browse files

Log failure reason

parent 4d568234
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -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