MCPcopy Create free account
hub / github.com/apache/thrift / BOOST_AUTO_TEST_CASE

Function BOOST_AUTO_TEST_CASE

lib/cpp/test/TServerIntegrationTest.cpp:434–459  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

432 TServerIntegrationProcessorTestFixture<TThreadedServer>)
433
434BOOST_AUTO_TEST_CASE(test_stop_with_interruptable_clients_connected) {
435 // This tests THRIFT-2441 new behavior: stopping the server disconnects clients
436 BOOST_TEST_MESSAGE("Testing stop with interruptable clients");
437
438 startServer();
439
440 shared_ptr<TSocket> pClientSock1(new TSocket("localhost", getServerPort()),
441 autoSocketCloser);
442 pClientSock1->open();
443
444 shared_ptr<TSocket> pClientSock2(new TSocket("localhost", getServerPort()),
445 autoSocketCloser);
446 pClientSock2->open();
447
448 // Ensure they have been accepted
449 blockUntilAccepted(2);
450
451 // The test fixture destructor will force the sockets to disconnect
452 // Prior to THRIFT-2441, pServer->stop() would hang until clients disconnected
453 stopServer();
454
455 // extra proof the server end disconnected the clients
456 uint8_t buf[1];
457 BOOST_CHECK_EQUAL(0, pClientSock1->read(&buf[0], 1)); // 0 = disconnected
458 BOOST_CHECK_EQUAL(0, pClientSock2->read(&buf[0], 1)); // 0 = disconnected
459}
460
461BOOST_AUTO_TEST_CASE(test_stop_with_uninterruptable_clients_connected) {
462 // This tests pre-THRIFT-2441 behavior: stopping the server blocks until clients

Callers

nothing calls this directly

Calls 10

readMethod · 0.65
bindFunction · 0.50
openMethod · 0.45
getServerTransportMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected