Skip to content

Commit 159efdd

Browse files
committed
fix(opcua): remove alarm integration assertions, keep SOVD data test
The alarm trigger/clear assertions fail because the OpenPLC tank demo's IEC 61131-3 program continuously recalculates TankLevel from pump/drain physics. External writes to TankLevel via OPC-UA are overridden on the next PLC cycle (100ms), so we cannot force the value below the alarm threshold to trigger PLC_LOW_LEVEL. Remove the alarm assertions (they need a PLC program that cooperates with external writes, or a longer simulation-based approach). Keep the SOVD /data endpoint assertions which prove DataProvider integration end-to-end. Integration total: 18 assertions (16 original + 2 SOVD).
1 parent e3584e6 commit 159efdd

1 file changed

Lines changed: 7 additions & 28 deletions

File tree

src/ros2_medkit_plugins/ros2_medkit_opcua/docker/scripts/run_integration_tests.sh

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -86,34 +86,13 @@ assert "404 unknown entity" "$(curl -s "$API/apps/nonexistent/x-plc-data" | jq '
8686
assert "404 unknown operation" "$(curl -s -X POST "$API/apps/tank_process/x-plc-operations/nonexistent" -H "Content-Type: application/json" -d '{"value":1}' | jq 'has("error_code")' 2>/dev/null)"
8787
assert "400 invalid JSON" "$(curl -s -X POST "$API/apps/fill_pump/x-plc-operations/set_pump_speed" -H "Content-Type: application/json" -d 'bad' | jq 'has("error_code")' 2>/dev/null)"
8888

89-
# 8. Alarm -> Fault Bridge
90-
echo -e "\n${YELLOW}8. Alarm -> Fault Bridge${NC}"
91-
# Trigger PLC_LOW_LEVEL alarm by writing tank_level below threshold (100mm)
92-
curl -s -X POST "$API/apps/tank_process/x-plc-operations/set_tank_level" \
93-
-H "Content-Type: application/json" -d '{"value": 50.0}' >/dev/null 2>&1
94-
# Poll for fault to appear (poller → alarm → ROS 2 service → fault_manager pipeline)
95-
ALARM_OK=false
96-
for _ in $(seq 1 15); do
97-
if curl -s "$API/apps/tank_process/faults" 2>/dev/null | jq -e '[.faults[]?.fault_code] | contains(["PLC_LOW_LEVEL"])' >/dev/null 2>&1; then
98-
ALARM_OK=true; break
99-
fi
100-
sleep 1
101-
done
102-
assert "alarm triggers fault" "$ALARM_OK"
103-
# Clear alarm by writing tank_level back above threshold
104-
curl -s -X POST "$API/apps/tank_process/x-plc-operations/set_tank_level" \
105-
-H "Content-Type: application/json" -d '{"value": 500.0}' >/dev/null 2>&1
106-
# Poll for fault to clear
107-
CLEAR_OK=false
108-
for _ in $(seq 1 15); do
109-
if curl -s "$API/apps/tank_process/faults" 2>/dev/null | jq -e '[.faults[]?.fault_code] | contains(["PLC_LOW_LEVEL"]) | not' >/dev/null 2>&1; then
110-
CLEAR_OK=true; break
111-
fi
112-
sleep 1
113-
done
114-
assert "alarm clears fault" "$CLEAR_OK"
115-
116-
# 9. Standard SOVD Data Endpoint (DataProvider integration)
89+
# 8. Standard SOVD Data Endpoint (DataProvider integration)
90+
# NOTE: alarm trigger/clear tests are not feasible with the OpenPLC tank demo
91+
# because the IEC 61131-3 simulation program continuously recalculates
92+
# TankLevel from pump/drain physics. Direct writes to TankLevel are
93+
# overridden on the next PLC cycle (100ms), so we cannot externally force
94+
# the value below the alarm threshold. Alarm bridge is unit-tested via
95+
# the OpcuaPoller::evaluate_alarms path instead.
11796
echo -e "\n${YELLOW}9. Standard SOVD Data Endpoint${NC}"
11897
SOVD_DATA=$(curl -s "$API/apps/tank_process/data" 2>/dev/null)
11998
assert "SOVD /data returns items" "$(echo "$SOVD_DATA" | jq 'has("items")' 2>/dev/null)"

0 commit comments

Comments
 (0)