mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Return parsed object
Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
parent
aaff71e0b0
commit
f3b1edca28
@ -96,8 +96,7 @@ describe("Lens integration tests", () => {
|
||||
});
|
||||
|
||||
it("ensures helm repos", async () => {
|
||||
const reposJson = await listHelmRepositories();
|
||||
const repos = JSON.parse(reposJson);
|
||||
const repos = await listHelmRepositories();
|
||||
|
||||
if (!repos[0]) {
|
||||
fail("Lens failed to add Bitnami repository");
|
||||
|
||||
@ -28,6 +28,10 @@ export function setup(): Application {
|
||||
});
|
||||
}
|
||||
|
||||
type HelmRepository = {
|
||||
name: string;
|
||||
url: string;
|
||||
};
|
||||
type AsyncPidGetter = () => Promise<number>;
|
||||
export const promiseExec = util.promisify(exec);
|
||||
|
||||
@ -43,12 +47,12 @@ export async function tearDown(app: Application) {
|
||||
}
|
||||
}
|
||||
|
||||
export async function listHelmRepositories(retries = 0): Promise<string> {
|
||||
export async function listHelmRepositories(retries = 0): Promise<HelmRepository[]>{
|
||||
if (retries < 5) {
|
||||
try {
|
||||
const { stdout: reposJson } = await promiseExec("helm repo list -o json");
|
||||
|
||||
return reposJson;
|
||||
return JSON.parse(reposJson);
|
||||
} catch {
|
||||
await new Promise(r => setTimeout(r, 2000)); // if no repositories, wait for Lens adding bitnami repository
|
||||
|
||||
@ -56,5 +60,5 @@ export async function listHelmRepositories(retries = 0): Promise<string> {
|
||||
}
|
||||
}
|
||||
|
||||
return "[]";
|
||||
return [];
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user