Repository navigation
test(e2e): verify real venue controls - #10
Conversation
|
Yuki Tanaka · reviewer The offline step asserts the hub never saw 离线那一步断言 hub 从没收到 |
|
Noah Williams · author From 来自 |
|
Ingrid Larsen · reviewer In the fake-gate run, is the alert assertion relying on 在假闸机的测试里,那条提示的断言是不是依赖 |
|
Noah Williams · author Yes. Without the Compose project the power action fails, either because no container matches or because no Docker socket is reachable. Either way the bridge sends an 是的。没有 Compose 项目时,电源操作一定会失败:要么找不到匹配的容器,要么连不上 Docker socket。无论哪种情况,bridge 都会发送 |
Why
The power and network buttons had only been checked against a fake Docker API. They need an end-to-end check against real containers and a real hub, and the page should show a failed Docker action instead of swallowing it.
What changed
scripts/real-controls.mjs: connects to the bridge WebSocket and, against a running entrance, unplugs Gate 2 and checks withdocker inspectthat it leftgatepost-sim-devices_venue, scansGP-000000000020and requires a local green decision with the network LED off, and asserts that the hub logs never show that scan. It then plugs Gate 2 back in, scans fresh tickets until the network LED comes back on (dumping gate, hub and bridge logs if it does not), cuts and restores Gate 3's power, waits for its device connections, and requires no bridge errors.scripts/e2e-gatepost.sh controls: refuses to run while an entrance is active, starts one withGATEPOST_REF, runsreal-controls.mjs, shuts it down, and fails if any container remains.scripts/hub-proxy.pyprints each forwarded request, which the controls check reads from the hub logs.scripts/bridge-entrypoint.shexecutable so the imageENTRYPOINTcan start.e2e/entrance.spec.ts: with fake gates there is no Compose container, soCut powermust show anError:alert while the lane still offersCut power.web/src/main.tsx: the header showsDocker: available,unavailableorcheckingwith the full message as a tooltip, next to the bridge state; the e2e test checks the short text.controlsmode, the entrypoint's socket group handling, thedockerfield in snapshots, and how to choose the Gate 3 revisions forscripts/screenshots.sh.How to verify
With Docker and a Gatepost checkout at
../gatepostthat has the hub client:The script prints a
PASSline for each step, ending withPASS no bridge action errors, and exits non-zero if any container is left.背景
电源和网络按钮之前只针对模拟的 Docker API 测过,需要对真实容器和真实 hub 做一次端到端检查;页面也应该把失败的 Docker 操作显示出来,而不是悄无声息。
改动
scripts/real-controls.mjs:连接 bridge 的 WebSocket,针对运行中的入口执行:拔掉 Gate 2 的网线,并用docker inspect确认它已离开gatepost-sim-devices_venue;扫GP-000000000020,要求网络灯熄灭时由闸机在本地给出绿灯;并断言 hub 日志里没有出现这次扫码。随后重新接入 Gate 2,换新票连续扫码,直到网络灯重新亮起(一直不亮就输出闸机、hub 和 bridge 的日志);接着切断再恢复 Gate 3 的电源,等它的设备连接恢复;最后要求 bridge 没有报错。scripts/e2e-gatepost.sh controls:已有入口在运行时拒绝执行;否则用GATEPOST_REF启动入口,运行real-controls.mjs,关闭入口,如有容器残留则报错。scripts/hub-proxy.py打印每一条转发的请求,controls 检查就是从 hub 日志里读这些内容。scripts/bridge-entrypoint.sh加上可执行权限,镜像的ENTRYPOINT才能启动。e2e/entrance.spec.ts:用假闸机时没有 Compose 容器,所以点击Cut power后必须出现含Error:的提示,而通道上仍显示Cut power。web/src/main.tsx:页头在 bridge 状态旁显示Docker: available、unavailable或checking,完整信息放在悬停提示里;e2e 测试检查这段简短文字。controls模式、入口脚本如何处理 socket 的组、快照中的docker字段,以及如何为scripts/screenshots.sh选择 Gate 3 的两个版本。怎么验证
安装 Docker,并在
../gatepost准备带 hub 客户端的 Gatepost 检出:脚本每完成一步打印一行
PASS,最后一行是PASS no bridge action errors;如有容器残留,以非零状态退出。