diff --git a/.github/workflows/run-api-test.yml b/.github/workflows/run-api-test.yml index c67000b14e..9265a95bdc 100644 --- a/.github/workflows/run-api-test.yml +++ b/.github/workflows/run-api-test.yml @@ -220,7 +220,7 @@ jobs: runs-on: ubuntu-latest needs: - api-test - # - luminork-api-test + - luminork-api-test environment: ${{ inputs.environment }} if: failure() steps: diff --git a/bin/si-luminork-api-tests/tests/schemas.test.ts b/bin/si-luminork-api-tests/tests/schemas.test.ts index 726b2d7a60..cd9beb7b06 100644 --- a/bin/si-luminork-api-tests/tests/schemas.test.ts +++ b/bin/si-luminork-api-tests/tests/schemas.test.ts @@ -233,12 +233,32 @@ Deno.test('Schemas API - List and Find Schemas', async () => { ) { const variantId = getSchemaResponse.data.variantIds[0]; - const getVariantResponse = await api.schemas.getSchemaVariant( - config.workspaceId, - changeSetId, - firstSchema.schemaId, - variantId, - ); + // Retry logic for handling 202 responses + let getVariantResponse; + let attempts = 0; + const maxAttempts = 5; + const retryDelayMs = 1000; // 1 second + + do { + getVariantResponse = await api.schemas.getSchemaVariant( + config.workspaceId, + changeSetId, + firstSchema.schemaId, + variantId, + ); + + if (getVariantResponse.status === 200) { + break; + } else if (getVariantResponse.status === 202) { + attempts++; + if (attempts < maxAttempts) { + console.log(`Got 202 response, retrying in ${retryDelayMs}ms (attempt ${attempts}/${maxAttempts})`); + await new Promise(resolve => setTimeout(resolve, retryDelayMs)); + } + } else { + break; // Exit on unexpected status codes + } + } while (getVariantResponse.status === 202 && attempts < maxAttempts); assertEquals(getVariantResponse.status, 200); assertEquals(getVariantResponse.data.variantId, variantId);