Skip to content

Commit 11b5845

Browse files
authored
Use 10x the intraprocess delay to wait for sent requests. (#148)
Signed-off-by: Michel Hidalgo <[email protected]>
1 parent 01c311e commit 11b5845

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

test_rmw_implementation/test/test_service.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
#include <gtest/gtest.h>
1616

17+
#include <chrono>
18+
1719
#include "osrf_testing_tools_cpp/scope_exit.hpp"
1820

1921
#include "rcutils/allocator.h"
@@ -326,8 +328,11 @@ TEST_F(CLASSNAME(TestService, RMW_IMPLEMENTATION), send_reponse_with_bad_argumen
326328
srv_array.service_count = 1u;
327329
srv_array.services = array;
328330
rmw_time_t timeout;
329-
timeout.sec = 0;
330-
timeout.nsec = rmw_intraprocess_discovery_delay.count() * 1000;
331+
auto rmw_intraprocess_discovery_delay_in_nanoseconds =
332+
std::chrono::duration_cast<std::chrono::nanoseconds>(
333+
rmw_intraprocess_discovery_delay * 10).count();
334+
timeout.sec = rmw_intraprocess_discovery_delay_in_nanoseconds / 1000000000;
335+
timeout.nsec = rmw_intraprocess_discovery_delay_in_nanoseconds % 1000000000;
331336
ret = rmw_wait(nullptr, nullptr, &srv_array, nullptr, nullptr, wait_set, &timeout);
332337
ASSERT_EQ(RMW_RET_OK, ret) << rmw_get_error_string().str;
333338
ASSERT_NE(nullptr, srv_array.services[0]);

0 commit comments

Comments
 (0)