Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about intended behavior of attempts in verifySubsystemCount #1005

Open
YoungJin-gurum opened this issue Sep 5, 2022 · 0 comments
Open

Comments

@YoungJin-gurum
Copy link

Bug report

Required Info:

  • Operating System: Ubuntu 20.04
  • Installation type: from source
  • Version or commit hash: rcl 5.4.0
  • DDS implementation: GurumDDS 2.8.3143, rmw_gurumdds__graph_cache
  • Client library (if applicable): rcl

Steps to reproduce issue

colcon test --packages-select rcl --ctest-args -R "test_graph__rmw_gurumdds"

In test_graph__rmw_gurumdds,
test_node_info_subscriptions, test_node_info_publishers, test_node_info_services, test_node_info_clients
sometimes return error 203(RCL_RET_NODE_NAME_NON_EXISTENT)

Expected behavior

As the test specifies attempts as 20, if the result of the function passed to expect_topics_types is not success, it expects to keep trying.

void VerifySubsystemCount(
const expected_node_state && node_state,
const expected_node_state && remote_node_state) const
{
std::vector<rcl_node_t *> node_vec;
node_vec.push_back(this->node_ptr);
node_vec.push_back(this->remote_node_ptr);
size_t attempts = 20;
bool is_expect = false;
rcl_ret_t ret;
for (size_t i = 0; i < attempts; ++i) {
if (attempts - 1 == i) {is_expect = true;}
bool is_success = true;
// verify each node contains the same node graph.
for (auto node : node_vec) {
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Checking subscribers from node");
expect_topics_types(
node, sub_func, node_state.subscribers,

void expect_topics_types(
const rcl_node_t * node,
const GetTopicsFunc & func,
size_t num_topics,
const char * topic_name,
bool expect,
bool & is_success)
{
rcl_ret_t ret;
rcl_names_and_types_t nat{};
nat = rcl_get_zero_initialized_names_and_types();
ret = func(node, topic_name, &nat);
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
rcl_reset_error();
is_success &= num_topics == nat.names.size;

Actual behavior

Sometimes RCL_RET_NODE_NAME_NON_EXISTENT is returned instead of RCL_RET_OK for some reason.
I thought it would try to get a normal result again up to 20 times, but the test fails without more attempts because of ASSERT.

nat = rcl_get_zero_initialized_names_and_types();
ret = func(node, topic_name, &nat);
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;

Additional information

I wonder if it is the intended test logic to try as many attempts only when RCL_RET_OK is the case.
The correct result can be obtained through multiple attempts, but failing to try and failing the test
seems to fade the meaning of introducing the attempts variable.
Please let me know if I'm misunderstood.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant