Skip to content

Commit

Permalink
Migrate /ign to /gz in test and ignTest to gzTest
Browse files Browse the repository at this point in the history
Signed-off-by: methylDragon <methylDragon@gmail.com>
  • Loading branch information
methylDragon committed Jun 13, 2022
1 parent 3c4e8e6 commit e0c3d6c
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 51 deletions.
90 changes: 45 additions & 45 deletions src/cmd/gz_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ using namespace gz;

static std::string g_partition; // NOLINT(*)
static std::string g_topicCBStr; // NOLINT(*)
static const std::string g_ignVersion("--force-version " + // NOLINT(*)
static const std::string g_gzVersion("--force-version " + // NOLINT(*)
std::string(GZ_VERSION_FULL));

/////////////////////////////////////////////////
Expand Down Expand Up @@ -75,7 +75,7 @@ void topicCB(const gz::msgs::StringMsg &_msg)

//////////////////////////////////////////////////
/// \brief Check 'gz topic -l' running the advertiser on a different process.
TEST(ignTest, IGN_UTILS_TEST_DISABLED_ON_MAC(TopicList))
TEST(gzTest, IGN_UTILS_TEST_DISABLED_ON_MAC(TopicList))
{
// Launch a new publisher process that advertises a topic.
std::string publisher_path = testing::portablePathUnion(
Expand All @@ -86,14 +86,14 @@ TEST(ignTest, IGN_UTILS_TEST_DISABLED_ON_MAC(TopicList))
g_partition.c_str());

// Check the 'gz topic -l' command.
std::string ign = std::string(GZ_PATH) + "/ign";
std::string gz = std::string(GZ_PATH) + "/gz";

unsigned int retries = 0u;
bool topicFound = false;

while (!topicFound && retries++ < 10u)
{
std::string output = custom_exec_str(ign + " topic -l " + g_ignVersion);
std::string output = custom_exec_str(gz + " topic -l " + g_gzVersion);
topicFound = output == "/foo\n";
std::this_thread::sleep_for(std::chrono::milliseconds(300));
}
Expand All @@ -106,7 +106,7 @@ TEST(ignTest, IGN_UTILS_TEST_DISABLED_ON_MAC(TopicList))

//////////////////////////////////////////////////
/// \brief Check 'gz topic -i' running the advertiser on a different process.
TEST(ignTest, TopicInfo)
TEST(gzTest, TopicInfo)
{
// Launch a new publisher process that advertises a topic.
std::string publisher_path = testing::portablePathUnion(
Expand All @@ -117,15 +117,15 @@ TEST(ignTest, TopicInfo)
g_partition.c_str());

// Check the 'gz topic -i' command.
std::string ign = std::string(GZ_PATH) + "/ign";
std::string gz = std::string(GZ_PATH) + "/gz";

unsigned int retries = 0u;
bool infoFound = false;
std::string output;

while (!infoFound && retries++ < 10u)
{
output = custom_exec_str(ign + " topic -t /foo -i " + g_ignVersion);
output = custom_exec_str(gz + " topic -t /foo -i " + g_gzVersion);
infoFound = output.size() > 50u;
std::this_thread::sleep_for(std::chrono::milliseconds(300));
}
Expand All @@ -142,7 +142,7 @@ TEST(ignTest, TopicInfo)
//////////////////////////////////////////////////
/// \brief Check 'gz service -l' running the advertiser on a different
/// process.
TEST(ignTest, ServiceList)
TEST(gzTest, ServiceList)
{
// Launch a new responser process that advertises a service.
std::string replier_path = testing::portablePathUnion(
Expand All @@ -153,14 +153,14 @@ TEST(ignTest, ServiceList)
g_partition.c_str());

// Check the 'gz service -l' command.
std::string ign = std::string(GZ_PATH) + "/ign";
std::string gz = std::string(GZ_PATH) + "/gz";

unsigned int retries = 0u;
bool serviceFound = false;

while (!serviceFound && retries++ < 10u)
{
std::string output = custom_exec_str(ign + " service -l " + g_ignVersion);
std::string output = custom_exec_str(gz + " service -l " + g_gzVersion);
serviceFound = output == "/foo\n";
std::this_thread::sleep_for(std::chrono::milliseconds(300));
}
Expand All @@ -173,7 +173,7 @@ TEST(ignTest, ServiceList)

//////////////////////////////////////////////////
/// \brief Check 'gz service -i' running the advertiser on a different process.
TEST(ignTest, ServiceInfo)
TEST(gzTest, ServiceInfo)
{
// Launch a new publisher process that advertises a topic.
std::string replier_path = testing::portablePathUnion(
Expand All @@ -184,15 +184,15 @@ TEST(ignTest, ServiceInfo)
g_partition.c_str());

// Check the 'gz service -i' command.
std::string ign = std::string(GZ_PATH) + "/ign";
std::string gz = std::string(GZ_PATH) + "/gz";

unsigned int retries = 0u;
bool infoFound = false;
std::string output;

while (!infoFound && retries++ < 10u)
{
output = custom_exec_str(ign + " service -s /foo -i " + g_ignVersion);
output = custom_exec_str(gz + " service -s /foo -i " + g_gzVersion);
infoFound = output.size() > 50u;
std::this_thread::sleep_for(std::chrono::milliseconds(300));
}
Expand All @@ -206,7 +206,7 @@ TEST(ignTest, ServiceInfo)

//////////////////////////////////////////////////
/// \brief Check 'gz topic -l' running the advertiser on the same process.
TEST(ignTest, TopicListSameProc)
TEST(gzTest, TopicListSameProc)
{
gz::transport::Node node;

Expand All @@ -220,14 +220,14 @@ TEST(ignTest, TopicListSameProc)
EXPECT_TRUE(pub.Publish(msg));

// Check the 'gz topic -l' command.
std::string ign = std::string(GZ_PATH) + "/ign";
std::string gz = std::string(GZ_PATH) + "/gz";

unsigned int retries = 0u;
bool topicFound = false;

while (!topicFound && retries++ < 10u)
{
std::string output = custom_exec_str(ign + " topic -l " + g_ignVersion);
std::string output = custom_exec_str(gz + " topic -l " + g_gzVersion);
topicFound = output == "/foo\n";
std::this_thread::sleep_for(std::chrono::milliseconds(300));
}
Expand All @@ -237,7 +237,7 @@ TEST(ignTest, TopicListSameProc)

//////////////////////////////////////////////////
/// \brief Check 'gz topic -i' running the advertiser on the same process.
TEST(ignTest, TopicInfoSameProc)
TEST(gzTest, TopicInfoSameProc)
{
gz::transport::Node node;

Expand All @@ -251,15 +251,15 @@ TEST(ignTest, TopicInfoSameProc)
EXPECT_TRUE(pub.Publish(msg));

// Check the 'gz topic -i' command.
std::string ign = std::string(GZ_PATH) + "/ign";
std::string gz = std::string(GZ_PATH) + "/gz";

unsigned int retries = 0u;
bool infoFound = false;
std::string output;

while (!infoFound && retries++ < 10u)
{
output = custom_exec_str(ign + " topic -t /foo -i " + g_ignVersion);
output = custom_exec_str(gz + " topic -t /foo -i " + g_gzVersion);
infoFound = output.size() > 50u;
std::this_thread::sleep_for(std::chrono::milliseconds(300));
}
Expand All @@ -270,20 +270,20 @@ TEST(ignTest, TopicInfoSameProc)

//////////////////////////////////////////////////
/// \brief Check 'gz service -l' running the advertiser on the same process.
TEST(ignTest, ServiceListSameProc)
TEST(gzTest, ServiceListSameProc)
{
transport::Node node;
EXPECT_TRUE(node.Advertise("/foo", srvEcho));

// Check the 'gz service -l' command.
std::string ign = std::string(GZ_PATH) + "/ign";
std::string gz = std::string(GZ_PATH) + "/gz";

unsigned int retries = 0u;
bool serviceFound = false;

while (!serviceFound && retries++ < 10u)
{
std::string output = custom_exec_str(ign + " service -l " + g_ignVersion);
std::string output = custom_exec_str(gz + " service -l " + g_gzVersion);
serviceFound = output == "/foo\n";
std::this_thread::sleep_for(std::chrono::milliseconds(300));
}
Expand All @@ -293,21 +293,21 @@ TEST(ignTest, ServiceListSameProc)

//////////////////////////////////////////////////
/// \brief Check 'gz service -i' running the advertiser on the same process.
TEST(ignTest, ServiceInfoSameProc)
TEST(gzTest, ServiceInfoSameProc)
{
gz::transport::Node node;
EXPECT_TRUE(node.Advertise("/foo", srvEcho));

// Check the 'gz service -i' command.
std::string ign = std::string(GZ_PATH) + "/ign";
std::string gz = std::string(GZ_PATH) + "/gz";

unsigned int retries = 0u;
bool infoFound = false;
std::string output;

while (!infoFound && retries++ < 10u)
{
output = custom_exec_str(ign + " service -s /foo -i " + g_ignVersion);
output = custom_exec_str(gz + " service -s /foo -i " + g_gzVersion);
infoFound = output.size() > 50u;
std::this_thread::sleep_for(std::chrono::milliseconds(300));
}
Expand All @@ -319,14 +319,14 @@ TEST(ignTest, ServiceInfoSameProc)

//////////////////////////////////////////////////
/// \brief Check 'gz topic -p' to send a message.
TEST(ignTest, TopicPublish)
TEST(gzTest, TopicPublish)
{
gz::transport::Node node;
g_topicCBStr = "bad_value";
EXPECT_TRUE(node.Subscribe("/bar", topicCB));

// Check the 'gz topic -p' command.
std::string ign = std::string(GZ_PATH) + "/ign";
std::string gz = std::string(GZ_PATH) + "/gz";
std::string output;

unsigned int retries = 0;
Expand All @@ -335,9 +335,9 @@ TEST(ignTest, TopicPublish)
// Send on alternating retries
if (retries % 2)
{
output = custom_exec_str(ign +
output = custom_exec_str(gz +
" topic -t /bar -m gz_msgs.StringMsg -p 'data:\"good_value\"' " +
g_ignVersion);
g_gzVersion);
EXPECT_TRUE(output.empty()) << output;
}
std::this_thread::sleep_for(std::chrono::milliseconds(30));
Expand All @@ -346,29 +346,29 @@ TEST(ignTest, TopicPublish)

// Try to publish a message not included in Gazebo Messages.
std::string error = "Unable to create message of type";
output = custom_exec_str(ign +
output = custom_exec_str(gz +
" topic -t /bar -m gz_msgs.__bad_msg_type -p 'data:\"good_value\"' " +
g_ignVersion);
g_gzVersion);
EXPECT_EQ(output.compare(0, error.size(), error), 0);

// Try to publish using an incorrect topic name.
error = "Topic [/] is not valid";
output = custom_exec_str(ign +
output = custom_exec_str(gz +
" topic -t / -m gz_msgs.StringMsg -p 'data:\"good_value\"' "+
g_ignVersion);
g_gzVersion);
EXPECT_EQ(output.compare(0, error.size(), error), 0) << output;

// Try to publish using an incorrect number of arguments.
error = "The following argument was not expected: wrong_topic";
output = custom_exec_str(ign +
output = custom_exec_str(gz +
" topic -t / wrong_topic -m gz_msgs.StringMsg -p 'data:\"good_value\"' "+
g_ignVersion);
g_gzVersion);
EXPECT_EQ(output.compare(0, error.size(), error), 0) << output;
}

//////////////////////////////////////////////////
/// \brief Check 'gz service -r' to request a service.
TEST(ignTest, ServiceRequest)
TEST(gzTest, ServiceRequest)
{
gz::transport::Node node;

Expand All @@ -381,18 +381,18 @@ TEST(ignTest, ServiceRequest)
msg.set_data(10);

// Check the 'gz service -r' command.
std::string ign = std::string(GZ_PATH) + "/ign";
std::string output = custom_exec_str(ign +
std::string gz = std::string(GZ_PATH) + "/gz";
std::string output = custom_exec_str(gz +
" service -s " + service + " --reqtype gz_msgs.Int32 " +
"--reptype gz_msgs.Int32 --timeout 1000 " +
"--req 'data: " + value + "' " + g_ignVersion);
"--req 'data: " + value + "' " + g_gzVersion);

ASSERT_EQ(output, "data: " + value + "\n\n");
}

//////////////////////////////////////////////////
/// \brief Check 'gz topic -e' running the publisher on a separate process.
TEST(ignTest, TopicEcho)
TEST(gzTest, TopicEcho)
{
// Launch a new publisher process that advertises a topic.
std::string publisher_path = testing::portablePathUnion(
Expand All @@ -403,9 +403,9 @@ TEST(ignTest, TopicEcho)
g_partition.c_str());

// Check the 'gz topic -e' command.
std::string ign = std::string(GZ_PATH) + "/ign";
std::string gz = std::string(GZ_PATH) + "/gz";
std::string output = custom_exec_str(
ign + " topic -e -t /foo -d 1.5 " + g_ignVersion);
gz + " topic -e -t /foo -d 1.5 " + g_gzVersion);

EXPECT_TRUE(output.find("x: 1") != std::string::npos);
EXPECT_TRUE(output.find("y: 2") != std::string::npos);
Expand All @@ -418,7 +418,7 @@ TEST(ignTest, TopicEcho)
//////////////////////////////////////////////////
/// \brief Check 'gz topic -e -n 2' running the publisher on a separate
/// process.
TEST(ignTest, TopicEchoNum)
TEST(gzTest, TopicEchoNum)
{
// Launch a new publisher process that advertises a topic.
std::string publisher_path = testing::portablePathUnion(
Expand All @@ -429,9 +429,9 @@ TEST(ignTest, TopicEchoNum)
g_partition.c_str());

// Check the 'gz topic -e -n' command.
std::string ign = std::string(GZ_PATH) + "/ign";
std::string gz = std::string(GZ_PATH) + "/gz";
std::string output = custom_exec_str(
ign + " topic -e -t /foo -n 2 " + g_ignVersion);
gz + " topic -e -t /foo -n 2 " + g_gzVersion);

size_t pos = output.find("x: 1");
EXPECT_TRUE(pos != std::string::npos);
Expand Down
12 changes: 6 additions & 6 deletions src/cmd/gz_src_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ bool srvEcho(const gz::msgs::Int32 &_req, gz::msgs::Int32 &_rep)

//////////////////////////////////////////////////
/// \brief Check cmdTopicInfo running the advertiser on a the same process.
TEST(ignTest, cmdTopicInfo)
TEST(gzTest, cmdTopicInfo)
{
std::stringstream stdOutBuffer;
std::stringstream stdErrBuffer;
Expand All @@ -96,7 +96,7 @@ TEST(ignTest, cmdTopicInfo)

//////////////////////////////////////////////////
/// \brief Check cmdServiceInfo running the advertiser on a the same process.
TEST(ignTest, cmdServiceInfo)
TEST(gzTest, cmdServiceInfo)
{
std::stringstream stdOutBuffer;
std::stringstream stdErrBuffer;
Expand All @@ -120,7 +120,7 @@ TEST(ignTest, cmdServiceInfo)

//////////////////////////////////////////////////
/// \brief Check cmdTopicPub running the advertiser on a the same process.
TEST(ignTest, cmdTopicPub)
TEST(gzTest, cmdTopicPub)
{
std::stringstream stdOutBuffer;
std::stringstream stdErrBuffer;
Expand Down Expand Up @@ -148,7 +148,7 @@ TEST(ignTest, cmdTopicPub)

//////////////////////////////////////////////////
/// \brief Check cmdServiceReq running the advertiser on a the same process.
TEST(ignTest, cmdServiceReq)
TEST(gzTest, cmdServiceReq)
{
std::stringstream stdOutBuffer;
std::stringstream stdErrBuffer;
Expand Down Expand Up @@ -221,7 +221,7 @@ TEST(ignTest, cmdServiceReq)

//////////////////////////////////////////////////
/// \brief Check cmdTopicEcho running the advertiser on a the same process.
TEST(ignTest, cmdTopicEcho)
TEST(gzTest, cmdTopicEcho)
{
std::stringstream stdOutBuffer;
std::stringstream stdErrBuffer;
Expand All @@ -243,7 +243,7 @@ TEST(ignTest, cmdTopicEcho)
}

/////////////////////////////////////////////////
TEST(ignTest, cmdTopicEchoOutputFormats)
TEST(gzTest, cmdTopicEchoOutputFormats)
{
std::stringstream stdOutBuffer;
std::stringstream stdErrBuffer;
Expand Down

0 comments on commit e0c3d6c

Please sign in to comment.