diff --git a/test/integration/triggered_publisher.cc b/test/integration/triggered_publisher.cc index 58ab697e9a..e827452f29 100644 --- a/test/integration/triggered_publisher.cc +++ b/test/integration/triggered_publisher.cc @@ -721,6 +721,16 @@ TEST_F(TriggeredPublisherTest, std::string service = "/srv-test"; node.Advertise(service, srvEchoCb); + { + // This block of code is here because service requests from a previous test + // might interfere with this test. We sleep a small amount time and reset + // `recvCount` to 0. This ensures that the service requets from the previous + // test are discarded properly. + // TODO(azeey) Remove once + // https://github.com/gazebosim/gz-transport/issues/491 is resolved. + GZ_SLEEP_MS(2000); + recvCount = 0; + } const std::size_t pubCount{10}; for (std::size_t i = 0; i < pubCount; ++i)