From 450fee03c4e41e0469ca4a336df9d6e30e90b9db Mon Sep 17 00:00:00 2001 From: Dave Watson Date: Mon, 29 Dec 2014 12:18:39 -0800 Subject: [PATCH] SharedThreadPool unittest Summary: Add a test to check that the accept IOPool can be the same as the IO worker thread pool Test Plan: unittest Reviewed By: jsedgwick@fb.com Subscribers: doug, fugalh, njormrod, folly-diffs@ FB internal diff: D1710628 Signature: t1:1710628:1417469919:6d81a9426b61e9f1b804114f895ed541e547110f --- folly/wangle/bootstrap/BootstrapTest.cpp | 34 ++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/folly/wangle/bootstrap/BootstrapTest.cpp b/folly/wangle/bootstrap/BootstrapTest.cpp index 6b902d20..1efb4e08 100644 --- a/folly/wangle/bootstrap/BootstrapTest.cpp +++ b/folly/wangle/bootstrap/BootstrapTest.cpp @@ -169,3 +169,37 @@ TEST(Bootstrap, ServerAcceptGroup2Test) { CHECK(factory->pipelines == 1); } + +TEST(Bootstrap, SharedThreadPool) { + auto pool = std::make_shared(2); + + TestServer server; + auto factory = std::make_shared(); + server.childPipeline(factory); + server.group(pool, pool); + + server.bind(0); + + SocketAddress address; + server.getSockets()[0]->getAddress(&address); + + TestClient client; + client.connect(address); + + TestClient client2; + client2.connect(address); + + TestClient client3; + client3.connect(address); + + TestClient client4; + client4.connect(address); + + TestClient client5; + client5.connect(address); + + EventBaseManager::get()->getEventBase()->loop(); + + server.stop(); + CHECK(factory->pipelines == 5); +} -- 2.34.1