Skip to content

Commit

Permalink
Shorten wait time for a subscription not being ready. (#1092)
Browse files Browse the repository at this point in the history
We shouldn't wait around for 10 seconds for a subscription
to not be ready; that can take literally forever.  Instead,
just wait one second.  While we are in here, also make
the case where we *are* waiting for a subscription to be
ready more reactive by reducing the wait time to 100ms,
with more tries.

Signed-off-by: Chris Lalancette <[email protected]>
  • Loading branch information
clalancette committed Aug 22, 2023
1 parent b23586f commit 6baa271
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions rcl/test/rcl/test_subscription.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -984,9 +984,9 @@ TEST_F(
}

if (is_cft_support) {
ASSERT_FALSE(wait_for_subscription_to_be_ready(&subscription, context_ptr, 10, 1000));
ASSERT_FALSE(wait_for_subscription_to_be_ready(&subscription, context_ptr, 10, 100));
} else {
ASSERT_TRUE(wait_for_subscription_to_be_ready(&subscription, context_ptr, 10, 1000));
ASSERT_TRUE(wait_for_subscription_to_be_ready(&subscription, context_ptr, 100, 100));

test_msgs__msg__Strings msg;
test_msgs__msg__Strings__init(&msg);
Expand All @@ -1011,7 +1011,7 @@ TEST_F(
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
}

ASSERT_TRUE(wait_for_subscription_to_be_ready(&subscription, context_ptr, 10, 1000));
ASSERT_TRUE(wait_for_subscription_to_be_ready(&subscription, context_ptr, 100, 100));

{
test_msgs__msg__Strings msg;
Expand Down Expand Up @@ -1072,9 +1072,9 @@ TEST_F(
}

if (is_cft_support) {
ASSERT_FALSE(wait_for_subscription_to_be_ready(&subscription, context_ptr, 10, 1000));
ASSERT_FALSE(wait_for_subscription_to_be_ready(&subscription, context_ptr, 10, 100));
} else {
ASSERT_TRUE(wait_for_subscription_to_be_ready(&subscription, context_ptr, 10, 1000));
ASSERT_TRUE(wait_for_subscription_to_be_ready(&subscription, context_ptr, 100, 100));

test_msgs__msg__Strings msg;
test_msgs__msg__Strings__init(&msg);
Expand All @@ -1099,7 +1099,7 @@ TEST_F(
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
}

ASSERT_TRUE(wait_for_subscription_to_be_ready(&subscription, context_ptr, 10, 1000));
ASSERT_TRUE(wait_for_subscription_to_be_ready(&subscription, context_ptr, 100, 100));

{
test_msgs__msg__Strings msg;
Expand Down Expand Up @@ -1189,7 +1189,7 @@ TEST_F(
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
}

ASSERT_TRUE(wait_for_subscription_to_be_ready(&subscription, context_ptr, 10, 1000));
ASSERT_TRUE(wait_for_subscription_to_be_ready(&subscription, context_ptr, 100, 100));

{
test_msgs__msg__Strings msg;
Expand Down Expand Up @@ -1261,7 +1261,7 @@ TEST_F(
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
}

ASSERT_TRUE(wait_for_subscription_to_be_ready(&subscription, context_ptr, 10, 1000));
ASSERT_TRUE(wait_for_subscription_to_be_ready(&subscription, context_ptr, 100, 100));

{
test_msgs__msg__BasicTypes msg;
Expand Down Expand Up @@ -1323,9 +1323,9 @@ TEST_F(
}

if (is_cft_support) {
ASSERT_FALSE(wait_for_subscription_to_be_ready(&subscription, context_ptr, 10, 1000));
ASSERT_FALSE(wait_for_subscription_to_be_ready(&subscription, context_ptr, 10, 100));
} else {
ASSERT_TRUE(wait_for_subscription_to_be_ready(&subscription, context_ptr, 10, 1000));
ASSERT_TRUE(wait_for_subscription_to_be_ready(&subscription, context_ptr, 100, 100));

test_msgs__msg__BasicTypes msg;
test_msgs__msg__BasicTypes__init(&msg);
Expand All @@ -1349,7 +1349,7 @@ TEST_F(
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
}

ASSERT_TRUE(wait_for_subscription_to_be_ready(&subscription, context_ptr, 10, 1000));
ASSERT_TRUE(wait_for_subscription_to_be_ready(&subscription, context_ptr, 100, 100));

{
test_msgs__msg__BasicTypes msg;
Expand Down

0 comments on commit 6baa271

Please sign in to comment.