完成单机TEST统一入口与可靠投递回归收尾
This commit is contained in:
@@ -20,7 +20,7 @@ function blocker(context, name, reason, response = null) {
|
||||
}
|
||||
|
||||
async function overseas(context, method, name, path, body, headers = {}) {
|
||||
const response = await context.requestOverseas(method, path, body, headers)
|
||||
const response = await context.request(method, path, body, undefined, headers)
|
||||
const data = context.apiSuccess(MODULE, name, response, trace(response), OPTIONS)
|
||||
return { response, data }
|
||||
}
|
||||
@@ -147,8 +147,7 @@ async function createApprove(context, definition, fixture, index) {
|
||||
id(replay.data?.sourceFeeId) === sourceFeeId && Number(replay.data?.sourceVersion) === 1,
|
||||
trace(replay.response), OPTIONS)
|
||||
if (index === 0) {
|
||||
const mismatch = await context.requestOverseas('POST', LASTLEG_BASE,
|
||||
{ ...payload, amount: payload.amount + 1 }, { 'Idempotency-Key': key })
|
||||
const mismatch = await context.request('POST', LASTLEG_BASE, { ...payload, amount: payload.amount + 1 }, undefined, { 'Idempotency-Key': key })
|
||||
context.addStep(MODULE, '费用创建同键异载荷冲突', mismatch, conflict(mismatch), trace(mismatch), OPTIONS)
|
||||
}
|
||||
|
||||
@@ -189,8 +188,7 @@ async function verifyCustomerIsolation(context, fixtures, source) {
|
||||
`otherCustomerId=${id(other.id)}, leaked=${rows(wrongList.data).some((item) => id(item?.sourceFeeId) === source.sourceFeeId)}; ${trace(wrongList.response)}`, OPTIONS)
|
||||
if (source.payload.businessId) {
|
||||
const wrongPayload = { ...source.payload, customerId: id(other.id), customerName: other.tenantName || other.name || 'other' }
|
||||
const wrong = await context.requestOverseas('POST', LASTLEG_BASE, wrongPayload,
|
||||
{ 'Idempotency-Key': `${context.marker}-wrong-customer-fee`.slice(0, 128) })
|
||||
const wrong = await context.request('POST', LASTLEG_BASE, wrongPayload, undefined, { 'Idempotency-Key': `${context.marker}-wrong-customer-fee`.slice(0, 128) })
|
||||
context.addStep(MODULE, '其他客户不能关联本客户业务创建费用', wrong, rejected(wrong), trace(wrong), OPTIONS)
|
||||
}
|
||||
}
|
||||
@@ -205,7 +203,7 @@ async function verifyFinanceDelivery(context, sources) {
|
||||
&& id(item?.sourceFeeId) === source.sourceFeeId)
|
||||
return { response, found }
|
||||
}, (value) => success(value?.response) && Boolean(value?.found))
|
||||
context.assert(MODULE, `${source.definition.label}费用经跨区链进入 Finance`, delivered.result?.response,
|
||||
context.assert(MODULE, `${source.definition.label}费用经业务Outbox直接投递进入 Finance`, delivered.result?.response,
|
||||
Boolean(delivered.result?.found)
|
||||
&& id(delivered.result.found.customerId) === id(source.customerId)
|
||||
&& delivered.result.found.sourceType === source.definition.sourceType,
|
||||
@@ -213,15 +211,10 @@ async function verifyFinanceDelivery(context, sources) {
|
||||
}
|
||||
}
|
||||
|
||||
async function verifyBridgeCapabilities(context) {
|
||||
const domestic = await context.request('GET', '/internal/event-bridge/status')
|
||||
context.addStep(MODULE, '国内 Event Bridge HTTP 能力状态可观察', domestic,
|
||||
(success(domestic) && String(domestic.body?.data?.region).toUpperCase() === 'CN') || domestic.http === 404,
|
||||
`${domestic.http === 404 ? 'internal endpoint is intentionally not exposed by public gateway; ' : ''}${trace(domestic)}`, OPTIONS)
|
||||
const overseas = await context.requestOverseas('GET', '/internal/event-bridge/status')
|
||||
context.addStep(MODULE, '海外 Event Bridge HTTP 能力状态可观察', overseas,
|
||||
(success(overseas) && String(overseas.body?.data?.region).toUpperCase() === 'OVERSEAS') || overseas.http === 404,
|
||||
`${overseas.http === 404 ? 'internal endpoint is intentionally not exposed by public gateway; ' : ''}${trace(overseas)}`, OPTIONS)
|
||||
async function verifyInternalBoundary(context) {
|
||||
const response = await context.request('GET', '/internal/finance/event-operations/outbox')
|
||||
context.assert(MODULE, '统一Gateway不公开内部事件运维接口', response,
|
||||
[401, 403, 404].includes(response.http), trace(response), OPTIONS)
|
||||
}
|
||||
|
||||
export async function run(context) {
|
||||
@@ -251,7 +244,7 @@ export async function run(context) {
|
||||
`sourceFeeId=${warehouseSource?.sourceFeeId || 'missing'}, warehouseId=${warehouseSource?.payload?.warehouseId || 'missing'}`, OPTIONS)
|
||||
await verifyCustomerIsolation(context, fixtures, sources.find((item) => item.payload.businessId))
|
||||
await verifyFinanceDelivery(context, sources)
|
||||
await verifyBridgeCapabilities(context)
|
||||
await verifyInternalBoundary(context)
|
||||
context.createdResources.phase4OverseasFinanceCrossRegion = {
|
||||
marker: context.marker,
|
||||
sources: sources.map((item) => ({ sourceFeeId: item.sourceFeeId, customerId: item.customerId,
|
||||
|
||||
Reference in New Issue
Block a user