Skip to content
This repository was archived by the owner on Feb 6, 2026. It is now read-only.

Commit 129d578

Browse files
committed
fixup: add some resiliency to the test failing due to 202
1 parent 0627b7c commit 129d578

1 file changed

Lines changed: 26 additions & 6 deletions

File tree

bin/si-luminork-api-tests/tests/schemas.test.ts

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,32 @@ Deno.test('Schemas API - List and Find Schemas', async () => {
233233
) {
234234
const variantId = getSchemaResponse.data.variantIds[0];
235235

236-
const getVariantResponse = await api.schemas.getSchemaVariant(
237-
config.workspaceId,
238-
changeSetId,
239-
firstSchema.schemaId,
240-
variantId,
241-
);
236+
// Retry logic for handling 202 responses
237+
let getVariantResponse;
238+
let attempts = 0;
239+
const maxAttempts = 5;
240+
const retryDelayMs = 1000; // 1 second
241+
242+
do {
243+
getVariantResponse = await api.schemas.getSchemaVariant(
244+
config.workspaceId,
245+
changeSetId,
246+
firstSchema.schemaId,
247+
variantId,
248+
);
249+
250+
if (getVariantResponse.status === 200) {
251+
break;
252+
} else if (getVariantResponse.status === 202) {
253+
attempts++;
254+
if (attempts < maxAttempts) {
255+
console.log(`Got 202 response, retrying in ${retryDelayMs}ms (attempt ${attempts}/${maxAttempts})`);
256+
await new Promise(resolve => setTimeout(resolve, retryDelayMs));
257+
}
258+
} else {
259+
break; // Exit on unexpected status codes
260+
}
261+
} while (getVariantResponse.status === 202 && attempts < maxAttempts);
242262

243263
assertEquals(getVariantResponse.status, 200);
244264
assertEquals(getVariantResponse.data.variantId, variantId);

0 commit comments

Comments
 (0)