Skip to content

Commit 1ce6015

Browse files
committed
test(smoke): wait for opcua_bridge subscription before PLC inject
Smoke flaked on CI: inject-photoeye-flicker fired ~540 ms before the opcua_bridge completed its AlarmConditionType subscription handshake with plc-sim. The OPC UA raise event then had no listener, the bridge caught only the later clear events from restore-line, and the MANYMOVE_PLC_PHOTOEYE_FLICKER fault never made it to FaultManager. Poll the bridge container logs for 'subscribed to AlarmConditionType events' before the inject, plus a 1s margin for the asyncua handshake to complete on the plc-sim side.
1 parent 6ebe454 commit 1ce6015

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

tests/smoke_test_manymove_industrial.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,29 @@ if api_get "/components"; then
8181
fi
8282
fi
8383

84+
# Wait for opcua_bridge to actually subscribe to AlarmConditionType
85+
# events before injecting. Container manifest discovery (above) only
86+
# proves the gateway routed the component, not that the asyncua
87+
# subscription handshake on plc-sim completed. Without this wait the
88+
# inject can fire 100-500ms before bridge is ready, the OPC UA raise
89+
# event goes unheard and the test flakes.
90+
BRIDGE_LOGS=""
91+
for _ in $(seq 1 20); do
92+
BRIDGE_LOGS=$(docker logs manymove_industrial-opcua-bridge-1 2>&1 || true)
93+
if echo "$BRIDGE_LOGS" | grep -q "subscribed to AlarmConditionType events"; then
94+
pass "opcua_bridge subscribed to AlarmConditionType events"
95+
break
96+
fi
97+
sleep 1
98+
done
99+
if ! echo "$BRIDGE_LOGS" | grep -q "subscribed to AlarmConditionType events"; then
100+
fail "opcua_bridge never subscribed to AlarmConditionType events"
101+
fi
102+
# Belt-and-suspenders: small extra delay so subscription is fully active
103+
# on the plc-sim side too (asyncua handshake completes ~50-200ms after
104+
# the bridge logs the subscribe call).
105+
sleep 1
106+
84107
# Photoeye flicker injection -> MANYMOVE_PLC_PHOTOEYE_FLICKER (WARN)
85108
if curl -fsS -X POST -H "Content-Type: application/json" -d "$EXEC_BODY" \
86109
"$API_BASE/components/conveyor-line/scripts/inject-photoeye-flicker/executions" >/dev/null; then

0 commit comments

Comments
 (0)