Skip to content

Commit b6305cc

Browse files
ivanpaunojacobperron
authored andcommitted
Fix rcl_action test_graph (#504)
Signed-off-by: ivanpauno <[email protected]>
1 parent b05fd81 commit b6305cc

File tree

1 file changed

+13
-21
lines changed

1 file changed

+13
-21
lines changed

rcl_action/test/rcl_action/test_graph.cpp

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@
3636
# define CLASSNAME(NAME, SUFFIX) NAME
3737
#endif
3838

39-
const bool is_opensplice =
40-
std::string(rmw_get_implementation_identifier()).find("rmw_opensplice") == 0;
41-
4239
class CLASSNAME (TestActionGraphFixture, RMW_IMPLEMENTATION) : public ::testing::Test
4340
{
4441
public:
@@ -51,6 +48,7 @@ class CLASSNAME (TestActionGraphFixture, RMW_IMPLEMENTATION) : public ::testing:
5148
rcl_node_t zero_node;
5249
const char * test_graph_node_name = "test_action_graph_node";
5350
const char * test_graph_old_node_name = "test_action_graph_old_node_name";
51+
const char * test_graph_unknown_node_name = "test_action_graph_unknown_node_name";
5452

5553
void SetUp()
5654
{
@@ -132,17 +130,14 @@ TEST_F(
132130
rcl_reset_error();
133131
// Invalid node name
134132
ret = rcl_action_get_client_names_and_types_by_node(
135-
&this->node, &this->allocator, "_test_this_Isnot_a_valid_name", "", &nat);
136-
EXPECT_EQ(RCL_RET_ERROR, ret) << rcl_get_error_string().str;
133+
&this->node, &this->allocator, "_!test_this_is_not_a_valid_name", "", &nat);
134+
EXPECT_EQ(RCL_RET_NODE_INVALID_NAME, ret) << rcl_get_error_string().str;
137135
rcl_reset_error();
138136
// Non-existent node
139-
// Note, Opensplice successfully reports graph information about finalized nodes
140-
if (!is_opensplice) {
141-
ret = rcl_action_get_client_names_and_types_by_node(
142-
&this->node, &this->allocator, this->test_graph_old_node_name, "", &nat);
143-
EXPECT_EQ(RCL_RET_ERROR, ret) << rcl_get_error_string().str;
144-
rcl_reset_error();
145-
}
137+
ret = rcl_action_get_client_names_and_types_by_node(
138+
&this->node, &this->allocator, this->test_graph_unknown_node_name, "", &nat);
139+
EXPECT_EQ(RCL_RET_NODE_NAME_NON_EXISTENT, ret) << rcl_get_error_string().str;
140+
rcl_reset_error();
146141
// Invalid names and types
147142
ret = rcl_action_get_client_names_and_types_by_node(
148143
&this->node, &this->allocator, this->test_graph_node_name, "", nullptr);
@@ -188,17 +183,14 @@ TEST_F(
188183
rcl_reset_error();
189184
// Invalid node name
190185
ret = rcl_action_get_server_names_and_types_by_node(
191-
&this->node, &this->allocator, "_test_this_Isnot_a_valid_name", "", &nat);
192-
EXPECT_EQ(RCL_RET_ERROR, ret) << rcl_get_error_string().str;
186+
&this->node, &this->allocator, "_!test_this_is_not_a_valid_name", "", &nat);
187+
EXPECT_EQ(RCL_RET_NODE_INVALID_NAME, ret) << rcl_get_error_string().str;
193188
rcl_reset_error();
194189
// Non-existent node
195-
// Note, Opensplice successfully reports graph information about finalized nodes
196-
if (!is_opensplice) {
197-
ret = rcl_action_get_server_names_and_types_by_node(
198-
&this->node, &this->allocator, this->test_graph_old_node_name, "", &nat);
199-
EXPECT_EQ(RCL_RET_ERROR, ret) << rcl_get_error_string().str;
200-
rcl_reset_error();
201-
}
190+
ret = rcl_action_get_server_names_and_types_by_node(
191+
&this->node, &this->allocator, this->test_graph_unknown_node_name, "", &nat);
192+
EXPECT_EQ(RCL_RET_NODE_NAME_NON_EXISTENT, ret) << rcl_get_error_string().str;
193+
rcl_reset_error();
202194
// Invalid names and types
203195
ret = rcl_action_get_server_names_and_types_by_node(
204196
&this->node, &this->allocator, this->test_graph_node_name, "", nullptr);

0 commit comments

Comments
 (0)