test: streamline behavior coverage and parallel execution

Remove redundant contract cases and express fixtures in terms of current behavior.
Reduce isolated database migration contention, run independent scenarios concurrently,
and replace fixed waits with clock and I/O synchronization. Check absolute Redis
session expiry and wait for PostgreSQL migration session locks to be released.
Document nextest for local test execution.

Validated 4060 tests, 70 Redis ACL tests, and five repeat runs of 26 focused tests.
The 10 plugin state tests also pass 50 repeat runs with four workers.
Rustfmt and strict Clippy pass. Local full-suite execution with 16 workers falls
from 162.760s to 89.072s, excluding compilation.

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Zyy
2026-10-22 23:30:38 +08:00
co-authored by Codex
parent f7f59103a3
commit b4a5210e44
33 changed files with 454 additions and 466 deletions
+8 -1
View File
@@ -1156,9 +1156,16 @@ PostgreSQL 备份恢复属于人工维护操作。当前没有部署级维护模
```bash
cargo +1.99.1 fmt --all --manifest-path backend/Cargo.toml -- --check
RUST_MIN_STACK=16777216 cargo +1.99.1 clippy --manifest-path backend/Cargo.toml --all-targets --all-features --locked -- -D warnings
RUST_MIN_STACK=16777216 cargo +1.99.1 test --manifest-path backend/Cargo.toml --test main --locked
RUST_MIN_STACK=16777216 cargo +1.99.1 nextest run --manifest-path backend/Cargo.toml --test main --locked --no-tests fail
```
测试使用 [nextest](https://nexte.st/docs/installation/pre-built-binaries/),版本与[质量工作流](../.github/workflows/_quality.yml)一致
各 crate 的 `main` 测试入口统一构建,用例按可用 CPU 数跨 crate 并发执行
局部验证可追加 `-E 'package(=gateway-store) & test(/^redis::/)'` 等过滤条件;资源受限时用
`--test-threads 4` 限制同时运行的用例数,编译并发另由 `--build-jobs` 控制
未安装 nextest 时可使用 `cargo +1.99.1 test --manifest-path backend/Cargo.toml --test main --locked`,
同样设置 `RUST_MIN_STACK=16777216`;该入口只在单个测试二进制内并发,跨 crate 依次运行
线程栈设置与当前 CI 一致。Store 与插件 Runtime 的 PostgreSQL/Redis 集成测试需按
[本地测试库](../backend/migrations/README.md#本地测试库) 配置专用服务;未设置环境变量时,本地相关测试会跳过。
其他检查与界面验证按 [贡献与审查](../CONTRIBUTING.md#验证) 执行