Skip to content

Commit 789e013

Browse files
authored
Handle errors when getting failed test groups from previous build (#17)
1 parent bb02822 commit 789e013

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

javascript/src/queue/Worker.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,23 @@ export class Worker extends BaseRunner {
9494
async populate(tests: string[], seed?: number) {
9595
if (this.config.retriedBuildId) {
9696
console.log(`[ci-queue] Retrying failed tests for build ${this.config.retriedBuildId}`);
97-
const failedTestGroups = await this.getFailedTestGroupsFromPreviousBuild();
98-
console.log(`[ci-queue] Failed test groups: ${failedTestGroups}`);
99-
await this.push(failedTestGroups);
100-
} else {
101-
if (seed !== undefined) {
102-
tests = shuffleArray(tests, seed);
97+
try {
98+
const failedTestGroups = await this.getFailedTestGroupsFromPreviousBuild();
99+
console.log(`[ci-queue] Failed test groups: ${failedTestGroups}`);
100+
await this.push(failedTestGroups);
101+
return;
102+
} catch (e) {
103+
// If the previous build is still in-progress, getFailedTestGroupsFromPreviousBuild will fail
104+
// In this case, we want to continue processing the original tests
105+
console.error('[ci-queue] Failed to get failed test groups from previous build', e);
106+
console.log('[ci-queue] Continuing with original tests');
103107
}
104-
await this.push(tests);
105-
}
108+
}
109+
110+
if (seed !== undefined) {
111+
tests = shuffleArray(tests, seed);
112+
}
113+
await this.push(tests);
106114
}
107115

108116
shutdown() {

0 commit comments

Comments
 (0)