File tree Expand file tree Collapse file tree 4 files changed +30
-33
lines changed
Expand file tree Collapse file tree 4 files changed +30
-33
lines changed Original file line number Diff line number Diff line change @@ -63,10 +63,17 @@ class BaseRunner {
6363 if ( ! previousBuildId ) {
6464 return [ ] ;
6565 }
66- const failedTests = await this . client . hGetAll ( this . retriedBuildKey ( 'error-reports' ) ) ;
67- console . log ( `[ci-queue] Failed tests` , failedTests ) ;
68- const failedTestGroups = Object . values ( failedTests ) . map ( test => JSON . parse ( test ) . test_group ) ;
69- return failedTestGroups ;
66+ try {
67+ const failedTests = await this . client . hGetAll ( this . retriedBuildKey ( 'error-reports' ) ) ;
68+ console . log ( `[ci-queue] Failed tests` , failedTests ) ;
69+ const failedTestGroups = Object . values ( failedTests ) . map ( test => JSON . parse ( test ) . test_group ) ;
70+ return failedTestGroups ;
71+ }
72+ catch ( e ) {
73+ // If the previous build is still in-progress, there may not be any failed tests
74+ console . error ( '[ci-queue] Failed to get failed test groups from previous build' , e ) ;
75+ return [ ] ;
76+ }
7077 }
7178 async waitForMaster ( ) {
7279 if ( this . isMaster ) {
Original file line number Diff line number Diff line change @@ -63,18 +63,10 @@ class Worker extends BaseRunner_1.BaseRunner {
6363 async populate ( tests , seed ) {
6464 if ( this . config . retriedBuildId ) {
6565 console . log ( `[ci-queue] Retrying failed tests for build ${ this . config . retriedBuildId } ` ) ;
66- try {
67- const failedTestGroups = await this . getFailedTestGroupsFromPreviousBuild ( ) ;
68- console . log ( `[ci-queue] Failed test groups: ${ failedTestGroups } ` ) ;
69- await this . push ( failedTestGroups ) ;
70- return ;
71- }
72- catch ( e ) {
73- // If the previous build is still in-progress, getFailedTestGroupsFromPreviousBuild will fail
74- // In this case, we want to continue processing the original tests
75- console . error ( '[ci-queue] Failed to get failed test groups from previous build' , e ) ;
76- console . log ( '[ci-queue] Continuing with original tests' ) ;
77- }
66+ const failedTestGroups = await this . getFailedTestGroupsFromPreviousBuild ( ) ;
67+ console . log ( `[ci-queue] Failed test groups: ${ failedTestGroups } ` ) ;
68+ await this . push ( failedTestGroups ) ;
69+ return ;
7870 }
7971 console . log ( `[ci-queue] Populating tests` ) ;
8072 if ( seed !== undefined ) {
Original file line number Diff line number Diff line change @@ -81,11 +81,16 @@ export class BaseRunner {
8181 return [ ] ;
8282 }
8383
84- const failedTests = await this . client . hGetAll ( this . retriedBuildKey ( 'error-reports' ) ) ;
85- console . log ( `[ci-queue] Failed tests` , failedTests ) ;
86- const failedTestGroups = Object . values ( failedTests ) . map ( test => JSON . parse ( test ) . test_group ) ;
87-
88- return failedTestGroups ;
84+ try {
85+ const failedTests = await this . client . hGetAll ( this . retriedBuildKey ( 'error-reports' ) ) ;
86+ console . log ( `[ci-queue] Failed tests` , failedTests ) ;
87+ const failedTestGroups = Object . values ( failedTests ) . map ( test => JSON . parse ( test ) . test_group ) ;
88+ return failedTestGroups ;
89+ } catch ( e ) {
90+ // If the previous build is still in-progress, there may not be any failed tests
91+ console . error ( '[ci-queue] Failed to get failed test groups from previous build' , e ) ;
92+ return [ ] ;
93+ }
8994 }
9095
9196 async waitForMaster ( ) : Promise < void > {
Original file line number Diff line number Diff line change @@ -94,20 +94,13 @@ 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- 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' ) ;
107- }
97+ const failedTestGroups = await this . getFailedTestGroupsFromPreviousBuild ( ) ;
98+ console . log ( `[ci-queue] Failed test groups: ${ failedTestGroups } ` ) ;
99+ await this . push ( failedTestGroups ) ;
100+ return ;
108101 }
109- console . log ( `[ci-queue] Populating tests` ) ;
110102
103+ console . log ( `[ci-queue] Populating tests` ) ;
111104 if ( seed !== undefined ) {
112105 tests = shuffleArray ( tests , seed ) ;
113106 }
You can’t perform that action at this time.
0 commit comments