Skip to content

Commit

Permalink
Fix failing demo_nodes_cpp launch tests
Browse files Browse the repository at this point in the history
Signed-off-by: Michel Hidalgo <[email protected]>
  • Loading branch information
hidmic committed Apr 29, 2019
1 parent 044d5fb commit 4efe6a0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion demo_nodes_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ if(BUILD_TESTING)
add_launch_test(
"${CMAKE_CURRENT_BINARY_DIR}/test_${exe_list_underscore}${target_suffix}_$<CONFIG>.py"
TARGET test_tutorial_${exe_list_underscore}${target_suffix}
TIMEOUT 30
TIMEOUT 60
ENV
RCL_ASSERT_RMW_ID_MATCHES=${rmw_implementation}
RMW_IMPLEMENTATION=${rmw_implementation}
Expand Down
21 changes: 8 additions & 13 deletions demo_nodes_cpp/test/test_executables_tutorial.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ from launch.actions import OpaqueFunction

import launch_testing
import launch_testing.asserts
import launch_testing.utils
import launch_testing.util
import launch_testing_ros


Expand All @@ -27,7 +27,7 @@ def generate_test_description(ready_fn):
]
for process in processes_under_test:
launch_description.add_action(process)
launch_description.add_action(launch_testing.utils.KeepAliveProc())
launch_description.add_action(launch_testing.util.KeepAliveProc())
launch_description.add_action(
OpaqueFunction(function=lambda context: ready_fn())
)
Expand All @@ -50,24 +50,19 @@ class TestExecutablesTutorial(unittest.TestCase):
proc_output.assertWaitFor(
expected_output=launch_testing.tools.expected_output_from_file(
path=output_file
), process=process, output_filter=output_filter, timeout=10
), process=process, output_filter=output_filter, timeout=30
)

# TODO(hidmic): either make the underlying executables resilient to
# interruptions close/during shutdown OR adapt the testing suite to
# better cope with it.
import time
time.sleep(5)

@launch_testing.post_shutdown_test()
class TestExecutablesTutorialAfterShutdown(unittest.TestCase):

def test_last_process_exit_code(self, proc_info, processes_under_test):
"""Test last process exit code."""
# TODO(hidmic): fail the test on a nonzero exit code.
# Currently pre shutdown tests are terminating too soon and
# the signal seems to be sent in the middle of the fixture
# nodes' shutdown (for those that shutdown themselves) and
# these are not handling this situation gracefully. If pre
# shutdown test termination is delayed instead, the testing
# framework complains about the launch run terminating before
# tests are done.

launch_testing.asserts.assertExitCodes(
proc_info,
process=processes_under_test[-1]
Expand Down

0 comments on commit 4efe6a0

Please sign in to comment.