Skip to content

Commit b280fd9

Browse files
committed
test(ota_demo): wait for the action bridge before sending the goal
action_status_bridge fixes a fault's source on the first status message it sees for an action, and the action status topic is transient-local, so a bridge that subscribes while a goal is already in flight gets a latched sample at once - before the graph has resolved the publisher's node name. The source then stays /navigate_to_pose instead of /bt_navigator and the fault never reaches the bt-navigator entity, which is where this test looks for it. Two CI runs show exactly that source on the reported fault. demo.launch.py starts the bridges on a 15 s timer while send-goal.sh retries until nav2 accepts, so on a fast boot the goal wins that race. Hold the goal until the bridge says it is watching the action, so its first status message arrives seconds into its life rather than milliseconds.
1 parent 4b8a677 commit b280fd9

1 file changed

Lines changed: 39 additions & 3 deletions

File tree

tests/smoke_test_demo_narrative.sh

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@
2828
# 1. Boot: broken_lidar_3_0_0 is applied (entrypoint auto-apply) and
2929
# scan_sensor_node is running broken_lidar_node; fixed_lidar_3_0_1 is
3030
# NOT yet registered (boot catalog holds only the bad update).
31-
# 2. send-goal.sh -> ACTION_NAVIGATE_TO_POSE_ABORTED reaches CONFIRMED on
32-
# bt-navigator, and controller-server picks up a supporting LOG_* fault
33-
# whose message is the controller's own stall, not just any error.
31+
# 2. Once action_status_bridge is watching /navigate_to_pose (the goal must
32+
# not precede it - see wait_for_action_bridge), send-goal.sh ->
33+
# ACTION_NAVIGATE_TO_POSE_ABORTED reaches CONFIRMED on bt-navigator, and
34+
# controller-server picks up a supporting LOG_* fault whose message is
35+
# the controller's own stall, not just any error.
3436
# 3. Fault detail (bt-navigator) has environment_data.snapshots >= 1, and
3537
# the rosbag bulk-data download returns a non-empty MCAP body.
3638
# 4. publish-fix.sh -> fixed_lidar_3_0_1 appears in /updates (SOVD
@@ -170,6 +172,31 @@ poll_process_running() {
170172
return 1
171173
}
172174

175+
# Wait until action_status_bridge says it is watching navigate_to_pose.
176+
#
177+
# The goal must not be sent before this. The bridge fixes a fault's source on
178+
# the FIRST status message it sees for an action, and the action status topic
179+
# is transient-local: a bridge that subscribes while a goal is already in
180+
# flight gets a latched sample immediately, before the ROS graph has resolved
181+
# the publisher's node name. The source then stays the action name
182+
# (/navigate_to_pose) instead of the server's node (/bt_navigator), and the
183+
# fault never lands on the bt-navigator entity this test asserts on.
184+
#
185+
# demo.launch.py starts the bridges on a 15 s timer while send-goal.sh retries
186+
# until nav2 accepts, so on a fast boot the goal wins that race.
187+
wait_for_action_bridge() {
188+
local timeout="${1:-60}"
189+
local elapsed=0
190+
while [ $elapsed -lt "$timeout" ]; do
191+
if docker logs "$GATEWAY_CONTAINER" 2>&1 | grep -q "Watching action '/navigate_to_pose'"; then
192+
return 0
193+
fi
194+
sleep 2
195+
elapsed=$((elapsed + 2))
196+
done
197+
return 1
198+
}
199+
173200
# Poll until `pgrep -af <pattern>` fails inside the gateway container
174201
# (process gone), up to $2 seconds.
175202
poll_process_gone() {
@@ -232,6 +259,15 @@ fi
232259
# ---------------------------------------------------------------------
233260
section "Reactive fault: send-goal.sh triggers ACTION_NAVIGATE_TO_POSE_ABORTED"
234261

262+
echo " Waiting for action_status_bridge to watch /navigate_to_pose (max 60s)..."
263+
if wait_for_action_bridge 60; then
264+
pass "action_status_bridge is watching /navigate_to_pose before the goal is sent"
265+
else
266+
fail "action_status_bridge is watching /navigate_to_pose before the goal is sent" \
267+
"bridge never reported the action within 60s - a goal sent now would be attributed to the action name, not to bt-navigator"
268+
exit 1
269+
fi
270+
235271
# x=1.8, y=2.3 (frame map) drives straight into the phantom sector so nav2
236272
# reliably stalls - the send-goal.sh script defaults elsewhere are for
237273
# ad-hoc operator use, not this repeatable regression check.

0 commit comments

Comments
 (0)