Skip to content
This repository has been archived by the owner on Jan 24, 2023. It is now read-only.

Commit

Permalink
Autoscaler e2e tests: Give better failure error when the test can't f…
Browse files Browse the repository at this point in the history
…ind the scaling row (#4424)

* Improve autoscaler e2e tests

* Remove duplicate fail statement
  • Loading branch information
nwmac committed Jul 10, 2020
1 parent 73ce075 commit 6baf89f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/test-e2e/application/application-autoscaler-e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,8 @@ describe('Autoscaler -', () => {
}

function waitForRow() {
// Timeout after 32 attempts (each 5 seconds, which is just under 3 minutes)
let retries = 32;
const sub = timer(5000, 5000).pipe(
switchMap(() => promise.all<boolean | number>([
findRow(),
Expand All @@ -492,15 +494,24 @@ describe('Autoscaler -', () => {
console.log(`${moment().toString()}: Waiting for event row: Skip actions... list is refreshing`);
return;
}
retries--;
if (foundRow) {
console.log(`${moment().toString()}: Waiting for event row: Found row!`);
sub.unsubscribe();
} else {
console.log(`${moment().toString()}: Waiting for event row: manually refreshing list`);
eventPageBase.list.header.refresh();
if (retries === 0) {
sub.unsubscribe();
}
}
});
browser.wait(() => sub.closed);
// Fail the test if the retry count made it down to 0
if (retries === 0) {
e2e.debugLog('Timed out waiting for event row');
fail('Timed out waiting for event row');
}
}

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

0 comments on commit 6baf89f

Please sign in to comment.