Fix Helm repository and pod logs integration tests

Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
Lauri Nevala committed 2021-01-25 15:10:21 +02:00
1 parent 9da349ce42
commit aaff71e0b0
2 files changed
+51 -9

No files matched your search

+19
View File
@@ -1,4 +1,6 @@
import { Application } from "spectron";
import * as util from "util";
import { exec } from "child_process";
const AppPaths: Partial<Record<NodeJS.Platform, string>> = {
"win32": "./dist/win-unpacked/Lens.exe",
@@ -27,6 +29,7 @@ export function setup(): Application {
}
type AsyncPidGetter = () => Promise<number>;
export const promiseExec = util.promisify(exec);
export async function tearDown(app: Application) {
const pid = await (app.mainProcess.pid as any as AsyncPidGetter)();
@@ -39,3 +42,19 @@ export async function tearDown(app: Application) {
console.error(e);
}
}
export async function listHelmRepositories(retries = 0): Promise<string> {
if (retries < 5) {
try {
const { stdout: reposJson } = await promiseExec("helm repo list -o json");
return reposJson;
} catch {
await new Promise(r => setTimeout(r, 2000)); // if no repositories, wait for Lens adding bitnami repository
return await listHelmRepositories((retries + 1));
}
}
return "[]";
}