← Back to Pull requests

Integrate unit and system tests via ament_add_gtest (#18) (backport #148) #164

Closed
unknown closed this pull request without merging on Nov 22, 2026 11:49 UTC
View on GitHub
unknown unknown commented on Nov 22, 2026 11:44 UTC
Author

Closes #18

Summary

Tests used to be standalone client executables (built with CLIENT_TEST_DEMO=ON) driven by test/test.py and a launch file, so they could not run with colcon test. This PR integrates unit and system tests into the persist_parameter_server package with ament_add_gtest, enables the ament_lint_common linters, and runs everything through colcon test in CI.

Changes

  • Core library: server/src/parameter_server.cpp is now built as a static library (persist_parameter_server_core) shared by the server executable and the test. The installed artifacts (server, launch and param files) are unchanged.

  • Tests (test/test_parameter_server.cpp, 13 cases) registered with ament_add_ros_isolated_gtest (a thin wrapper over ament_add_gtest that runs with an isolated ROS_DOMAIN_ID, so a running parameter server on the machine does not interfere). Each test runs the ParameterServer node in-process on its own executor thread and drives it with a parameter client node, exactly as an external node would. Stopping/restarting the node flushes and reloads the persistent yaml file, which replaces the former "kill the server process" step in test.py.

  • - Covers all former scenarios: default options (read/modify, persistence across restart, type change rejected), allow_dynamic_typing, save_on_update, and dynamic change of must_save_on_update / storing_period / allow_dynamic_typing, including the storing timer behaviour.
    - New coverage: content of the stored yaml file (non-persistent parameters never written, doubles written as 10.0), missing yaml file, node-name keyed yaml file, invalid yaml files rejected at startup, negative storing_period rejected.
  • Removed: test/test.py, test/launch/test.launch.py, the four client_* demo executables, the CLIENT_TEST_DEMO option and the psutil based process killing. test/persist_parameter_client.{hpp,cpp} is kept as a slimmed-down test helper.

  • Linters: ament_lint_auto / ament_lint_common are enabled. All uncrustify, cpplint, lint_cmake, flake8, pep257, copyright and xmllint findings in server/, test/ and the launch file are fixed. Most of the diff in parameter_server.cpp is the mechanical uncrustify reformat (brace placement and line wrapping); the only semantic edits there are PRId64 format specifiers instead of %ld/%lld. parameter_server.h is renamed to parameter_server.hpp and main.cpp drops using namespace.

  • CI: scripts/build-verification.sh (called by all distro workflows) now builds without CLIENT_TEST_DEMO and runs colcon test --packages-select persist_parameter_server --return-code-on-test-failure followed by colcon test-result --all --verbose.

  • package.xml: ament_cmake_gtest and ament_cmake_ros test dependencies replace the unused ament_cmake_pytest / launch; schema reference fixed to package_format3.xsd (xmllint was failing on it).

  • README: build and test sections updated for the colcon test workflow.
  • Test results (ROS rolling, source build)

    test_parameter_server.gtest.xml: 13 tests, 0 errors, 0 failures, 0 skipped  (~13 s)
    copyright / cpplint / flake8 / lint_cmake / pep257 / uncrustify / xmllint: all passing
    

    The gtest suite was run 4 times in a row without failures. The server executable was also smoke-tested manually (ros2 param set, SIGINT, persisted values present in the yaml file).

    Notes for review

  • The reformatting touches most lines of server/src/parameter_server.cpp; this PR will auto-backport to kilted/jazzy/humble via mergify. The code is guarded for rclcpp < 17 as before, but a humble CI run is worth watching.

  • The new test files carry the same Sony Corporation copyright header as the files they were derived from; adjust if a different holder is intended.
  • 🤖 Generated with Claude Code<hr>This is an automatic backport of pull request #148 done by Mergify.

    Diff: 500 lines (+375 / -125) across 6 files Reviewer: fujitatomoya Review duration: 5m
    All Vouch review confidence checks passed
    Residual risk 0.27 = Change Risk (0.48) × (1 − Review Confidence (0.42)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.48 · 500 lines diff across 6 files
    0.48
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 44% · Reviewer familiarity: 35%
    42%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.372
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #164"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 42.2% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 47.5% (MEDIUM) · Higher = larger blast radius
    47.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 42.2% · Lower = rushed or shallow review
    42.2%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 27.5% · Safe to merge
    27.5%