From a6d6bf05a83482c6695c61489316987a740b01c5 Mon Sep 17 00:00:00 2001 From: JesusPoderoso Date: Mon, 1 Jul 2024 11:38:56 +0200 Subject: [PATCH] Refs #21219: Fix flakyness on test with participants in the same container Signed-off-by: JesusPoderoso --- test/examples/test_configuration.py | 5 +---- test/examples/test_content_filter.py | 4 +--- test/examples/test_custom_payload_pool.py | 4 +--- test/examples/test_delivery_mechanisms.py | 6 ++---- test/examples/test_delivery_mechanisms_isolated.py | 6 ++---- test/examples/test_hello_world.py | 4 +--- test/examples/test_xtypes.py | 4 +--- 7 files changed, 9 insertions(+), 24 deletions(-) diff --git a/test/examples/test_configuration.py b/test/examples/test_configuration.py index 69d740801eb..79fede9278b 100644 --- a/test/examples/test_configuration.py +++ b/test/examples/test_configuration.py @@ -69,11 +69,9 @@ def test_configuration(pub_args, sub_args): for line in render_out: if 'SENT' in line: sent += 1 - continue if 'RECEIVED' in line: received += 1 - continue if sent != 0 and received != 0 and sent * 2 == received: ret = True @@ -158,8 +156,7 @@ def test_configuration_expected_output(pub_args, sub_args, expected_message, n_m for line in render_out: if expected_message in line: count += 1 - continue - + if count >= int(n_messages): ret = True else: diff --git a/test/examples/test_content_filter.py b/test/examples/test_content_filter.py index 6925ffbe2d5..058b01ab731 100644 --- a/test/examples/test_content_filter.py +++ b/test/examples/test_content_filter.py @@ -45,7 +45,6 @@ def test_content_filter(pub_reader_filters, sub_custom_filter): for line in out: if 'SENT' in line: sent += 1 - continue if 'RECEIVED' in line: received += 1 @@ -53,8 +52,7 @@ def test_content_filter(pub_reader_filters, sub_custom_filter): if match: number = int(match.group(1)) data.append(number) - continue - + ret = True if sent != 0 and received != 0: for elem in data: diff --git a/test/examples/test_custom_payload_pool.py b/test/examples/test_custom_payload_pool.py index 431599d1c75..12124285310 100644 --- a/test/examples/test_custom_payload_pool.py +++ b/test/examples/test_custom_payload_pool.py @@ -31,12 +31,10 @@ def test_custom_payload_pool(): for line in out: if 'SENT' in line: sent += 1 - continue if 'RECEIVED' in line: received += 1 - continue - + if sent != 0 and received != 0 and sent == received: ret = True else: diff --git a/test/examples/test_delivery_mechanisms.py b/test/examples/test_delivery_mechanisms.py index 84be57bcd3f..90c786e994e 100644 --- a/test/examples/test_delivery_mechanisms.py +++ b/test/examples/test_delivery_mechanisms.py @@ -62,11 +62,10 @@ def test_delivery_mechanisms(pub_args, sub_args, isub_args, pubsub_args, repetit for line in out: if 'SENT' in line: sent += 1 - continue if 'RECEIVED' in line: received += 1 - continue + if sent != 0 and received != 0 and repetitions == received: ret = True else: @@ -142,8 +141,7 @@ def test_delivery_mechanisms_expected_output(pub_args, sub_args, pubsub_args, ex for line in render_out: if expected_message in line: count += 1 - continue - + if count >= int(n_messages): ret = True else: diff --git a/test/examples/test_delivery_mechanisms_isolated.py b/test/examples/test_delivery_mechanisms_isolated.py index 366f8b77ced..f69995c6d36 100644 --- a/test/examples/test_delivery_mechanisms_isolated.py +++ b/test/examples/test_delivery_mechanisms_isolated.py @@ -49,11 +49,10 @@ def test_delivery_mechanisms_isolated(pub_args, sub_args, isub_args, pubsub_args for line in out: if 'SENT' in line: sent += 1 - continue if 'RECEIVED' in line: received += 1 - continue + if sent != 0 and received != 0 and repetitions == received: ret = True else: @@ -129,8 +128,7 @@ def test_delivery_mechanisms_isolated_expected_output(pub_args, sub_args, pubsub for line in render_out: if expected_message in line: count += 1 - continue - + if count >= int(n_messages): ret = True else: diff --git a/test/examples/test_hello_world.py b/test/examples/test_hello_world.py index 69b6c278dec..56503c5d988 100644 --- a/test/examples/test_hello_world.py +++ b/test/examples/test_hello_world.py @@ -31,12 +31,10 @@ def test_hello_world(): for line in out: if 'SENT' in line: sent += 1 - continue if 'RECEIVED' in line: received += 1 - continue - + if sent != 0 and received != 0 and sent * 2 == received: ret = True else: diff --git a/test/examples/test_xtypes.py b/test/examples/test_xtypes.py index 9c59355ac0e..091861c440f 100644 --- a/test/examples/test_xtypes.py +++ b/test/examples/test_xtypes.py @@ -31,12 +31,10 @@ def test_xtypes(): for line in out: if 'sent' in line or 'SENT' in line: sent += 1 - continue if 'received' in line or 'RECEIVED' in line: received += 1 - continue - + if sent != 0 and received != 0 and sent * 3 == received: ret = True else: