1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Fix tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2022-10-13 09:56:30 -04:00
parent c4e20db074
commit 60af13db0b
2 changed files with 6 additions and 3 deletions

View File

@ -16,6 +16,7 @@ import isWindowsInjectable from "../../../common/vars/is-windows.injectable";
import loggerInjectable from "../../../common/logger.injectable";
import resolvedShellInjectable from "../../../common/user-store/resolved-shell.injectable";
import spawnPtyInjectable from "../spawn-pty.injectable";
import userStoreInjectable from "../../../common/user-store/user-store.injectable";
interface InstantiationParameter {
websocket: WebSocket;
@ -39,6 +40,7 @@ const localShellSessionInjectable = getInjectable({
logger: di.inject(loggerInjectable),
resolvedShell: di.inject(resolvedShellInjectable),
spawnPty: di.inject(spawnPtyInjectable),
userStore: di.inject(userStoreInjectable),
}, {
kubectl: createKubectl(cluster.version),
websocket,

View File

@ -4,13 +4,14 @@
*/
import path from "path";
import { UserStore } from "../../../common/user-store";
import type { UserStore } from "../../../common/user-store";
import type { ClusterId } from "../../../common/cluster-types";
import type { ShellSessionArgs, ShellSessionDependencies } from "../shell-session";
import { ShellSession } from "../shell-session";
import { baseBinariesDir } from "../../../common/vars";
interface LocalShellSessionDependencies extends ShellSessionDependencies {
readonly userStore: UserStore;
modifyTerminalShellEnv: (clusterId: ClusterId, env: Record<string, string | undefined>) => Record<string, string | undefined>;
}
@ -44,8 +45,8 @@ export class LocalShellSession extends ShellSession {
}
protected async getShellArgs(shell: string): Promise<string[]> {
const pathFromPreferences = UserStore.getInstance().kubectlBinariesPath || this.kubectl.getBundledPath();
const kubectlPathDir = UserStore.getInstance().downloadKubectlBinaries ? await this.kubectlBinDirP : path.dirname(pathFromPreferences);
const pathFromPreferences = this.dependencies.userStore.kubectlBinariesPath || this.kubectl.getBundledPath();
const kubectlPathDir = this.dependencies.userStore.downloadKubectlBinaries ? await this.kubectlBinDirP : path.dirname(pathFromPreferences);
switch(path.basename(shell)) {
case "powershell.exe":