diff mbox series

tests/fetch: report OpenSSL certificate generation errors

Message ID DM6PR11MB3962E55724AA2F8BCE00B58FCBDA2@DM6PR11MB3962.namprd11.prod.outlook.com
State New
Headers show
Series tests/fetch: report OpenSSL certificate generation errors | expand

Commit Message

Fredrik Svensson (svsvenss) Aug. 14, 2026, 8:18 p.m. UTC
The HTTPS connection cache test suppresses all output from the OpenSSL
certificate-generation command. When the command fails, the test reports
only its exit status and hides the information needed to diagnose
worker-specific failures.

Capture combined stdout and stderr and include it in the assertion failure.

Signed-off-by: Fredrik Svensson <svsvenss@cisco.com>
---
 lib/bb/tests/fetch.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py
index fd064743..a1e4b45f 100644
--- a/lib/bb/tests/fetch.py
+++ b/lib/bb/tests/fetch.py
@@ -1812,11 +1812,13 @@  class FetchCheckStatusTest(FetcherTest):
 
         certificate = os.path.join(self.tempdir, "certificate.pem")
         private_key = os.path.join(self.tempdir, "private-key.pem")
-        subprocess.check_call(
+        result = subprocess.run(
             ["openssl", "req", "-x509", "-newkey", "rsa:2048", "-nodes",
              "-keyout", private_key, "-out", certificate, "-days", "1",
              "-subj", "/CN=127.0.0.1"],
-            stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
+            stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
+        self.assertEqual(result.returncode, 0,
+                         "openssl certificate generation failed:\n%s" % result.stdout)
 
         server = HTTPSServer(("127.0.0.1", 0), HTTPSRequestHandler)
         context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)