test: wait for customer dimension initialization
This commit is contained in:
@@ -9,6 +9,23 @@ function id(value) {
|
||||
return value === undefined || value === null ? '' : String(value)
|
||||
}
|
||||
|
||||
async function waitForDimensionInitialization(context, tenantId) {
|
||||
let response = null
|
||||
let status = 'PENDING'
|
||||
let attempt = 0
|
||||
for (; attempt < 30; attempt += 1) {
|
||||
response = await context.request('GET',
|
||||
`/api/platform/v1/iam/tenants/${encodeURIComponent(tenantId)}/dimension-initialization`)
|
||||
status = response.http === 200 && String(response.body?.code) === '200'
|
||||
? response.body?.data?.status : 'REQUEST_FAILED'
|
||||
if (status === 'READY' || status === 'FAILED') break
|
||||
await new Promise((resolve) => setTimeout(resolve, 500))
|
||||
}
|
||||
context.assert(MODULE, '客户默认尺寸后台初始化已就绪', response, status === 'READY',
|
||||
`tenantId=${tenantId}, status=${status}, attempts=${attempt + 1}`, { deploymentBlocker: true })
|
||||
if (status !== 'READY') throw new Error(`客户默认尺寸初始化未就绪: ${status}`)
|
||||
}
|
||||
|
||||
export async function run(context) {
|
||||
const suffix = context.marker.replace(/[^0-9A-Z]/gi, '').slice(-10).padStart(10, '0')
|
||||
const phone = await context.findAvailablePhone(MODULE)
|
||||
@@ -63,6 +80,8 @@ export async function run(context) {
|
||||
`tenantId=${tenantId}, reviewId=${id(review?.id) || 'missing'}`, { deploymentBlocker: true })
|
||||
if (!review?.id) throw new Error('未找到隔离下单客户的待审核单')
|
||||
|
||||
await waitForDimensionInitialization(context, tenantId)
|
||||
|
||||
const approveResponse = await context.request('POST',
|
||||
`/api/platform/v1/iam/reviews/${encodeURIComponent(review.id)}/approve`,
|
||||
{ comment: `${context.marker} 全量验收正式资质审核通过` })
|
||||
|
||||
Reference in New Issue
Block a user