Skip to content

Commit

Permalink
Refs #21094: Split test
Browse files Browse the repository at this point in the history
Signed-off-by: elianalf <[email protected]>
  • Loading branch information
elianalf committed Jun 11, 2024
1 parent f62b0bd commit d8ec03c
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 77 deletions.
77 changes: 0 additions & 77 deletions test/examples/test_configuration.py
Original file line number Diff line number Diff line change
@@ -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'),
Expand Down
39 changes: 39 additions & 0 deletions test/examples/test_custom_payload_pool.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit d8ec03c

Please sign in to comment.