Fix: Recreate proxy kubeconfig if it is deleted (#2372)

This commit is contained in:
Lauri Nevala authored and GitHub committed 2021-03-23 08:12:01 -04:00
1 parent e70ac87c52
commit 4afec72ceb
11 files changed
+72 -43

No files matched your search

+4 -4
View File
@@ -85,8 +85,8 @@ describe("kubeconfig manager tests", () => {
const kubeConfManager = await KubeconfigManager.create(cluster, contextHandler, port);
expect(logger.error).not.toBeCalled();
expect(kubeConfManager.getPath()).toBe(`tmp${path.sep}kubeconfig-foo`);
const file = await fse.readFile(kubeConfManager.getPath());
expect(await kubeConfManager.getPath()).toBe(`tmp${path.sep}kubeconfig-foo`);
const file = await fse.readFile(await kubeConfManager.getPath());
const yml = loadYaml<any>(file.toString());
expect(yml["current-context"]).toBe("minikube");
@@ -104,12 +104,12 @@ describe("kubeconfig manager tests", () => {
const contextHandler = new ContextHandler(cluster);
const port = await getFreePort();
const kubeConfManager = await KubeconfigManager.create(cluster, contextHandler, port);
const configPath = kubeConfManager.getPath();
const configPath = await kubeConfManager.getPath();
expect(await fse.pathExists(configPath)).toBe(true);
await kubeConfManager.unlink();
expect(await fse.pathExists(configPath)).toBe(false);
await kubeConfManager.unlink(); // doesn't throw
expect(kubeConfManager.getPath()).toBeUndefined();
expect(await kubeConfManager.getPath()).toBeUndefined();
});
});