Skip to content

Commit

Permalink
Make folly/io/async/test work on remote execution
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Michael van der Westhuizen authored and facebook-github-bot committed Nov 6, 2023
1 parent 10c418e commit 5c3fe8d
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions wangle/acceptor/test/AcceptorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

#include <folly/experimental/TestUtil.h>
#include <folly/io/async/EventBase.h>
#include <folly/io/async/test/AsyncSSLSocketTest.h>
#include <folly/portability/GMock.h>
Expand All @@ -25,6 +26,7 @@
using namespace folly;
using namespace wangle;
using namespace testing;
using folly::test::find_resource;

class TestConnection : public wangle::ManagedConnection {
public:
Expand Down Expand Up @@ -119,11 +121,13 @@ class AcceptorTest : public ::testing::TestWithParam<TestSSLConfig> {
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");
Expand All @@ -134,12 +138,15 @@ class AcceptorTest : public ::testing::TestWithParam<TestSSLConfig> {
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<std::string>{
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;
Expand Down

0 comments on commit 5c3fe8d

Please sign in to comment.