Fix most tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton committed 2023-01-10 15:18:12 -05:00
1 parent 6d0e5277aa
commit d22af76e60
3 files changed
+27 -3

No files matched your search

@@ -0,0 +1,10 @@
/**
* 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 lensProxyCertificateLifespanInjectable from "./certificate-lifespan.injectable";
// Update this value in a hundred years :D
export default getGlobalOverride(lensProxyCertificateLifespanInjectable, () => 100 * 365);
@@ -0,0 +1,12 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
const lensProxyCertificateLifespanInjectable = getInjectable({
id: "lens-proxy-certificate-lifespan",
instantiate: () => 365, // days
});
export default lensProxyCertificateLifespanInjectable;
@@ -0,0 +1,55 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import { generate } from "selfsigned";
import lensProxyCertificateInjectable from "../../common/certificate/lens-proxy-certificate.injectable";
import { beforeElectronIsReadyInjectionToken } from "../start-main-application/runnable-tokens/before-electron-is-ready-injection-token";
import lensProxyCertificateLifespanInjectable from "./certificate-lifespan.injectable";
const setupLensProxyCertificateInjectable = getInjectable({
id: "setup-lens-proxy-certificate",
instantiate: (di) => {
const lensProxyCertificate = di.inject(lensProxyCertificateInjectable);
const lifespan = di.inject(lensProxyCertificateLifespanInjectable);
return {
id: "setup-lens-proxy-certificate",
run: () => {
const cert = generate([
{ name: "commonName", value: "Lens Certificate Authority" },
{ name: "organizationName", value: "Lens" },
], {
keySize: 2048,
algorithm: "sha256",
days: lifespan,
extensions: [
{
name: "basicConstraints",
cA: true,
},
{
name: "subjectAltName",
altNames: [
{ type: 2, value: "*.lens.app" },
{ type: 2, value: "lens.app" },
{ type: 2, value: "localhost" },
{ type: 7, ip: "127.0.0.1" },
],
},
],
});
lensProxyCertificate.set(cert);
return undefined;
},
};
},
injectionToken: beforeElectronIsReadyInjectionToken,
});
export default setupLensProxyCertificateInjectable;