Repository navigation
TSI-4316: test(acceptance): 补齐容器入口验收脚本 - #164
Conversation
|
Sorry @multica-tsic404[bot], you've used your own review budget of 250,000 diff characters for the last 7 days. You can request another review in 21 hours and 9 minutes by commenting |
Reviewer's GuideThis PR completes the container entrypoint acceptance coverage by adding six self-gating, timeout-bounded Docker/FUSE scripts, registering them as executable acceptance cases, and wiring syntax validation and rootful execution into CI; no product code is changed. Flow diagram for container acceptance coverageflowchart TD
Registry[Acceptance registry] --> TC03[TC-container-03: stop/start retention and cache hit]
Registry --> TC04[TC-container-04: parameters and exit codes]
Registry --> TC05[TC-container-05: singleton startup exclusion]
Registry --> TC06[TC-container-06: environment and CLI precedence]
Registry --> TC07[TC-container-07: stale mount cleanup and grace period]
Registry --> TC08[TC-container-08: diagnostic stream and frozen prefix]
TC03 --> Contract[Container entrypoint contracts]
TC04 --> Contract
TC05 --> Contract
TC06 --> Contract
TC07 --> Contract
TC08 --> Contract
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
tsic404
left a comment
There was a problem hiding this comment.
规模:8 文件 / +1473 −3,全部是本单载体(tests/acceptance/tc_container_03.sh..tc_container_08.sh)+ tests/acceptance/main.rs 的 SCRIPT_FORM 登记 + .github/workflows/ci.yml 的语法检查与容器验收循环登记,无产品代码改动。
通过维度:
- 判据对应 — 六条脚本逐条对上
docs/03-acceptance.md:167-172的 TC 可观察判据与docs/02-contracts.mdC-10.1/C-10.2/C-10.3/C-10.9/C-10.10/C-10.11/C-10.12、C-5.3.1、C-4.4.1、ADR-012(设计锚点5b622b6);无「能跑通即通过」的替代判据。 - 错误类断言查退出码/errno 本身 — 后启动者 101(
tc_container_05.sh顺序档与同时档)、无效配置 1 与用法错误 2(tc_container_04.sh的expect_rc)、ENODATA(tc_container_08.sh读失败断言No data available,即 ENODATA 的文本面,与 EIO 可区分)、ENOTCONN(tc_container_07.sh宿主侧 stat)。 - 自门控 — SKIP 仅出现在能力缺失:docker、/dev/fuse、镜像构建、宿主 rshared 传播、宿主 root 恢复步骤;没有一处通过 SKIP 放宽判定或跳过断言。
- 执行证据 — CI
Docker Build (amd64)的Run acceptance container cases八条全 PASS、零 SKIP(含本机被跳过的 TC-container-07);注册表四条门禁绿。 - 安全 — 脚本仅为测具:
rm -rf目标全为mktemp自建路径,caller-supplied 宿主目录只卸挂载不删目录;容器仍以--device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor=unconfined运行,与既有tc_container_01.sh/tc_container_02.sh同构,未扩大执行面;无未引用变量导致的注入点。
点赞:tc_03 先停 seeder 再重启,用「hits 增 + misses 不变」加读耗时双重判定,堵住「有对端所以能读通」冒充缓存命中;tc_06 先跑默认路径对照(32.00 MB)再判空串场景,排除空值用例空转;tc_08 先做同形正向对照自证通道(stdout/stderr 不合并),再判冻结前缀计数 ≥ 1,并明确把事后重放排除在证据外;tc_05 顺序与同时两档都要求恰好一个赢家且赢家无 ENOTCONN。
其他审查者:无(gh pr view --json reviews 为空,无待承接的 CHANGES_REQUESTED)。
发现:1 条(💭,已就近锚定)。
容器入口此前只有首批两条脚本,状态目录跨重启、参数透传与退出码、 同宿主目录互斥、配置来源优先级、强杀残留回收与诊断单流采集都没有 可执行判定。新增六条容器载体,并登记到验收注册表与容器验收 CI 作业, 使这些行为在具备 docker 与 FUSE 的环境下可执行,能力缺失时按既有的 自门禁以 exit 2 记账而不是静默缺失覆盖面。 外部可观察变化:容器验收批次从两条扩到八条;每条脚本对判据逐项断言 (重启后种子与缓存仍在且二次读命中、参数命名的状态/日志路径生效且无 效配置退出 1 并给出原因、后启动容器退出 101 且先启动者仍可用、配置 三种来源的优先级、强杀后宿主侧 ENOTCONN 残留与记载步骤恢复、非 TTY 下按流采集冻结诊断前缀),注册表四条门禁保持通过。
388f565 to
43846c8
Compare
tsic404
left a comment
There was a problem hiding this comment.
复审(388f565..43846c8):本轮实际 diff 只有 .github/workflows/ci.yml 容器验收作业上方那段理由注释(10 行增 / 5 行删),脚本、注册表与循环逻辑逐字未变(git diff --stat 388f565 origin/multica/TSI-4316 仅该文件)。上轮唯一发现已解决:注释改为 TC-container-01..08 并列出六条覆盖面,且写清了自门禁语义(缺 /dev/fuse、CAP_SYS_ADMIN、共享宿主目录 → exit 2 → 记 SKIP warning 后 continue;其余非零退出使作业失败),与 234-242 行代码一致。
复审复核的维度(均已重新对照,非沿用上轮结论):
- 判据对应 — 六脚本仍逐条对上
docs/03-acceptance.md:167-172、docs/02-contracts.mdC-10.1/C-10.2/C-10.3/C-10.9/C-10.10/C-10.11/C-10.12、C-5.3.1、C-4.4.1 与 ADR-012(锚点tsic/torrentfs-design@5b622b6)。 - 错误类断言 — 101(顺序与同时两档)、无效配置 1 与用法 2、ENODATA(
No data available)、ENOTCONN 均查退出码或 errno 文本面。 - 自门控 — SKIP 仅出现在能力缺失;本轮注释改写没有改变任何脚本的自门控或断言。
- 执行证据 — head
43846c8的Docker Build (amd64)→Run acceptance container cases:01..08 全 PASS、零 SKIP;全量检查在该 head 上全绿。 - 安全 — 仅测具改动;
rm -rf目标全为自建临时路径,caller-supplied 宿主目录只卸挂载不删目录;容器权限参数与既有tc_container_01/02.sh同构。
其他审查者:无新增 review,无待承接的 CHANGES_REQUESTED(上轮即本账号的 REQUEST CHANGES,本轮已随之消解)。
结论:零发现,APPROVE。
说明:本机环境无宿主 rshared 传播,TC-container-07 本机为 SKIP(exit 2,自门禁);该用例在 CI 上实际执行并通过(SIGKILL residue reproduced as ENOTCONN … normal stop left no residue),故其判据已有执行证据。
Closes TSI-4316
Issue: https://multica.tsic.top/issues/TSI-4316
设计依据:
tsic/torrentfs-design@5b622b6设计实现
tests/acceptance/tc_container_03.sh:259tests/acceptance/tc_container_04.sh:156tests/acceptance/tc_container_05.sh:205tests/acceptance/tc_container_06.sh:151tests/acceptance/tc_container_07.sh:189tests/acceptance/tc_container_08.sh:106tests/acceptance/main.rs:134验证
cargo test --locked --test acceptance -- registry_tests:4 passed, 0 failed。bash -n六条脚本通过;git diff --check通过。--device /dev/fuse+SYS_ADMIN):tc_container_03.shPASS:stop/start 后种子与缓存保留,二次读 0ms,cache hits 0→32、misses 0。tc_container_04.shPASS:配置/缓存/DB/日志参数生效;无效配置 exit 1 且含原因;用法错误 exit 2。tc_container_05.shPASS:顺序与同时启动两档下后启动者 exit 101,先启动者仍可列出目录且无 ENOTCONN。tc_container_06.shPASS:默认路径 32.00 MB 生效;环境变量 64.00 MB 覆盖;空串回落 1.00 GB 默认且不读默认路径;命令行 16.00 MB 优先。tc_container_07.shSKIP(exit 2):本执行环境宿主侧 rshared 传播不可用,按自门禁记账;CI 提供 shared host dir 时执行。tc_container_08.shPASS:非 TTY 单流采集命中冻结前缀 1 次;同形正向对照通过;stdout/stderr 未合并。Summary by Sourcery
Expand container acceptance coverage for entrypoint behavior, persistence, mount lifecycle, configuration precedence, and diagnostic stream handling.
Enhancements:
CI:
Tests: