Browse Source

Conditionally skip test that fails because of openssl

Ubuntu 22.04 comes with OpenSSL 3, and the specific version that PHP is
built against has a bug which has since been fixed but isn't showing up
in the images that GitHub has available.

See https://github.com/openssl/openssl/issues/18574
and https://github.com/php/php-src/issues/8369
Mark Story 3 years ago
parent
commit
b98a0dc068
1 changed files with 11 additions and 4 deletions
  1. 11 4
      tests/TestCase/Http/Client/Auth/OauthTest.php

+ 11 - 4
tests/TestCase/Http/Client/Auth/OauthTest.php

@@ -375,10 +375,17 @@ class OauthTest extends TestCase
             'privateKey' => $privateKey,
         ];
         $auth = new Oauth();
-        $request = $auth->authentication($request, $options);
-
-        $result = $request->getHeaderLine('Authorization');
-        $this->assertSignatureFormat($result);
+        try {
+            $request = $auth->authentication($request, $options);
+            $result = $request->getHeaderLine('Authorization');
+            $this->assertSignatureFormat($result);
+        } catch (RuntimeException $e) {
+            // Handle 22.04 + OpenSSL bug. This should be safe to remove in the future.
+            if (strpos($e->getMessage(), 'unexpected eof while reading') !== false) {
+                $this->markTestSkipped('Skipping because of OpenSSL bug.');
+            }
+            throw $e;
+        }
     }
 
     public function testRsaSigningInvalidKey(): void