Skip to content

Commit c2a519d

Browse files
Fix failing test in rolling
Signed-off-by: Luca Della Vedova <[email protected]>
1 parent 6246ac6 commit c2a519d

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

rmf_task_ros2/test/bidding/test_SelfBid.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,24 +90,24 @@ SCENARIO("Auction with 2 Bids", "[TwoBids]")
9090
exec_options.context = rcl_context;
9191
rclcpp::executors::SingleThreadedExecutor executor(exec_options);
9292
executor.add_node(node);
93+
const auto now = std::chrono::steady_clock::now();
9394

9495
auto bidder1 = AsyncBidder::make(
9596
node,
96-
[&test_notice_bidder1](const auto& notice, auto respond)
97+
[&test_notice_bidder1, &now](const auto& notice, auto respond)
9798
{
9899
Response::Proposal best_robot_estimate;
99100
test_notice_bidder1 = notice.request;
100101
best_robot_estimate.fleet_name = "bidder1";
101-
best_robot_estimate.finish_time =
102-
std::chrono::steady_clock::time_point::max();
102+
best_robot_estimate.finish_time = now + std::chrono::seconds(1000);
103103

104104
respond(Response{best_robot_estimate, {}});
105105
}
106106
);
107107

108108
auto bidder2 = AsyncBidder::make(
109109
node,
110-
[&test_notice_bidder2](const auto& notice, auto respond)
110+
[&test_notice_bidder2, &now](const auto& notice, auto respond)
111111
{
112112
auto request = nlohmann::json::parse(notice.request);
113113
if (request["category"] == "patrol")
@@ -117,8 +117,7 @@ SCENARIO("Auction with 2 Bids", "[TwoBids]")
117117
Response::Proposal best_robot_estimate;
118118
best_robot_estimate.new_cost = 2.3; // lower cost than bidder1
119119
best_robot_estimate.fleet_name = "bidder2";
120-
best_robot_estimate.finish_time =
121-
std::chrono::steady_clock::time_point::min();
120+
best_robot_estimate.finish_time = now + std::chrono::seconds(1);
122121
test_notice_bidder2 = notice.request;
123122

124123
respond(Response{best_robot_estimate, {}});

0 commit comments

Comments
 (0)