Merge pull request #2468 from spotify/rugvip/e2etry

e2e-test: add retries to app serve
This commit is contained in:
Patrik Oldsberg
2020-09-16 11:40:22 +02:00
committed by GitHub
+20 -11
View File
@@ -277,19 +277,28 @@ async function testAppServe(pluginName: string, appDir: string) {
let successful = false;
try {
const browser = new Browser();
for (let attempts = 1; ; attempts++) {
try {
const browser = new Browser();
await waitForPageWithText(browser, '/', 'Backstage Service Catalog');
await waitForPageWithText(
browser,
`/${pluginName}`,
`Welcome to ${pluginName}!`,
);
await waitForPageWithText(browser, '/', 'Backstage Service Catalog');
await waitForPageWithText(
browser,
`/${pluginName}`,
`Welcome to ${pluginName}!`,
);
print('Both App and Plugin loaded correctly');
successful = true;
} catch (error) {
throw new Error(`App serve test failed, ${error}`);
print('Both App and Plugin loaded correctly');
successful = true;
break;
} catch (error) {
if (attempts >= 5) {
throw new Error(`App serve test failed, ${error}`);
}
console.log(`App serve failed, trying again, ${error}`);
await new Promise(resolve => setTimeout(resolve, 1000));
}
}
} finally {
// Kill entire process group, otherwise we'll end up with hanging serve processes
killTree(startApp.pid);