Skip to content

Commit 2fc42b9

Browse files
authored
Return status of populate (#22)
1 parent 74c04c5 commit 2fc42b9

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

javascript/dist/queue/Worker.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export declare class Worker extends BaseRunner {
99
acknowledge(test: string): Promise<boolean>;
1010
requeue(test: string, offset?: number): Promise<boolean>;
1111
release(): Promise<void>;
12-
populate(tests: string[], seed?: number): Promise<void>;
12+
populate(tests: string[], seed?: number): Promise<boolean>;
1313
shutdown(): void;
1414
private throwOnMismatchingTest;
1515
private reserveTest;

javascript/dist/queue/Worker.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,20 @@ class Worker extends BaseRunner_1.BaseRunner {
6464
if (this.config.retriedBuildId) {
6565
console.log(`[ci-queue] Retrying failed tests for build ${this.config.retriedBuildId}`);
6666
const failedTestGroups = await this.getFailedTestGroupsFromPreviousBuild();
67+
if (failedTestGroups.length === 0) {
68+
console.log(`[ci-queue] No failed tests found for build ${this.config.retriedBuildId}`);
69+
return false;
70+
}
6771
console.log(`[ci-queue] Failed test groups: ${failedTestGroups}`);
6872
await this.push(failedTestGroups);
69-
return;
73+
return true;
7074
}
7175
console.log(`[ci-queue] Populating tests`);
7276
if (seed !== undefined) {
7377
tests = (0, utils_1.shuffleArray)(tests, seed);
7478
}
7579
await this.push(tests);
80+
return true;
7681
}
7782
shutdown() {
7883
this.shutdownRequired = true;

javascript/src/queue/Worker.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,20 +91,25 @@ export class Worker extends BaseRunner {
9191
);
9292
}
9393

94-
async populate(tests: string[], seed?: number) {
94+
async populate(tests: string[], seed?: number): Promise<boolean> {
9595
if (this.config.retriedBuildId) {
9696
console.log(`[ci-queue] Retrying failed tests for build ${this.config.retriedBuildId}`);
9797
const failedTestGroups = await this.getFailedTestGroupsFromPreviousBuild();
98+
if (failedTestGroups.length === 0) {
99+
console.log(`[ci-queue] No failed tests found for build ${this.config.retriedBuildId}`);
100+
return false;
101+
}
98102
console.log(`[ci-queue] Failed test groups: ${failedTestGroups}`);
99103
await this.push(failedTestGroups);
100-
return;
104+
return true;
101105
}
102106

103107
console.log(`[ci-queue] Populating tests`);
104108
if (seed !== undefined) {
105109
tests = shuffleArray(tests, seed);
106110
}
107111
await this.push(tests);
112+
return true;
108113
}
109114

110115
shutdown() {

0 commit comments

Comments
 (0)