kojiwrapper: Ignore warnings before task id
When looking for task ID in output of koji runroot command, do not check just the first line. Instead look for first line that contains just a number. Most of the time, this should really be the first line. But if koji client decides to print any warnings, this patch should skip that. JIRA: RHELCMP-8944 Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
e8d79e9269
commit
80957f5205
2 changed files with 34 additions and 5 deletions
|
|
@ -668,6 +668,30 @@ class RunrootKojiWrapperTest(KojiWrapperBaseTestCase):
|
|||
],
|
||||
)
|
||||
|
||||
@mock.patch("pungi.wrappers.kojiwrapper.run")
|
||||
def test_run_runroot_cmd_with_warnings_before_task_id(self, run):
|
||||
cmd = ["koji", "runroot", "--task-id"]
|
||||
run.return_value = (0, "DeprecatioNWarning: whatever\n1234\n")
|
||||
output = "Output ..."
|
||||
self.koji._wait_for_task = mock.Mock(return_value=(0, output))
|
||||
|
||||
result = self.koji.run_runroot_cmd(cmd)
|
||||
self.assertDictEqual(result, {"retcode": 0, "output": output, "task_id": 1234})
|
||||
self.assertEqual(
|
||||
run.call_args_list,
|
||||
[
|
||||
mock.call(
|
||||
cmd,
|
||||
can_fail=True,
|
||||
env={"FOO": "BAR", "PYTHONUNBUFFERED": "1"},
|
||||
buffer_size=-1,
|
||||
logfile=None,
|
||||
show_cmd=True,
|
||||
universal_newlines=True,
|
||||
)
|
||||
],
|
||||
)
|
||||
|
||||
@mock.patch("shutil.rmtree")
|
||||
@mock.patch("tempfile.mkdtemp")
|
||||
@mock.patch("pungi.wrappers.kojiwrapper.run")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue