From 929cc4a2dc334c6dfac597827e9d7fc3644ed286 Mon Sep 17 00:00:00 2001 From: Florian Reimold <11774314+FlorianReimold@users.noreply.github.com> Date: Wed, 20 Nov 2024 18:07:01 +0100 Subject: [PATCH] Tried fixing tests --- tests/tcp_pubsub_test/src/tcp_pubsub_test.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/tcp_pubsub_test/src/tcp_pubsub_test.cpp b/tests/tcp_pubsub_test/src/tcp_pubsub_test.cpp index d68bda1..d42b10d 100644 --- a/tests/tcp_pubsub_test/src/tcp_pubsub_test.cpp +++ b/tests/tcp_pubsub_test/src/tcp_pubsub_test.cpp @@ -50,7 +50,8 @@ TEST(tcp_pubsub, basic_test) // Wait up to 1 second for the subscriber to connect for (int i = 0; i < 10; ++i) { - if (hello_world_subscriber.getSessions().at(0)->isConnected()) + if (hello_world_subscriber.getSessions().at(0)->isConnected() + && hello_world_publisher.getSubscriberCount() >= 1) { break; } @@ -123,7 +124,8 @@ TEST(tcp_pubsub, large_message_test) // Wait up to 1 second for the subscriber to connect for (int i = 0; i < 10; ++i) { - if (hello_world_subscriber.getSessions().at(0)->isConnected()) + if (hello_world_subscriber.getSessions().at(0)->isConnected() + && hello_world_publisher.getSubscriberCount() >= 1) { break; } @@ -190,7 +192,10 @@ TEST(tcp_pubsub, multiple_publishers_test) // Wait up to 1 second for the subscriber to connect for (int i = 0; i < 10; ++i) { - if (hello_world_subscriber.getSessions().at(0)->isConnected() && hello_world_subscriber.getSessions().at(1)->isConnected()) + if (hello_world_subscriber.getSessions().at(0)->isConnected() + && hello_world_subscriber.getSessions().at(1)->isConnected() + && hello_world_publisher1.getSubscriberCount() >= 1 + && hello_world_publisher2.getSubscriberCount() >= 1) { break; } @@ -277,7 +282,9 @@ TEST(tcp_pubsub, multiple_subscribers_test) // Wait up to 1 second for the subscriber to connect for (int i = 0; i < 10; ++i) { - if (hello_world_subscriber1.getSessions().at(0)->isConnected() && hello_world_subscriber2.getSessions().at(0)->isConnected()) + if (hello_world_subscriber1.getSessions().at(0)->isConnected() + && hello_world_subscriber2.getSessions().at(0)->isConnected() + && hello_world_publisher.getSubscriberCount() >= 2) { break; }