forked from ros/diagnostics
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for add_analyzer at runtime, remove unnecessary ros info log…
…ger, remove unnecessary hardcoded namespace from yaml files
- Loading branch information
1 parent
b66a4ce
commit 4af79fc
Showing
11 changed files
with
117 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import os | ||
|
||
import unittest | ||
|
||
from launch import LaunchDescription | ||
from launch.actions import ExecuteProcess | ||
from launch.events import matches_action | ||
from launch.events.process import ShutdownProcess | ||
|
||
import launch_testing | ||
import launch_testing.actions | ||
import launch_testing.asserts | ||
import launch_testing.util | ||
import launch_testing_ros | ||
|
||
|
||
def generate_test_description(): | ||
os.environ['OSPL_VERBOSITY'] = '8' | ||
os.environ['RCUTILS_CONSOLE_OUTPUT_FORMAT'] = '{message}' | ||
|
||
aggregator_node = ExecuteProcess( | ||
cmd=[ | ||
"@AGGREGATOR_NODE@", | ||
"--ros-args", | ||
"--params-file", | ||
"@PARAMETER_FILE@" | ||
], | ||
name='aggregator_node', | ||
emulate_tty=True, | ||
output='screen') | ||
|
||
add_analyzer = ExecuteProcess( | ||
cmd=[ | ||
"@ADD_ANALYZER@", | ||
"--ros-args", | ||
"--params-file", | ||
"@ADD_PARAMETER_FILE@" | ||
], | ||
name='add_analyzer', | ||
emulate_tty=True, | ||
output='screen') | ||
|
||
launch_description = LaunchDescription() | ||
launch_description.add_action(aggregator_node) | ||
launch_description.add_action(add_analyzer) | ||
launch_description.add_action(launch_testing.util.KeepAliveProc()) | ||
launch_description.add_action(launch_testing.actions.ReadyToTest()) | ||
return launch_description, locals() | ||
|
||
class TestAggregator(unittest.TestCase): | ||
|
||
def test_processes_output(self, proc_output, aggregator_node): | ||
"""Check aggregator logging output for expected strings.""" | ||
|
||
from launch_testing.tools.output import get_default_filtered_prefixes | ||
output_filter = launch_testing_ros.tools.basic_output_filter( | ||
filtered_prefixes=get_default_filtered_prefixes() + ['service not available, waiting...'], | ||
filtered_rmw_implementation='@rmw_implementation@' | ||
) | ||
proc_output.assertWaitFor( | ||
expected_output=launch_testing.tools.expected_output_from_file(path="@EXPECTED_OUTPUT@"), | ||
process=aggregator_node, | ||
output_filter=output_filter, | ||
timeout=15 | ||
) | ||
|
||
import time | ||
time.sleep(1) | ||
|
||
@launch_testing.post_shutdown_test() | ||
class TestAggregatorShutdown(unittest.TestCase): | ||
|
||
def test_last_process_exit_code(self, proc_info, aggregator_node): | ||
launch_testing.asserts.assertExitCodes(proc_info, process=aggregator_node) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
analyzers: | ||
/**: | ||
ros__parameters: | ||
path: BASIC | ||
prefix1: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
analyzers: | ||
/**: | ||
ros__parameters: | ||
path: TEST | ||
primary: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/**: | ||
ros__parameters: | ||
path: BASIC | ||
prefix0: | ||
type: diagnostic_aggregator/GenericAnalyzer | ||
path: Zeroth | ||
contains: [ | ||
'contain0a', | ||
'contain0b' ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
analyzers: | ||
/**: | ||
ros__parameters: | ||
primary: | ||
type: 'diagnostic_aggregator/AnalyzerGroup' | ||
|
6 changes: 6 additions & 0 deletions
6
diagnostic_aggregator/test/expected_output/add_all_analyzers.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/BASIC/Zeroth | ||
prefix0 | ||
/BASIC/First | ||
prefix1 | ||
/BASIC/Third | ||
prefix3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
analyzers: | ||
/**: | ||
my_path: | ||
type: diagnostic_aggregator/GenericAnalyzer | ||
path: My Path | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
analyzers: | ||
/**: | ||
my_path: | ||
type: diagnostic_aggregator/GenericAnalyzer | ||
path: Header1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
analyzers: | ||
/**: | ||
ros__parameters: | ||
log_level: debug | ||
primary: | ||
|