Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion diagnostic_aggregator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ if(BUILD_TESTING)
"primitive_analyzers"
"all_analyzers"
"analyzer_group"
"empty_root_path")
"empty_root_path"
"expected_only_analyzer")

foreach(test_name ${create_analyzers_tests})
file(TO_CMAKE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/test/${test_name}.yaml" PARAMETER_FILE)
Expand Down
3 changes: 2 additions & 1 deletion diagnostic_aggregator/src/generic_analyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ bool GenericAnalyzer::init(
RCLCPP_DEBUG(
rclcpp::get_logger("GenericAnalyzer"), "GenericAnalyzer '%s' found expected: %s",
nice_name_.c_str(), pvalue.value_to_string().c_str());
for (auto exp : pvalue.as_string_array()) {
expected_ = pvalue.as_string_array();
for (const auto & exp : expected_) {
auto item = std::make_shared<StatusItem>(exp);
this->addItem(exp, item);
}
Expand Down
11 changes: 11 additions & 0 deletions diagnostic_aggregator/test/expected_only_analyzer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**:
ros__parameters:
log_level: debug
# Regression test for the `expected` matcher: an analyzer whose ONLY matcher
# is `expected` must still initialise. Prior to the fix this failed because
# the `expected` parameter populated the base-class items_ map but never the
# expected_ vector that the init guard checks, so the analyzer was dropped.
expected_only:
type: 'diagnostic_aggregator/GenericAnalyzer'
path: ExpectedOnly
expected: [ 'some/expected/status' ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
diagnostic_aggregator/GenericAnalyzer 'ExpectedOnly'
/ExpectedOnly