Skip to content

Commit 12fca62

Browse files
weigondahlerlend
authored andcommitted
Bug#35474089 RouterRoutingTest.ConnectTimeoutShutdownEarlyXProtocol fails
routertest_component_routing fails if DNS is slow to resolve with: router/tests/component/test_routing.cc:396: Failure Value of: res.error() Expected: (is equal to 2006) or (is equal to 2002) Actual: 2026 (of type int) router/tests/component/test_routing.cc:398: Failure Value of: res.what() Expected: (has substring "MySQL server has gone away") or (has substring "Connection refused connecting to") Actual: 0x7f389c01e210 pointing to "connecting to backend failed" (of type char const*) The test waits 200ms for resolve() + connect(), but resolve() sometimes takes longer to resolve the domain. Change ------ - increase the sleep time of the test before expecting the connect() to be blocked. Change-Id: Iaaa93111dbae265a86aac269922fa74a815a80f0
1 parent 66db42e commit 12fca62

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

router/tests/component/test_routing.cc

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,10 +402,16 @@ TEST_F(RouterRoutingTest, ConnectTimeoutShutdownEarlyXProtocol) {
402402
});
403403

404404
const auto start = clock_type::now();
405-
// give the connect thread chance to initiate the connection, even if it
406-
// sometimes does not it should be fine, we just test a different scenario
407-
// then
408-
std::this_thread::sleep_for(200ms);
405+
406+
// give the connect thread enough time to:
407+
//
408+
// - resolve example.org (may take ~200ms)
409+
// - start a connect() to its IP
410+
//
411+
// there is no better way to ensure that the connect() has been started
412+
// and is still blocked other then waiting.
413+
414+
std::this_thread::sleep_for(500ms);
409415
// now force shutdown the router
410416
const auto kill_res = router.kill();
411417
EXPECT_EQ(0, kill_res);

0 commit comments

Comments
 (0)