Skip to content

Commit 2f157db

Browse files
authored
Make test_executor.spin_some_max_duration more reliable (#430)
Signed-off-by: Ivan Santiago Paunovic <[email protected]>
1 parent 4d89cc4 commit 2f157db

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

test_rclcpp/test/test_executor.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,23 +61,23 @@ TEST(CLASSNAME(test_executor, RMW_IMPLEMENTATION), spin_some_max_duration) {
6161
rclcpp::executors::SingleThreadedExecutor executor;
6262
auto node = rclcpp::Node::make_shared("spin_some_max_duration");
6363
auto lambda = []() {
64-
std::this_thread::sleep_for(1ms);
64+
std::this_thread::sleep_for(100ms);
6565
};
6666
std::vector<std::shared_ptr<rclcpp::WallTimer<decltype(lambda)>>> timers;
67-
// creating 20 timers which will try to do 1 ms of work each
68-
// only about 10ms worth of them should actually be performed
67+
// creating 20 timers which will try to do 100 ms of work each
68+
// only about 1s worth of them should actually be performed
6969
for (int i = 0; i < 20; i++) {
7070
auto timer = node->create_wall_timer(0s, lambda);
7171
timers.push_back(timer);
7272
}
7373
executor.add_node(node);
7474

75-
const auto max_duration = 10ms;
75+
const auto max_duration = 1s;
7676
const auto start = std::chrono::steady_clock::now();
7777
executor.spin_some(max_duration);
7878
const auto end = std::chrono::steady_clock::now();
7979
ASSERT_LT(max_duration, end - start);
80-
ASSERT_GT(max_duration + 5ms, end - start);
80+
ASSERT_GT(max_duration + 500ms, end - start);
8181
}
8282

8383
TEST(CLASSNAME(test_executor, RMW_IMPLEMENTATION), multithreaded_spin_call) {

0 commit comments

Comments
 (0)