Files
ssw-mvp/docs/e2e/cases/TC-REL-015.mjs
T
admin 3247e9fd15 init: ssw-mvp initial commit
- boot/ (Java/Maven, JNPF 7.0) — 移除旧的 boot/.git,源码直接纳入仓库
- web/ (Vue 3 + Vite + Ant Design Vue, pnpm)
- docs/, scard/, nax/
- refs/INDEX.md + refs/国标/(其余 refs/* 开源子仓库不纳入)
- 已忽略: connector_data/, jweb/, log/, web/{dist,node_modules,.pnpm}, boot/*/target/, .DS_Store, .idea, .vscode
2026-08-05 18:29:12 +08:00

48 lines
1.7 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* TC-REL-015 · 资源耗尽时系统有保护
* REQ-Q-REL 质量特性-可靠性 正向 P1
*
* 前置:1. 系统已部署并正常运行 2. 网络及测试环境可用
* 步骤:1. 模拟磁盘/内存接近耗尽 2. 观察系统处理
* 预期:1. 系统采取相应的保护措施,不崩溃
*/
export const meta = {
tc: 'TC-REL-015',
req: 'Q-REL',
title: '资源耗尽时系统有保护',
type: '正向',
priority: 'P1',
route: '/tds/contracts',
needs: ['be']
}
export async function run(t) {
await t.step('前置:登录', async () => {
await t.login()
})
await t.step('请求巨大 payload:不应拖垮后端', async () => {
const huge = 'X'.repeat(200_000)
const r = await t.api('POST', '/api/ssw/tds/Contract', {
contractCode: huge.slice(0, 64),
name: huge.slice(0, 200)
})
t.assert(r.code !== 200, `巨大 payload 被后端拒绝(code=${r.code})`)
})
await t.step('系统仍能响应正常请求', async () => {
const r = await t.api('GET', '/api/ssw/tds/Space')
t.assert(r.code === 200, `Space 接口仍返回 200(code=${r.code})`)
await t.goto('/tds/contracts')
await t.expectVisible('.ant-table', '前端列表仍可正常加载')
})
t.manual(`补充人工核对:
1. 用 stress-ng --vm 2 --vm-bytes 90% --timeout 60s 压满测试机内存;
2. 用 dd if=/dev/zero of=/tmp/bigfile bs=1G count=10 填满磁盘至 95%;
3. 重新发起 /api/ssw/tds/Space 等关键请求;
4. 核对:
- 后端是否有连接池/磁盘写入限流(错误码非 200 但应明确提示资源不足);
- 服务进程未 OOM Killed(docker/k8s 日志);
- 磁盘释放后自动恢复。`)
}