From 47bee8be10b1a425e4a08bc3f9c5f2b1190d40c2 Mon Sep 17 00:00:00 2001 From: elianalf <62831776+elianalf@users.noreply.github.com> Date: Tue, 11 Jun 2024 15:30:02 +0200 Subject: [PATCH] Refs #21094: Split test Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> --- test/examples/test_configuration.py | 77 ----------------------- test/examples/test_custom_payload_pool.py | 39 ++++++++++++ 2 files changed, 39 insertions(+), 77 deletions(-) create mode 100644 test/examples/test_custom_payload_pool.py diff --git a/test/examples/test_configuration.py b/test/examples/test_configuration.py index 001323562e2..4dc5b185998 100644 --- a/test/examples/test_configuration.py +++ b/test/examples/test_configuration.py @@ -1,83 +1,6 @@ import subprocess import pytest -def test_hello_world(): - """.""" - ret = False - out = '' - try: - out = subprocess.check_output( - '@DOCKER_EXECUTABLE@ compose -f hello_world.compose.yml up', - stderr=subprocess.STDOUT, - shell=True, - timeout=30 - ).decode().split('\n') - - sent = 0 - received = 0 - 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: - print('ERROR: sent: ' + str(sent) + ', but received: ' + str(received) + - ' (expected: ' + str(sent * 2) + ')') - raise subprocess.CalledProcessError(1, '') - - except subprocess.CalledProcessError: - for l in out: - print(l) - except subprocess.TimeoutExpired: - print('TIMEOUT') - print(out) - - assert(ret) - -def test_custom_payload_pool(): - """.""" - ret = False - out = '' - try: - out = subprocess.check_output( - '@DOCKER_EXECUTABLE@ compose -f custom_payload_pool.compose.yml up', - stderr=subprocess.STDOUT, - shell=True, - timeout=30 - ).decode().split('\n') - - sent = 0 - received = 0 - 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: - print('ERROR: sent: ' + str(sent) + ', but received: ' + str(received)) - raise subprocess.CalledProcessError(1, '') - - except subprocess.CalledProcessError: - for l in out: - print(l) - except subprocess.TimeoutExpired: - print('TIMEOUT') - print(out) - - assert(ret) - config_test_cases = [ ('--keep-last 10 --transport DEFAULT', '--keep-last 10 --transport DEFAULT'), # Builtin transports ('--keep-last 10 --transport DEFAULT', '--keep-last 10 --transport UDPv4'), diff --git a/test/examples/test_custom_payload_pool.py b/test/examples/test_custom_payload_pool.py new file mode 100644 index 00000000000..d0173bf28e6 --- /dev/null +++ b/test/examples/test_custom_payload_pool.py @@ -0,0 +1,39 @@ +import subprocess +import pytest +def test_custom_payload_pool(): + """.""" + ret = False + out = '' + try: + out = subprocess.check_output( + '@DOCKER_EXECUTABLE@ compose -f custom_payload_pool.compose.yml up', + stderr=subprocess.STDOUT, + shell=True, + timeout=30 + ).decode().split('\n') + + sent = 0 + received = 0 + 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: + print('ERROR: sent: ' + str(sent) + ', but received: ' + str(received)) + raise subprocess.CalledProcessError(1, '') + + except subprocess.CalledProcessError: + for l in out: + print(l) + except subprocess.TimeoutExpired: + print('TIMEOUT') + print(out) + + assert(ret)