From 60af13db0b6930a099e35bacb14ae9e7d76cd0e7 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Thu, 13 Oct 2022 09:56:30 -0400 Subject: [PATCH] Fix tests Signed-off-by: Sebastian Malton --- .../local-shell-session/local-shell-session.injectable.ts | 2 ++ .../local-shell-session/local-shell-session.ts | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/shell-session/local-shell-session/local-shell-session.injectable.ts b/src/main/shell-session/local-shell-session/local-shell-session.injectable.ts index 6e3efe7d6f..eb8124df06 100644 --- a/src/main/shell-session/local-shell-session/local-shell-session.injectable.ts +++ b/src/main/shell-session/local-shell-session/local-shell-session.injectable.ts @@ -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, diff --git a/src/main/shell-session/local-shell-session/local-shell-session.ts b/src/main/shell-session/local-shell-session/local-shell-session.ts index ac1edc1cce..c324718bcc 100644 --- a/src/main/shell-session/local-shell-session/local-shell-session.ts +++ b/src/main/shell-session/local-shell-session/local-shell-session.ts @@ -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) => Record; } @@ -44,8 +45,8 @@ export class LocalShellSession extends ShellSession { } protected async getShellArgs(shell: string): Promise { - 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":