mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add eslint rule padding-line-between-statements (#1593)
Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
This commit is contained in:
1 parent
7b77f18376
commit
dcf253e7d5
401 files changed
+2018
-40
No files matched your search
@@ -75,6 +75,7 @@ describe("create clusters", () => {
|
||||
preferences: {},
|
||||
})
|
||||
};
|
||||
|
||||
mockFs(mockOpts);
|
||||
jest.spyOn(Kubectl.prototype, "ensureKubectl").mockReturnValue(Promise.resolve(true));
|
||||
c = new Cluster({
|
||||
@@ -112,6 +113,7 @@ describe("create clusters", () => {
|
||||
|
||||
it("activating cluster should try to connect to cluster and do a refresh", async () => {
|
||||
const port = await getFreePort();
|
||||
|
||||
jest.spyOn(ContextHandler.prototype, "ensureServer");
|
||||
|
||||
const mockListNSs = jest.fn();
|
||||
@@ -122,17 +124,20 @@ describe("create clusters", () => {
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
jest.spyOn(Cluster.prototype, "isClusterAdmin").mockReturnValue(Promise.resolve(true));
|
||||
jest.spyOn(Cluster.prototype, "canI")
|
||||
.mockImplementationOnce((attr: V1ResourceAttributes): Promise<boolean> => {
|
||||
expect(attr.namespace).toBe("default");
|
||||
expect(attr.resource).toBe("pods");
|
||||
expect(attr.verb).toBe("list");
|
||||
|
||||
return Promise.resolve(true);
|
||||
})
|
||||
.mockImplementation((attr: V1ResourceAttributes): Promise<boolean> => {
|
||||
expect(attr.namespace).toBe("default");
|
||||
expect(attr.verb).toBe("list");
|
||||
|
||||
return Promise.resolve(true);
|
||||
});
|
||||
jest.spyOn(Cluster.prototype, "getProxyKubeconfig").mockReturnValue(mockKC as any);
|
||||
@@ -148,6 +153,7 @@ describe("create clusters", () => {
|
||||
|
||||
mockedRequest.mockImplementationOnce(((uri: any) => {
|
||||
expect(uri).toBe(`http://localhost:${port}/api-kube/version`);
|
||||
|
||||
return Promise.resolve({ gitVersion: "1.2.3" });
|
||||
}) as any);
|
||||
|
||||
@@ -165,6 +171,7 @@ describe("create clusters", () => {
|
||||
kubeConfigPath: "minikube-config.yml",
|
||||
workspace: workspaceStore.currentWorkspaceId
|
||||
});
|
||||
|
||||
await c.init(port);
|
||||
await c.activate();
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ describe("kube auth proxy tests", () => {
|
||||
it("calling exit multiple times shouldn't throw", async () => {
|
||||
const port = await getFreePort();
|
||||
const kap = new KubeAuthProxy(new Cluster({ id: "foobar", kubeConfigPath: "fake-path.yml" }), port, {});
|
||||
|
||||
kap.exit();
|
||||
kap.exit();
|
||||
kap.exit();
|
||||
@@ -69,24 +70,29 @@ describe("kube auth proxy tests", () => {
|
||||
jest.spyOn(Kubectl.prototype, "ensureKubectl").mockReturnValueOnce(Promise.resolve(false));
|
||||
mockedCP.on.mockImplementation((event: string, listener: (message: any, sendHandle: any) => void): ChildProcess => {
|
||||
listeners[event] = listener;
|
||||
|
||||
return mockedCP;
|
||||
});
|
||||
mockedCP.stderr = mock<Readable>();
|
||||
mockedCP.stderr.on.mockImplementation((event: string, listener: (message: any, sendHandle: any) => void): Readable => {
|
||||
listeners[`stderr/${event}`] = listener;
|
||||
|
||||
return mockedCP.stderr;
|
||||
});
|
||||
mockedCP.stdout = mock<Readable>();
|
||||
mockedCP.stdout.on.mockImplementation((event: string, listener: (message: any, sendHandle: any) => void): Readable => {
|
||||
listeners[`stdout/${event}`] = listener;
|
||||
|
||||
return mockedCP.stdout;
|
||||
});
|
||||
mockSpawn.mockImplementationOnce((command: string): ChildProcess => {
|
||||
expect(command).toBe(bundledKubectlPath());
|
||||
|
||||
return mockedCP;
|
||||
});
|
||||
mockWaitUntilUsed.mockReturnValueOnce(Promise.resolve());
|
||||
const cluster = new Cluster({ id: "foobar", kubeConfigPath: "fake-path.yml" });
|
||||
|
||||
jest.spyOn(cluster, "apiUrl", "get").mockReturnValue("https://fake.k8s.internal");
|
||||
proxy = new KubeAuthProxy(cluster, port, {});
|
||||
});
|
||||
|
||||
@@ -64,6 +64,7 @@ describe("kubeconfig manager tests", () => {
|
||||
preferences: {},
|
||||
})
|
||||
};
|
||||
|
||||
mockFs(mockOpts);
|
||||
});
|
||||
|
||||
@@ -86,6 +87,7 @@ describe("kubeconfig manager tests", () => {
|
||||
expect(kubeConfManager.getPath()).toBe("tmp/kubeconfig-foo");
|
||||
const file = await fse.readFile(kubeConfManager.getPath());
|
||||
const yml = loadYaml<any>(file.toString());
|
||||
|
||||
expect(yml["current-context"]).toBe("minikube");
|
||||
expect(yml["clusters"][0]["cluster"]["server"]).toBe(`http://127.0.0.1:${port}/foo`);
|
||||
expect(yml["users"][0]["name"]).toBe("proxy");
|
||||
@@ -101,8 +103,8 @@ 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();
|
||||
|
||||
expect(await fse.pathExists(configPath)).toBe(true);
|
||||
await kubeConfManager.unlink();
|
||||
expect(await fse.pathExists(configPath)).toBe(false);
|
||||
|
||||
Reference in new issue
Block a user