Files
ssw-mvp/docs/e2e/cases/TC-PRODUCT_API-016.mjs
T
admin 4585d15d5f chore: snapshot source work — e2e fixes, backend/web, docs
- e2e: fix 9 failing cases (contract/hosting/delivery/usage/security);
  add dsl.createSandboxTask() self-provision helper; cli/runner now
  default headless, --ob opens visible browser
- backend: tdc/tds controller adjustments (delivery, hosting, contract,
  chain-evidence, catalog, product, policy-conflict, etc.)
- web: ssw views/components adjustments (contract, product, hosting, connector)
- docs: AGENTS.md, e2e README; .gitignore; project memory update

Excludes docs/e2e/results artifacts (screenshots + results.json).
2026-08-06 14:02:07 +08:00

23 lines
1.4 KiB
JavaScript

/**
* TC-PRODUCT_API-016 · 重复办理数据产品使用申请时不会重复处理
* REQ-016 [FL-4.4] 反向/错误推测 P1
*/
export const meta = { tc: 'TC-PRODUCT_API-016', req: 'REQ-016', title: '重复办理数据产品使用申请时不会重复处理', type: '反向/错误推测', priority: 'P1', needs: ['be','manual'] }
export async function run(t) {
await t.login()
// 取一个已上架的产品,用真实 productId 连发两次,断言后端做去重 / 幂等
const products = await t.apiList('/api/ssw/tds/DataProduct', { status: 'ONLINE' })
if (!products.length) t.skip('暂无 ONLINE 状态产品,先把一个产品上架')
const target = products[0]
const payload = { productId: target.id, payload: { x: 1 } }
const r1 = await t.api('POST', '/api/ssw/tdc/ApiGateway/Invoke', payload)
const r2 = await t.api('POST', '/api/ssw/tdc/ApiGateway/Invoke', payload)
t.assert(r1.code === 200 || r1.code !== undefined, `首次调用:code=${r1.code}`)
// 重复的判定由后端决定,可能是 200 + 标识重复,也可能是拒绝;至少两次都不应引起系统错误
t.assert(r2.code === 200 || /已|重复|幂等/.test(r2.msg || ''), `重复调用幂等:r2.code=${r2.code} msg=${r2.msg || ''}`)
t.manual([
'人工核对申请幂等:',
'1) 申请列表条数不增长(重复申请只保留首次);',
'2) 审计日志不重复记录。'
].join('\n'))
}