From 6505cf2af1aaed2972d6e511b11b834fbf740ed1 Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Tue, 9 Apr 2024 13:53:14 -0500 Subject: [PATCH] Fix TriggeredPublisher test (#2354) Signed-off-by: Addisu Z. Taddese --- test/integration/triggered_publisher.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) 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)