Skip to content

Commit

Permalink
Issue #28 - Updated existing tests to use completed_successfully() in…
Browse files Browse the repository at this point in the history
…stead of checking return code
  • Loading branch information
fgiorgetti committed Apr 9, 2019
1 parent 5073fce commit 31ca752
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ def test_address_translation_sending(self, address, translates_to, sender, broke
sender.execution.wait()

# Validating sender completed successfully
logging.debug("Sender exit code: %s - timed out: %s" %
(sender.execution.returncode,
logging.debug("Sender completed successfully: %s - timed out: %s" %
(sender.execution.completed_successfully(),
sender.execution.timed_out))
assert sender.execution.completed_successfully()

Expand Down Expand Up @@ -173,8 +173,8 @@ def test_address_translation_receiving(self, address, translates_to, receiver, b
receiver.execution.wait()

# Validating results
logging.info("Receiver exit code: %s - timed out: %s" %
(receiver.execution.returncode,
logging.info("Receiver completed successfully: %s - timed out: %s" %
(receiver.execution.completed_successfully(),
receiver.execution.timed_out))
assert receiver.execution.completed_successfully()

Expand Down
10 changes: 4 additions & 6 deletions router/smoke/openshift/test_openshift_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,27 +251,25 @@ def validate_client_results(receiver, sender):

# Debugging receiver results
if not receiver.execution.completed_successfully():
logger.debug("Receiver did not complete successfully [exit code = %d]"
% receiver.execution.returncode)
logger.debug("Receiver did not complete successfully")
logger.debug("Receiver stdout = %s" % receiver.execution.read_stdout())
logger.debug("Receiver stderr = %s" % receiver.execution.read_stderr())

# Debugging sender results
if not sender.execution.completed_successfully():
logger.debug("Sender did not complete successfully [exit code = %d]"
% sender.execution.returncode)
logger.debug("Sender did not complete successfully")
logger.debug("Sender stdout = %s" % sender.execution.read_stdout())
logger.debug("Sender stderr = %s" % sender.execution.read_stderr())

# Validating receiver results
assert not receiver.execution.is_running()
assert receiver.execution.returncode == 0, \
assert receiver.execution.completed_successfully(), \
'%s did not complete successfully' % receiver.implementation.upper()

# Each message received will be printed as one line (plus some extra lines from Ansible)
assert len(receiver.execution.read_stdout(lines=True)) >= MESSAGE_COUNT.get(receiver.implementation)

# Validating if sender process completed without timing out
assert not sender.execution.is_running()
assert sender.execution.returncode == 0, \
assert sender.execution.completed_successfully(), \
'%s did not complete successfully' % sender.implementation.upper()
10 changes: 4 additions & 6 deletions router/smoke/openshift_2/test_openshift_02_messaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,27 +110,25 @@ def validate_client_results(receiver: [ReceiverJava, ReceiverPython, ReceiverNod

# Debugging receiver results
if not receiver.execution.completed_successfully():
logger.debug("Receiver did not complete successfully [exit code = %d]"
% receiver.execution.returncode)
logger.debug("Receiver did not complete successfully")
logger.debug("Receiver stdout = %s" % receiver.execution.read_stdout())
logger.debug("Receiver stderr = %s" % receiver.execution.read_stderr())

# Debugging sender results
if not sender.execution.completed_successfully():
logger.debug("Sender did not complete successfully [exit code = %d]"
% sender.execution.returncode)
logger.debug("Sender did not complete successfully")
logger.debug("Sender stdout = %s" % sender.execution.read_stdout())
logger.debug("Sender stderr = %s" % sender.execution.read_stderr())

# Validating receiver results
assert not receiver.execution.is_running()
assert receiver.execution.returncode == 0, \
assert receiver.execution.completed_successfully(), \
'%s did not complete successfully' % receiver.implementation.upper()

# Each message received will be printed as one line (plus some extra lines from Ansible)
assert len(receiver.execution.read_stdout(lines=True)) >= MESSAGE_COUNT

# Validating if sender process completed without timing out
assert not sender.execution.is_running()
assert sender.execution.returncode == 0, \
assert sender.execution.completed_successfully(), \
'%s did not complete successfully' % sender.implementation.upper()

0 comments on commit 31ca752

Please sign in to comment.