Skip to content

Commit

Permalink
Catch all errors in search tests indexing loop
Browse files Browse the repository at this point in the history
  • Loading branch information
eminano committed Nov 28, 2023
1 parent 6278e96 commit 50bff12
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 21 deletions.
8 changes: 1 addition & 7 deletions test/integration/aggregate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,14 +364,8 @@ async function waitForSearchIndexing(): Promise<void> {
return;
}
} catch (error) {
if (isHttpError(error) && String(error.status).startsWith('5')) {
throw error;
}
// do nothing
}
await new Promise((resolve) => setTimeout(resolve, 2000));
return waitForSearchIndexing();
}

function isHttpError(error: any): error is Error & { status?: number } {
return typeof error === 'object' && typeof error.status === 'number';
}
8 changes: 1 addition & 7 deletions test/integration/search.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,8 @@ async function waitForSearchIndexing(): Promise<void> {
return;
}
} catch (error) {
if (isHttpError(error) && String(error.status).startsWith('5')) {
throw error;
}
// do nothing
}
await new Promise((resolve) => setTimeout(resolve, 2000));
return waitForSearchIndexing();
}

function isHttpError(error: any): error is Error & { status?: number } {
return typeof error === 'object' && typeof error.status === 'number';
}
8 changes: 1 addition & 7 deletions test/integration/vectorSearch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,8 @@ async function waitForSearchIndexing(): Promise<void> {
return;
}
} catch (error) {
if (isHttpError(error) && String(error.status).startsWith('5')) {
throw error;
}
// do nothing
}
await new Promise((resolve) => setTimeout(resolve, 2000));
return waitForSearchIndexing();
}

function isHttpError(error: any): error is Error & { status?: number } {
return typeof error === 'object' && typeof error.status === 'number';
}

0 comments on commit 50bff12

Please sign in to comment.