同步Admin PDA全量验收协议

This commit is contained in:
2026-09-23 18:32:23 +08:00
parent 5a6bfb2a30
commit e58f087e97
6 changed files with 21 additions and 11 deletions
@@ -56,7 +56,7 @@ async function request(context, method, path, body, headers = {}) {
const response = await fetch(`${context.options.gateway}${path}`, {
method,
headers: {
Accept: 'application/json', Authorization: `Bearer ${context.token}`,
Accept: 'application/json', Authorization: `Bearer ${context.pdaToken && /\/pda-loading\/tasks\/\d+/.test(path) ? context.pdaToken : context.token}`,
...(body === undefined ? {} : { 'Content-Type': 'application/json; charset=utf-8' }), ...headers,
},
body: body === undefined ? undefined : JSON.stringify(body), signal: AbortSignal.timeout(60_000),
@@ -568,7 +568,7 @@ export async function run(context) {
Boolean(pdaOperator?.userId), `operatorId=${id(pdaOperator?.userId) || 'missing'}`, OPTIONS)
if (!pdaOperator?.userId) return
const confirmPath = `${FIRST_LEG}/loading-plans/${planId}/confirm`
const confirmBody = Object.freeze({ expectedVersion: confirmableVersion, assigneeId: Number(pdaOperator.userId) })
const confirmBody = Object.freeze({ expectedVersion: confirmableVersion, assigneeId: id(pdaOperator.userId) })
const confirmHeaders = Object.freeze({
'Idempotency-Key': `${context.marker}-container-plan-confirm`.slice(0, 128),
})
@@ -590,7 +590,7 @@ export async function run(context) {
&& Number(confirmReplayResponse.body?.data?.version) === Number(confirmedPreload.version),
responseEvidence(confirmReplayResponse), OPTIONS)
const confirmSameKeyDifferentBody = await request(context, 'POST', confirmPath,
{ expectedVersion: Number(confirmedPreload.version) }, confirmHeaders)
{ expectedVersion: Number(confirmedPreload.version), assigneeId: id(pdaOperator.userId) }, confirmHeaders)
context.addStep(MODULE, '计划级确认同 key 异参返回冲突', confirmSameKeyDifferentBody,
confirmSameKeyDifferentBody.http === 200 && codeOf(confirmSameKeyDifferentBody) === 'A0409',
responseEvidence(confirmSameKeyDifferentBody), OPTIONS)