Skip to content

Commit

Permalink
Adds a regression test for logplayback fix in gazebosim#2611 (gazebos…
Browse files Browse the repository at this point in the history
…im#2619)

* Adds a regression test for logplayback

gazebosim/gazebo_test_cases#1640

This commit adds a really simple regression check to make sure we
actually publish on the right topic.

Signed-off-by: Arjo Chakravarty <[email protected]>

* typo fix

Signed-off-by: Arjo Chakravarty <[email protected]>

* Make atomic

Signed-off-by: Arjo Chakravarty <[email protected]>

---------

Signed-off-by: Arjo Chakravarty <[email protected]>
Co-authored-by: Addisu Z. Taddese <[email protected]>
  • Loading branch information
arjo129 and azeey authored Sep 12, 2024
1 parent ca40c1d commit 0f16949
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/integration/log_system.cc
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,18 @@ TEST_F(LogSystemTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(RecordAndPlayback))
// Start server
Server playServer(playServerConfig);

// Simulate a client
gz::transport::Node node;
std::atomic<std::size_t> numMsgs = 0;
std::function<void(const msgs::SerializedStepMap &)> mockClient =
[&](const msgs::SerializedStepMap &/*_res*/)
{
numMsgs++;
};
using namespace std::placeholders;
EXPECT_TRUE(node.Subscribe(
"/world/default/state", mockClient));

// Callback function for entities played back
// Compare current pose being played back with the pose from the stateMsg
test::Relay playbackPoseTester;
Expand Down Expand Up @@ -837,6 +849,9 @@ TEST_F(LogSystemTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(RecordAndPlayback))
// checked in the playbackPoseTester
playServer.Run(true, 500, false);

// The client should have received some messages.
EXPECT_NE(numMsgs, 0);

// Count the total number of state messages in the log file
int nTotal{0};
for (auto it = batch.begin(); it != batch.end(); ++it, ++nTotal) { }
Expand Down

0 comments on commit 0f16949

Please sign in to comment.