Skip to content

Commit 6baf89f

Browse files
authored
Autoscaler e2e tests: Give better failure error when the test can't find the scaling row (#4424)
* Improve autoscaler e2e tests * Remove duplicate fail statement
1 parent 73ce075 commit 6baf89f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/test-e2e/application/application-autoscaler-e2e.spec.ts

+11
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,8 @@ describe('Autoscaler -', () => {
479479
}
480480

481481
function waitForRow() {
482+
// Timeout after 32 attempts (each 5 seconds, which is just under 3 minutes)
483+
let retries = 32;
482484
const sub = timer(5000, 5000).pipe(
483485
switchMap(() => promise.all<boolean | number>([
484486
findRow(),
@@ -492,15 +494,24 @@ describe('Autoscaler -', () => {
492494
console.log(`${moment().toString()}: Waiting for event row: Skip actions... list is refreshing`);
493495
return;
494496
}
497+
retries--;
495498
if (foundRow) {
496499
console.log(`${moment().toString()}: Waiting for event row: Found row!`);
497500
sub.unsubscribe();
498501
} else {
499502
console.log(`${moment().toString()}: Waiting for event row: manually refreshing list`);
500503
eventPageBase.list.header.refresh();
504+
if (retries === 0) {
505+
sub.unsubscribe();
506+
}
501507
}
502508
});
503509
browser.wait(() => sub.closed);
510+
// Fail the test if the retry count made it down to 0
511+
if (retries === 0) {
512+
e2e.debugLog('Timed out waiting for event row');
513+
fail('Timed out waiting for event row');
514+
}
504515
}
505516

506517
it('Go to events page', () => {

0 commit comments

Comments
 (0)