Skip to content

test: extend smoke tests for v0.4.0 features and missing API coverage#53

Open
bburda wants to merge 5 commits intomainfrom
feature/smoke-tests-v040
Open

test: extend smoke tests for v0.4.0 features and missing API coverage#53
bburda wants to merge 5 commits intomainfrom
feature/smoke-tests-v040

Conversation

@bburda
Copy link
Copy Markdown
Contributor

@bburda bburda commented Mar 24, 2026

Description

Extend smoke tests to verify all new gateway v0.4.0 features and fill gaps in pre-v0.4.0 API coverage across all 3 demos.

New v0.4.0 feature tests (all demos):

  • Linux introspection - verify procfs plugin returns pid data per entity
  • Scripts API - list scripts, execute one, poll until completion
  • Triggers CRUD - create, list, verify, delete (moveit/turtlebot - sensor already had this)
  • Beacon discovery - sensor demo only, conditional skip when BEACON_MODE=none

Missing pre-v0.4.0 API coverage added:

  • Functions entity discovery
  • Discovery relationships (areas -> components)
  • Operations endpoint (via medkit-fault-manager)
  • Data access and configurations (moveit, turtlebot)
  • Bulk data endpoint
  • Faults listing (moveit, turtlebot)

New reusable helpers in smoke_lib.sh:

  • assert_procfs_introspection - check /apps/{id}/x-medkit-procfs
  • assert_scripts_list / assert_script_execution - scripts API lifecycle
  • assert_triggers_crud - full trigger create/list/delete/verify cycle

Sensor demo tested locally: 40/40 pass. Moveit/turtlebot use the same validated helpers.

Related Issue

closes #45

Checklist

  • Tested locally
  • README updated (if needed) - no README changes needed

Add smoke test assertions for new gateway v0.4.0 features across all 3
demos (sensor, moveit, turtlebot3):
- Linux introspection (procfs plugin data per entity)
- Scripts API (list scripts, execute, poll completion)
- Triggers CRUD (create, list, verify, delete) for moveit/turtlebot
- Beacon discovery (sensor demo, conditional on BEACON_MODE)

Fill gaps in pre-v0.4.0 API coverage:
- Functions entity discovery (all demos)
- Discovery relationships (areas -> components)
- Operations endpoint (via medkit-fault-manager)
- Data access and configurations (moveit, turtlebot)
- Bulk data endpoint (all demos)
- Faults listing (moveit, turtlebot)

Add reusable helpers to smoke_lib.sh:
- assert_procfs_introspection
- assert_scripts_list / assert_script_execution
- assert_triggers_crud

Tested against sensor_diagnostics demo: 40/40 pass.

Closes #45
Copilot AI review requested due to automatic review settings March 24, 2026 11:51
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Extends the repository’s demo smoke tests to cover Gateway v0.4.0 features and fill previously missing REST API coverage across the sensor_diagnostics, moveit_pick_place, and turtlebot3_integration demos.

Changes:

  • Adds new smoke assertions for /functions discovery, area→component relationship endpoints, procfs introspection, scripts lifecycle, and trigger CRUD.
  • Expands coverage for operations, configurations, data access, bulk-data, and faults listing endpoints (demo-dependent).
  • Introduces reusable test helpers in tests/smoke_lib.sh to standardize procfs/scripts/triggers checks.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
tests/smoke_test.sh Adds functions/relationships/procfs/scripts/operations/bulk-data checks and optional beacon discovery verification.
tests/smoke_test_moveit.sh Adds new v0.4.0 assertions (functions, relationships, procfs, scripts, triggers) plus missing endpoint coverage (operations/configurations/bulk-data/faults).
tests/smoke_test_turtlebot3.sh Adds new v0.4.0 assertions (functions, relationships, procfs, scripts, triggers) plus missing endpoint coverage (operations/configurations/bulk-data/faults).
tests/smoke_lib.sh Adds shared helpers: assert_procfs_introspection, assert_scripts_list, assert_script_execution, assert_triggers_crud.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


section "Triggers"

assert_triggers_crud "apps" "diagnostic-bridge-app" "/api/v1/apps/diagnostic-bridge-app/faults"
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The trigger CRUD test is targeting diagnostic-bridge-app and /api/v1/apps/diagnostic-bridge-app/faults, but the MoveIt demo docs describe triggers being created on the fault-producing app (manipulation-monitor) with resource /api/v1/apps/manipulation-monitor/faults. If diagnostic-bridge-app doesn’t expose a /faults collection, this will fail trigger creation (and make CI flaky). Consider switching the entity + resource to the app that actually reports faults in this demo (per demos/moveit_pick_place/README.md triggers section).

Suggested change
assert_triggers_crud "apps" "diagnostic-bridge-app" "/api/v1/apps/diagnostic-bridge-app/faults"
assert_triggers_crud "apps" "manipulation-monitor" "/api/v1/apps/manipulation-monitor/faults"

Copilot uses AI. Check for mistakes.

section "Triggers"

assert_triggers_crud "apps" "diagnostic-bridge" "/api/v1/apps/diagnostic-bridge/faults"
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This trigger CRUD test is currently using diagnostic-bridge as the trigger owner and /api/v1/apps/diagnostic-bridge/faults as the watched resource. The TurtleBot3 demo docs describe triggers on anomaly-detector watching /api/v1/apps/anomaly-detector/faults. If diagnostic-bridge isn’t the fault-producing app (or doesn’t expose /faults), trigger creation may fail in CI. Suggest aligning the trigger target/resource with the demo’s documented fault source app.

Suggested change
assert_triggers_crud "apps" "diagnostic-bridge" "/api/v1/apps/diagnostic-bridge/faults"
assert_triggers_crud "apps" "anomaly-detector" "/api/v1/apps/anomaly-detector/faults"

Copilot uses AI. Check for mistakes.
bburda added 3 commits March 24, 2026 13:26
In Gazebo-heavy demos, the fault_manager ROS 2 services take longer
to be discovered by runtime graph introspection. Use poll_until with
a 30s timeout instead of an instant assert_non_empty_items check.
Same race condition as turtlebot3 - fault_manager ROS 2 services may
not be discovered by the first runtime refresh cycle. Use poll_until
with 30s timeout consistently across all demos.
- Replace 62 lines of inline trigger CRUD in smoke_test.sh with
  assert_triggers_crud helper call (deduplication)
- Use jq -n for JSON body construction in assert_triggers_crud
  instead of bash string interpolation (safety, project convention)
- Update stale file header comments in moveit and turtlebot3 tests
  to list actual coverage (12+ feature areas, not just entity discovery)
- Update root README test descriptions to reflect expanded coverage
- Add EXIT trap for print_summary in all test scripts so gateway
  startup timeouts still produce structured output in CI
- Guard print_summary against double-printing (trap + explicit call)
… leaks

test_entity_discovery now verifies exact entity count matches expected,
not just that expected entities exist. This catches the merge pipeline
bug where runtime-created synthetic entities (underscored IDs) are not
suppressed after being linked to manifest entities (hyphenated IDs).

Also adds missing entity IDs to sensor and turtlebot3 tests so all
manifest-defined entities are checked.

Will fail CI until ros2_medkit#307 is fixed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update smoke tests for new features

2 participants