Skip to content

Commit 2b437a4

Browse files
committed
Bug#30322649 routertest_component_rest_routing sporadically fails
Problem ======= routertest_component_rest_routing sporadically fails with: expected_active_connections=0, got 3 as the check in the REST API happens: - after the client-side of the connection is closed - without checking if the server-side of the connection is closed too The test checks the expected value too early, without synchonization. Change ====== - wait 200ms before querying the counters. RB: 23014
1 parent 25c2d3c commit 2b437a4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

router/tests/component/test_rest_routing.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ TEST_P(RestRoutingApiTest, ensure_openapi) {
173173
conf_dir_.name(), mysql_harness::join(config_sections, "\n"),
174174
&default_section)};
175175

176+
SCOPED_TRACE("// starting router");
176177
ProcessWrapper &http_server = launch_router({"-c", conf_file});
177178

178179
// doesn't really matter which file we use here, we are not going to do any
@@ -184,6 +185,7 @@ TEST_P(RestRoutingApiTest, ensure_openapi) {
184185
auto &server_mock =
185186
launch_mysql_server_mock(json_stmts, mock_port_, EXIT_SUCCESS, false);
186187

188+
SCOPED_TRACE("// checking port is ready");
187189
ASSERT_NO_FATAL_FAILURE(check_port_ready(server_mock, mock_port_, 5000ms));
188190
// wait for route being available if we expect it to be and plan to do some
189191
// connections to it (which are routes: "ro" and "Aaz")
@@ -219,6 +221,12 @@ TEST_P(RestRoutingApiTest, ensure_openapi) {
219221
<< http_server.get_full_logfile();
220222
}
221223

224+
// wait a bit until the routing plugin really closed the sockets
225+
//
226+
// the routing plugin has a server-greeting-timeout of 100ms
227+
// add a few more on top for our close-and-forget in wait_for_port_ready()
228+
std::this_thread::sleep_for(200ms);
229+
222230
EXPECT_NO_FATAL_FAILURE(
223231
fetch_and_validate_schema_and_resource(GetParam(), http_server));
224232
}

0 commit comments

Comments
 (0)