Skip to content

Test of node->now() flaky on OS X #457

@dhood

Description

@dhood

This test is flaky:

TEST_F(TestNode, now) {
  auto node = std::make_shared<rclcpp::Node>("my_node", "/ns");
  auto clock = node->get_clock();
  auto now_builtin = node->now().nanoseconds();
  auto now_external = clock->now().nanoseconds();
  EXPECT_GE(now_external, now_builtin);
  EXPECT_LT(now_external - now_builtin, 50000L);
}

The failures that I've seen are always on OS X, at the last line.

Here are some examples:
https://ci.ros2.org/view/nightly/job/nightly_osx_repeated/1039/testReport/junit/rclcpp/TestNode/now/ (mini1)
https://ci.ros2.org/view/nightly/job/nightly_osx_repeated/1046/testReport/junit/rclcpp/TestNode/now/ (mini2)
https://ci.ros2.org/view/nightly/job/nightly_osx_repeated/1047/testReport/junit/rclcpp/TestNode/now/ (mini3)

The time difference is ~1ms (0.98, 1.33, 1.27, ...) instead of the 0.05ms being compared against.

@tfoote given the implementation details, does anything come to mind about what could cause the >1ms difference? Or could this could be reasonable behaviour?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions