-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade and adapt to new version of libraries in ogre-tools #7241
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,9 +30,9 @@ describe("user store tests", () => { | |
get: () => "latest" as const, | ||
init: async () => {}, | ||
})); | ||
|
||
await di.inject(defaultUpdateChannelInjectable).init(); | ||
|
||
userStore = di.inject(userStoreInjectable); | ||
}); | ||
|
||
describe("for an empty config", () => { | ||
|
@@ -42,6 +42,8 @@ describe("user store tests", () => { | |
writeJsonSync("/some-directory-for-user-data/lens-user-store.json", {}); | ||
writeJsonSync("/some-directory-for-user-data/kube_config", {}); | ||
|
||
userStore = di.inject(userStoreInjectable); | ||
|
||
userStore.load(); | ||
}); | ||
|
||
|
@@ -90,6 +92,8 @@ describe("user store tests", () => { | |
|
||
di.override(storeMigrationVersionInjectable, () => "10.0.0"); | ||
|
||
userStore = di.inject(userStoreInjectable); | ||
Comment on lines
93
to
+95
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
userStore.load(); | ||
}); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ | |
*/ | ||
|
||
import type { DiContainer } from "@ogre-tools/injectable"; | ||
import createClusterInjectable from "../../../main/create-cluster/create-cluster.injectable"; | ||
import clusterFrameContextForNamespacedResourcesInjectable from "../../../renderer/cluster-frame-context/for-namespaced-resources.injectable"; | ||
import hostedClusterInjectable from "../../../renderer/cluster-frame-context/hosted-cluster.injectable"; | ||
import { getDiForUnitTesting } from "../../../renderer/getDiForUnitTesting"; | ||
|
@@ -18,6 +17,7 @@ import { KubeApi } from "../kube-api"; | |
import { KubeObject } from "../kube-object"; | ||
import { KubeObjectStore } from "../kube-object.store"; | ||
import maybeKubeApiInjectable from "../maybe-kube-api.injectable"; | ||
import { createClusterInjectionToken } from "../../cluster/create-cluster-injection-token"; | ||
|
||
// eslint-disable-next-line no-restricted-imports | ||
import { KubeApi as ExternalKubeApi } from "../../../extensions/common-api/k8s-api"; | ||
|
@@ -43,7 +43,7 @@ describe("ApiManager", () => { | |
di.override(directoryForKubeConfigsInjectable, () => "/some-kube-configs"); | ||
di.override(storesAndApisCanBeCreatedInjectable, () => true); | ||
|
||
const createCluster = di.inject(createClusterInjectable); | ||
const createCluster = di.inject(createClusterInjectionToken); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reference equality is important here. Previously it worked because the implementation for |
||
|
||
di.override(hostedClusterInjectable, () => createCluster({ | ||
contextName: "some-context-name", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,10 @@ import asyncFn from "@async-fn/jest"; | |
import { getPromiseStatus } from "../../test-utils/get-promise-status"; | ||
import { runInAction } from "mobx"; | ||
import type { RequestChannelHandler } from "../../../main/utils/channel/channel-listeners/listener-tokens"; | ||
import { getRequestChannelListenerInjectable } from "../../../main/utils/channel/channel-listeners/listener-tokens"; | ||
import { | ||
getRequestChannelListenerInjectable, | ||
requestChannelListenerInjectionToken, | ||
} from "../../../main/utils/channel/channel-listeners/listener-tokens"; | ||
|
||
type TestMessageChannel = MessageChannel<string>; | ||
type TestRequestChannel = RequestChannel<string, string>; | ||
|
@@ -199,21 +202,32 @@ describe("channel", () => { | |
it("when registering multiple handlers for the same channel, throws", async () => { | ||
const applicationBuilder = getApplicationBuilder(); | ||
|
||
const testChannelListenerInMainInjectable = getRequestChannelListenerInjectable({ | ||
channel: testRequestChannel, | ||
handler: () => () => "some-value", | ||
}); | ||
const testChannelListenerInMain2Injectable = getRequestChannelListenerInjectable({ | ||
channel: testRequestChannel, | ||
handler: () => () => "some-other-value", | ||
const someChannelListenerInjectable = getInjectable({ | ||
id: "some-channel-listener", | ||
|
||
instantiate: () => ({ | ||
channel: testRequestChannel, | ||
handler: () => () => "irrelevant", | ||
}), | ||
|
||
injectionToken: requestChannelListenerInjectionToken, | ||
}); | ||
|
||
testChannelListenerInMain2Injectable.id += "2"; | ||
const someOtherChannelListenerInjectable = getInjectable({ | ||
id: "some-other-channel-listener", | ||
|
||
instantiate: () => ({ | ||
channel: testRequestChannel, | ||
handler: () => () => "irrelevant", | ||
}), | ||
|
||
injectionToken: requestChannelListenerInjectionToken, | ||
}); | ||
|
||
Comment on lines
+205
to
226
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mutating injectable ID is not possible and shouldn't be advertised. |
||
applicationBuilder.beforeApplicationStart((mainDi) => { | ||
runInAction(() => { | ||
mainDi.register(testChannelListenerInMainInjectable); | ||
mainDi.register(testChannelListenerInMain2Injectable); | ||
mainDi.register(someChannelListenerInjectable); | ||
mainDi.register(someOtherChannelListenerInjectable); | ||
}); | ||
}); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
override
has to happen beforeinject
.