From 50325d9fc1c13573b1f9ffa6a2d680f188169ed8 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Thu, 22 Dec 2022 14:29:33 -0500 Subject: [PATCH] Move some more overrides to global if needed Signed-off-by: Sebastian Malton --- ...ell-environment.global-override-for-injectable.ts | 11 +++++++++++ .../shell-sync/main/setup-shell.injectable.ts | 1 - src/main/getDiForUnitTesting.ts | 12 ------------ .../start-kube-config-sync.injectable.ts | 2 -- 4 files changed, 11 insertions(+), 15 deletions(-) create mode 100644 src/features/shell-sync/main/compute-shell-environment.global-override-for-injectable.ts diff --git a/src/features/shell-sync/main/compute-shell-environment.global-override-for-injectable.ts b/src/features/shell-sync/main/compute-shell-environment.global-override-for-injectable.ts new file mode 100644 index 0000000000..b4c9051729 --- /dev/null +++ b/src/features/shell-sync/main/compute-shell-environment.global-override-for-injectable.ts @@ -0,0 +1,11 @@ +/** + * Copyright (c) OpenLens Authors. All rights reserved. + * Licensed under MIT License. See LICENSE in root directory for more information. + */ + +import { getGlobalOverride } from "../../../common/test-utils/get-global-override"; +import computeShellEnvironmentInjectable from "./compute-shell-environment.injectable"; + +export default getGlobalOverride(computeShellEnvironmentInjectable, () => async () => ({ + callWasSuccessful: true, +})); diff --git a/src/features/shell-sync/main/setup-shell.injectable.ts b/src/features/shell-sync/main/setup-shell.injectable.ts index a534411a1f..82d623ec28 100644 --- a/src/features/shell-sync/main/setup-shell.injectable.ts +++ b/src/features/shell-sync/main/setup-shell.injectable.ts @@ -68,7 +68,6 @@ const setupShellInjectable = getInjectable({ }, injectionToken: onLoadOfApplicationInjectionToken, - causesSideEffects: true, }); export default setupShellInjectable; diff --git a/src/main/getDiForUnitTesting.ts b/src/main/getDiForUnitTesting.ts index a6c5b77a0e..d5479175b4 100644 --- a/src/main/getDiForUnitTesting.ts +++ b/src/main/getDiForUnitTesting.ts @@ -14,10 +14,8 @@ import lensResourcesDirInjectable from "../common/vars/lens-resources-dir.inject import environmentVariablesInjectable from "../common/utils/environment-variables.injectable"; import setupIpcMainHandlersInjectable from "./electron-app/runnables/setup-ipc-main-handlers/setup-ipc-main-handlers.injectable"; import setupLensProxyInjectable from "./start-main-application/runnables/setup-lens-proxy.injectable"; -import setupShellInjectable from "../features/shell-sync/main/setup-shell.injectable"; import setupSyncingOfWeblinksInjectable from "./start-main-application/runnables/setup-syncing-of-weblinks.injectable"; import stopServicesAndExitAppInjectable from "./stop-services-and-exit-app.injectable"; -import setupSystemCaInjectable from "./start-main-application/runnables/setup-system-ca.injectable"; import setupDeepLinkingInjectable from "./electron-app/runnables/setup-deep-linking.injectable"; import exitAppInjectable from "./electron-app/features/exit-app.injectable"; import getCommandLineSwitchInjectable from "./electron-app/features/get-command-line-switch.injectable"; @@ -35,7 +33,6 @@ import clusterFramesInjectable from "../common/cluster-frames.injectable"; import type { ClusterFrameInfo } from "../common/cluster-frames"; import { observable, runInAction } from "mobx"; import waitForElectronToBeReadyInjectable from "./electron-app/features/wait-for-electron-to-be-ready.injectable"; -import setupRunnablesAfterWindowIsOpenedInjectable from "./electron-app/runnables/setup-runnables-after-window-is-opened.injectable"; import broadcastMessageInjectable from "../common/ipc/broadcast-message.injectable"; import getElectronThemeInjectable from "./electron-app/features/get-electron-theme.injectable"; import syncThemeFromOperatingSystemInjectable from "./electron-app/features/sync-theme-from-operating-system.injectable"; @@ -44,8 +41,6 @@ import electronQuitAndInstallUpdateInjectable from "./electron-app/features/elec import electronUpdaterIsActiveInjectable from "./electron-app/features/electron-updater-is-active.injectable"; import baseBundledBinariesDirectoryInjectable from "../common/vars/base-bundled-binaries-dir.injectable"; import setUpdateOnQuitInjectable from "./electron-app/features/set-update-on-quit.injectable"; -import startCatalogSyncInjectable from "./catalog-sync-to-renderer/start-catalog-sync.injectable"; -import startKubeConfigSyncInjectable from "./start-main-application/runnables/kube-config-sync/start-kube-config-sync.injectable"; import getRandomIdInjectable from "../common/utils/get-random-id.injectable"; import normalizedPlatformArchitectureInjectable from "../common/vars/normalized-platform-architecture.injectable"; import waitUntilBundledExtensionsAreLoadedInjectable from "./start-main-application/lens-window/application-window/wait-until-bundled-extensions-are-loaded.injectable"; @@ -54,7 +49,6 @@ import electronInjectable from "./utils/resolve-system-proxy/electron.injectable import focusApplicationInjectable from "./electron-app/features/focus-application.injectable"; import kubectlDownloadingNormalizedArchInjectable from "./kubectl/normalized-arch.injectable"; import initializeClusterManagerInjectable from "./cluster/initialize-manager.injectable"; -import addKubeconfigSyncAsEntitySourceInjectable from "./start-main-application/runnables/kube-config-sync/add-source.injectable"; import type { GlobalOverride } from "../common/test-utils/get-global-override"; import applicationInformationInjectable from "../common/vars/application-information-injectable"; import nodeEnvInjectionToken from "../common/vars/node-env-injection-token"; @@ -139,15 +133,9 @@ const overrideRunnablesHavingSideEffects = (di: DiContainer) => { [ initializeExtensionsInjectable, initializeClusterManagerInjectable, - addKubeconfigSyncAsEntitySourceInjectable, setupIpcMainHandlersInjectable, setupLensProxyInjectable, - setupShellInjectable, setupSyncingOfWeblinksInjectable, - setupSystemCaInjectable, - setupRunnablesAfterWindowIsOpenedInjectable, - startCatalogSyncInjectable, - startKubeConfigSyncInjectable, ].forEach((injectable) => { di.override(injectable, () => ({ id: injectable.id, diff --git a/src/main/start-main-application/runnables/kube-config-sync/start-kube-config-sync.injectable.ts b/src/main/start-main-application/runnables/kube-config-sync/start-kube-config-sync.injectable.ts index ad0e446565..1dbadc4246 100644 --- a/src/main/start-main-application/runnables/kube-config-sync/start-kube-config-sync.injectable.ts +++ b/src/main/start-main-application/runnables/kube-config-sync/start-kube-config-sync.injectable.ts @@ -28,8 +28,6 @@ const startKubeConfigSyncInjectable = getInjectable({ }; }, - causesSideEffects: true, - injectionToken: afterApplicationIsLoadedInjectionToken, });