From 5c3fe8da13c49adc2138ab261146b282aa6d187f Mon Sep 17 00:00:00 2001 From: Michael van der Westhuizen Date: Mon, 6 Nov 2023 02:24:49 -0800 Subject: [PATCH] Make folly/io/async/test work on remote execution Summary: Similarly to other SSL code in Folly, the io/async tests don't currently use test resources and therefore fail when executed using remote execution. Reviewed By: yfeldblum Differential Revision: D50794572 fbshipit-source-id: f0220af213dcb72fe13079c6ffc8cdade8ecf3e7 --- wangle/acceptor/test/AcceptorTest.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/wangle/acceptor/test/AcceptorTest.cpp b/wangle/acceptor/test/AcceptorTest.cpp index 94c299e0d..d68caef70 100644 --- a/wangle/acceptor/test/AcceptorTest.cpp +++ b/wangle/acceptor/test/AcceptorTest.cpp @@ -14,6 +14,7 @@ * limitations under the License. */ +#include #include #include #include @@ -25,6 +26,7 @@ using namespace folly; using namespace wangle; using namespace testing; +using folly::test::find_resource; class TestConnection : public wangle::ManagedConnection { public: @@ -119,11 +121,13 @@ class AcceptorTest : public ::testing::TestWithParam { TestSSLConfig testConfig = GetParam(); if (testConfig == TestSSLConfig::SSL) { sslContext->loadCertKeyPairFromFiles( - folly::test::kTestCert, folly::test::kTestKey); + find_resource(folly::test::kTestCert).c_str(), + find_resource(folly::test::kTestKey).c_str()); } else if (testConfig == TestSSLConfig::SSL_MULTI_CA) { // Use a different cert. sslContext->loadCertKeyPairFromFiles( - folly::test::kClientTestCert, folly::test::kClientTestKey); + find_resource(folly::test::kClientTestCert).c_str(), + find_resource(folly::test::kClientTestKey).c_str()); } sslContext->setOptions(SSL_OP_NO_TICKET); sslContext->ciphers("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"); @@ -134,12 +138,15 @@ class AcceptorTest : public ::testing::TestWithParam { wangle::SSLContextConfig sslCtxConfig; TestSSLConfig testConfig = GetParam(); sslCtxConfig.setCertificate( - folly::test::kTestCert, folly::test::kTestKey, ""); + find_resource(folly::test::kTestCert).string(), + find_resource(folly::test::kTestKey).string(), + ""); if (testConfig == TestSSLConfig::SSL_MULTI_CA) { sslCtxConfig.clientCAFiles = std::vector{ - folly::test::kTestCA, folly::test::kClientTestCA}; + find_resource(folly::test::kTestCA).string(), + find_resource(folly::test::kClientTestCA).string()}; } else { - sslCtxConfig.clientCAFile = folly::test::kTestCA; + sslCtxConfig.clientCAFile = find_resource(folly::test::kTestCA).string(); } sslCtxConfig.sessionContext = "AcceptorTest"; sslCtxConfig.isDefault = true;