Fix rcl_action test_graph (#504)

Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
This commit is contained in:
ivanpauno 2019-09-20 14:22:38 -03:00 committed by GitHub
parent a9af082d9e
commit 4eeaecf969
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -36,9 +36,6 @@
# define CLASSNAME(NAME, SUFFIX) NAME # define CLASSNAME(NAME, SUFFIX) NAME
#endif #endif
const bool is_opensplice =
std::string(rmw_get_implementation_identifier()).find("rmw_opensplice") == 0;
class CLASSNAME (TestActionGraphFixture, RMW_IMPLEMENTATION) : public ::testing::Test class CLASSNAME (TestActionGraphFixture, RMW_IMPLEMENTATION) : public ::testing::Test
{ {
public: public:
@ -51,6 +48,7 @@ public:
rcl_node_t zero_node; rcl_node_t zero_node;
const char * test_graph_node_name = "test_action_graph_node"; const char * test_graph_node_name = "test_action_graph_node";
const char * test_graph_old_node_name = "test_action_graph_old_node_name"; const char * test_graph_old_node_name = "test_action_graph_old_node_name";
const char * test_graph_unknown_node_name = "test_action_graph_unknown_node_name";
void SetUp() void SetUp()
{ {
@ -132,17 +130,14 @@ TEST_F(
rcl_reset_error(); rcl_reset_error();
// Invalid node name // Invalid node name
ret = rcl_action_get_client_names_and_types_by_node( ret = rcl_action_get_client_names_and_types_by_node(
&this->node, &this->allocator, "_test_this_Isnot_a_valid_name", "", &nat); &this->node, &this->allocator, "_!test_this_is_not_a_valid_name", "", &nat);
EXPECT_EQ(RCL_RET_ERROR, ret) << rcl_get_error_string().str; EXPECT_EQ(RCL_RET_NODE_INVALID_NAME, ret) << rcl_get_error_string().str;
rcl_reset_error(); rcl_reset_error();
// Non-existent node // Non-existent node
// Note, Opensplice successfully reports graph information about finalized nodes
if (!is_opensplice) {
ret = rcl_action_get_client_names_and_types_by_node( ret = rcl_action_get_client_names_and_types_by_node(
&this->node, &this->allocator, this->test_graph_old_node_name, "", &nat); &this->node, &this->allocator, this->test_graph_unknown_node_name, "", &nat);
EXPECT_EQ(RCL_RET_ERROR, ret) << rcl_get_error_string().str; EXPECT_EQ(RCL_RET_NODE_NAME_NON_EXISTENT, ret) << rcl_get_error_string().str;
rcl_reset_error(); rcl_reset_error();
}
// Invalid names and types // Invalid names and types
ret = rcl_action_get_client_names_and_types_by_node( ret = rcl_action_get_client_names_and_types_by_node(
&this->node, &this->allocator, this->test_graph_node_name, "", nullptr); &this->node, &this->allocator, this->test_graph_node_name, "", nullptr);
@ -188,17 +183,14 @@ TEST_F(
rcl_reset_error(); rcl_reset_error();
// Invalid node name // Invalid node name
ret = rcl_action_get_server_names_and_types_by_node( ret = rcl_action_get_server_names_and_types_by_node(
&this->node, &this->allocator, "_test_this_Isnot_a_valid_name", "", &nat); &this->node, &this->allocator, "_!test_this_is_not_a_valid_name", "", &nat);
EXPECT_EQ(RCL_RET_ERROR, ret) << rcl_get_error_string().str; EXPECT_EQ(RCL_RET_NODE_INVALID_NAME, ret) << rcl_get_error_string().str;
rcl_reset_error(); rcl_reset_error();
// Non-existent node // Non-existent node
// Note, Opensplice successfully reports graph information about finalized nodes
if (!is_opensplice) {
ret = rcl_action_get_server_names_and_types_by_node( ret = rcl_action_get_server_names_and_types_by_node(
&this->node, &this->allocator, this->test_graph_old_node_name, "", &nat); &this->node, &this->allocator, this->test_graph_unknown_node_name, "", &nat);
EXPECT_EQ(RCL_RET_ERROR, ret) << rcl_get_error_string().str; EXPECT_EQ(RCL_RET_NODE_NAME_NON_EXISTENT, ret) << rcl_get_error_string().str;
rcl_reset_error(); rcl_reset_error();
}
// Invalid names and types // Invalid names and types
ret = rcl_action_get_server_names_and_types_by_node( ret = rcl_action_get_server_names_and_types_by_node(
&this->node, &this->allocator, this->test_graph_node_name, "", nullptr); &this->node, &this->allocator, this->test_graph_node_name, "", nullptr);