From f42eee12e9b9cf523967e2ae066bcf8559bc27b2 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Wed, 10 Jan 2024 15:35:52 +0200 Subject: [PATCH] refactor: return stderr from NativeCI.run Signed-off-by: Lars Wirzenius --- test-suite | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/test-suite b/test-suite index 4d133c1..11bd819 100755 --- a/test-suite +++ b/test-suite @@ -76,10 +76,10 @@ class Suite: def _run_ci(self, ci, rid, commit): trigger = Trigger(rid, commit) - exit, resps = ci.run(trigger) + exit, resps, stderr = ci.run(trigger) debug(f"exit: {exit}") debug(f"responses: {resps}") - return exit, resps + return exit, resps, stderr def _test_case(self, repo_name, shell): rid, commit = self._setup(repo_name, shell) @@ -87,7 +87,7 @@ class Suite: return self._run_ci(ci, rid, commit) def test_happy_path(self): - exit, resps = self._test_case("happy-path", "echo hello, world") + exit, resps, stderr = self._test_case("happy-path", "echo hello, world") assert exit == 0 assert len(resps) == 2 self.assert_triggered(resps[0]) @@ -107,7 +107,7 @@ class Suite: trigger = Trigger(rid, commit) ci = NativeCI(self.rad, self.config) ci.without_config() - exit, resps = ci.run(trigger) + exit, resps, stderr = ci.run(trigger) debug(f"exit: {exit}") debug(f"responses: {resps}") assert exit != 0 @@ -115,7 +115,7 @@ class Suite: # FIXME: check stderr that env var RADICLE_NATIVE_CI is mentioned def test_command_fails(self): - exit, resps = self._test_case("cmd-fails", "false") + exit, resps, stderr = self._test_case("cmd-fails", "false") assert exit != 0 assert len(resps) == 2 self.assert_triggered(resps[0]) @@ -126,7 +126,7 @@ class Suite: commit = "8d947e182b096ec009e1c9eda9e6a67f5eef83d9" ci = self._ci() - exit, resps = self._run_ci(ci, rid, commit) + exit, resps, stderr = self._run_ci(ci, rid, commit) assert exit != 0 assert len(resps) == 2 @@ -137,7 +137,7 @@ class Suite: assert "clone" in error def test_native_yaml_has_no_shell(self): - exit, resps = self._test_case("no-shell", None) + exit, resps, stderr = self._test_case("no-shell", None) assert exit != 0 assert len(resps) == 1 self.assert_triggered(resps[0]) @@ -145,7 +145,7 @@ class Suite: # missing def test_native_yaml_shell_is_not_string(self): - exit, resps = self._test_case("shell-not-string", {"foo": "bar"}) + exit, resps, stderr = self._test_case("shell-not-string", {"foo": "bar"}) assert exit != 0 assert len(resps) == 1 self.assert_triggered(resps[0]) @@ -314,9 +314,8 @@ class NativeCI: env=dict(self.env), may_fail=True, ) - return p.returncode, [ - json.loads(line.strip()) for line in p.stdout.splitlines() - ] + resps = [json.loads(line.strip()) for line in p.stdout.splitlines()] + return p.returncode, resps, p.stderr def debug(msg):