Turn on strict mode in tsconfig.json, some helpful lints, and required cleanup where strictness necessitates it (#5195)

* Turn on strict mode in tsconfig.json

- Add route, clusterRoute, and payloadValidatedClusterRoute helper
  functions to improve types with backend routes

- Turn on the following new lints:
  - react/jsx-first-prop-new-line
  - react/jsx-wrap-multilines
  - react/jsx-one-expression-per-line
  - react/jsx-max-props-per-line
  - react/jsx-indent
  - react/jsx-indent-props

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix build

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Replace KubeObject scope strings with enum

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Revert package.json version changes

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* revert move hostedCluster(Id)

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* change some type param names to be not single letters

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* remove copy-extension-themes

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* add new make clean action

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix build to not use webpack for generating types

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix kube-object-menu.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix select.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix catalog.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* revert move fileNameMigration to index

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix ref logic error

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix log-resource-selector.test.tsx tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix dock-store.test.ts test by overriding createStorage to not touch file system

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix cluster.test.ts tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix kube=api.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fixed hotbar-store.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix kubeconfig-manager.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix cluster-role-bindings/__tests__/dialog.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix role-bindings/__tests__/dialog.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix pods.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix delete-cluster-dialog.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix daemonset.store.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix replicaset.store.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix statefulsets/dialog/dialog.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix replicasets/scale-dialog/dialog.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix deployments.store.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix deployments/scale/dialog.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix cronjob.store.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix stateful-set.api.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix deployment.api.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix api-manager.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix statefulset.store.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix job.store.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix pods.store.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix scroll-spy.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix hotbar-remove-command.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix catalog-entity-registry.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix welcome.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix verify-that-all-routes-have-route-component.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix pod-tolerations.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* better fix for previous 3 fixes, plus also select.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix kube-object-menu.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix app-paths.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix dock-tabs.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix isReactNode typing

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix sub-title.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix drawer.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix list-layout.tsx and header.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix error-boundary.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix upgrade-chart/store.ts and dock-tab.store.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix install-chart/store.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix edit-resource/store.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix create-resource/store.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix namespace-select.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix namespace-select-filter.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix crd-list.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix wrong types for extensions

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix circular dependency

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix circular dependency on catalogCategoryRegistry

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix api-kube

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix type errors, most <Select /> errors

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fixing more type errors

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* some more fixing type errors

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* convert all KubeApis to injectable with legacy global backups

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* factor out into a common file all the exports

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* convert all KubeObjectStores to injectable with legacy global backups

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix lint

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* remove unused legacy KubeApi globals

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix bad previous commit

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* more crash fixing

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* try and fix behavioural tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix sidebar-and-tab-navigation-for-core.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix sidebar-and-tab-navigation-for-extensions.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix navigation-using-application-menu.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix catalog.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Make ThemeStore non-singleton and fix navigation-to-terminal-preferences.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* extensions.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix catalog-entity-registry.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix navigation-using-application-menu.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix log-resource-selector.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix dock-tabs.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix delete-cluster-dialog.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix navigation-to-kubernetes-preferences.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix navigation-to-editor-preferences.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix navigation-to-proxy-preferences.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix navigation-using-application-menu.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix navigation-to-application-preferences.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix dock-store.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix select.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix role-bindings/__tests__/dialog.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix hotbar-remove-command.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix cluster-role-bindings/__tests__/dialog.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix navigation-to-extension-specific-preferences.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix navigation-to-telemetry-preferences.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix closing-preferences.test.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix navigation-to-editor-preferences.test.ts

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix navigation-to-proxy-preferences.test.ts

- Fix other type errors too

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* final tweaks

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Add more tsconfig files, fix bug in <Catalog>

- Make all of history, navigation injectable

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix type errors

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Convert all of kube-details-params/ and navigate/ to injectable

- This fixes a runtime error that was encountered during testing

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix runtime errors on renderer

- remove all static uses of `createPageParam` (and then removed the
  legacy global)
- Made LensRendererExtension and LensMainExtension just used
  dependencies and not the getLegacyDi
- Fixed circular dep in extension-loader

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Move registerStore calls to after injectMany

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* replace all the rest of the legacy uses of apiManager

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix stack overflow and cycles in DI

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix NamespaceSelectFilter not opening

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix WizardStep and AddNamespaceDialog

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix KubeApi's not being registered

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* cleanup WindowManager

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Proper fix for Wizard, fix NamespaceStore.subscribe

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Rewrite withTooltip to be more type correct

- Fixes mobx related "too many recursive actions" error

- Change all the uses of withTooltips to be functional components

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Add e2e test to cover kube api registration

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* cleanup internal-commands

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* remove cast in <Animate>

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix command-palette e2e test

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix type error after rebase

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix test name

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix lint

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix code to help CodeQL scanner

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* update intree extension lock files

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix build-extensions picking wrong @types/react

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix tests from rebase

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix type error

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Make KubeconfigSyncManager more injectable

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix crash in test mode for Dialog

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* make Select snapshots deterministic

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix new type error

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix kube-object.store.test.ts typing

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix merge build issues

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix snapshots after merge

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix lint after merge

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* reexport BaseKubeJsonApiObjectMetadata

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix typo in terminalSpawningPool

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* remove duplicate license header

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix typo to waitUntilDefined

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* remove iter use from getLegacyGlobalDiForExtensionApi

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* remove complex createStorage override

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* override logger with mocks only when needed for tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* remove specialized overrideStore flags for getDiForUnitTesting

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* remove unnecessary | undefined types from the exactOptionalFieldTypes experiment

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* use more descriptive name for local test mocks

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* remove unnecessary addition to 'make clean' target

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* remove oddity of KubeObjectStore.getById(undefined) being allowed

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* rename KubeObject.getDescriptor in favour of name without fundemental JS meaning

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Simplify legacyRegisterApi when working in behaviour unit tests

- Don't emit within main environment as there should be no auto
  registering there

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* change confusing variable name in ReactiveDuration

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* make visitor pattern more explicit for Entity contextMenuOpen

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* toggleDetails -> toggleKubeDetailsPane is more specific

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* remove outdated comment

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix bug where LensExtension dependencies are not set

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix tests from the revert of react 18

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix more tests from merge

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix typings with new is-compatible-extension tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* more type fixing

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Revert in-tree extension versions

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Improve name of guarding injectable for stores and apis

- New name better implies that it is just a guard state and does not do
  anything

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Add helper for <Select>.isMulti for storing in a Set<Value>

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix is-compatible-extension.test.ts types

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton authored and GitHub committed 2022-05-16 07:17:57 -04:00
1 parent 381d77c633
commit dfcb7c3330
1062 files changed
+26512 -28689

No files matched your search

@@ -2,32 +2,11 @@
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { cronJobStore } from "../+workloads-cronjobs/cronjob.store";
import type { CronJobStore } from "../+workloads-cronjobs/store";
import cronJobStoreInjectable from "../+workloads-cronjobs/store.injectable";
import { CronJob } from "../../../common/k8s-api/endpoints";
const spec = {
schedule: "test",
concurrencyPolicy: "test",
suspend: true,
jobTemplate: {
metadata: {},
spec: {
template: {
metadata: {},
spec: {
containers: [] as any,
restartPolicy: "restart",
terminationGracePeriodSeconds: 1,
dnsPolicy: "no",
hostPID: true,
schedulerName: "string",
},
},
},
},
successfulJobsHistoryLimit: 1,
failedJobsHistoryLimit: 1,
};
import storesAndApisCanBeCreatedInjectable from "../../stores-apis-can-be-created.injectable";
import { getDiForUnitTesting } from "../../getDiForUnitTesting";
const scheduledCronJob = new CronJob({
apiVersion: "foo",
@@ -37,6 +16,30 @@ const scheduledCronJob = new CronJob({
resourceVersion: "scheduledCronJob",
uid: "scheduledCronJob",
namespace: "default",
selfLink: "/apis/batch/v1beta1/cronjobs/default/scheduledCronJob",
},
spec: {
schedule: "test",
concurrencyPolicy: "test",
suspend: false,
jobTemplate: {
metadata: {},
spec: {
template: {
metadata: {},
spec: {
containers: [],
restartPolicy: "restart",
terminationGracePeriodSeconds: 1,
dnsPolicy: "no",
hostPID: true,
schedulerName: "string",
},
},
},
},
successfulJobsHistoryLimit: 1,
failedJobsHistoryLimit: 1,
},
});
@@ -48,6 +51,30 @@ const suspendedCronJob = new CronJob({
resourceVersion: "suspendedCronJob",
uid: "suspendedCronJob",
namespace: "default",
selfLink: "/apis/batch/v1beta1/cronjobs/default/suspendedCronJob",
},
spec: {
schedule: "test",
concurrencyPolicy: "test",
suspend: true,
jobTemplate: {
metadata: {},
spec: {
template: {
metadata: {},
spec: {
containers: [],
restartPolicy: "restart",
terminationGracePeriodSeconds: 1,
dnsPolicy: "no",
hostPID: true,
schedulerName: "string",
},
},
},
},
successfulJobsHistoryLimit: 1,
failedJobsHistoryLimit: 1,
},
});
@@ -59,15 +86,44 @@ const otherSuspendedCronJob = new CronJob({
resourceVersion: "otherSuspendedCronJob",
uid: "otherSuspendedCronJob",
namespace: "default",
selfLink: "/apis/batch/v1beta1/cronjobs/default/otherSuspendedCronJob",
},
spec: {
schedule: "test",
concurrencyPolicy: "test",
suspend: true,
jobTemplate: {
metadata: {},
spec: {
template: {
metadata: {},
spec: {
containers: [],
restartPolicy: "restart",
terminationGracePeriodSeconds: 1,
dnsPolicy: "no",
hostPID: true,
schedulerName: "string",
},
},
},
},
successfulJobsHistoryLimit: 1,
failedJobsHistoryLimit: 1,
},
});
scheduledCronJob.spec = { ...spec };
suspendedCronJob.spec = { ...spec };
otherSuspendedCronJob.spec = { ...spec };
scheduledCronJob.spec.suspend = false;
describe("CronJob Store tests", () => {
let cronJobStore: CronJobStore;
beforeEach(() => {
const di = getDiForUnitTesting({ doGeneralOverrides: true });
di.override(storesAndApisCanBeCreatedInjectable, () => true);
cronJobStore = di.inject(cronJobStoreInjectable);
});
it("gets CronJob statuses in proper sorting order", () => {
const statuses = Object.entries(cronJobStore.getStatuses([
suspendedCronJob,
@@ -4,9 +4,12 @@
*/
import { observable } from "mobx";
import { daemonSetStore } from "../+workloads-daemonsets/daemonsets.store";
import { podsStore } from "../+workloads-pods/pods.store";
import type { DaemonSetStore } from "../+workloads-daemonsets/store";
import daemonSetStoreInjectable from "../+workloads-daemonsets/store.injectable";
import podStoreInjectable from "../+workloads-pods/store.injectable";
import { DaemonSet, Pod } from "../../../common/k8s-api/endpoints";
import storesAndApisCanBeCreatedInjectable from "../../stores-apis-can-be-created.injectable";
import { getDiForUnitTesting } from "../../getDiForUnitTesting";
const runningDaemonSet = new DaemonSet({
apiVersion: "foo",
@@ -16,6 +19,7 @@ const runningDaemonSet = new DaemonSet({
resourceVersion: "runningDaemonSet",
uid: "runningDaemonSet",
namespace: "default",
selfLink: "/apis/apps/v1/daemonsets/default/runningDaemonSet",
},
});
@@ -27,6 +31,7 @@ const failedDaemonSet = new DaemonSet({
resourceVersion: "failedDaemonSet",
uid: "failedDaemonSet",
namespace: "default",
selfLink: "/apis/apps/v1/daemonsets/default/failedDaemonSet",
},
});
@@ -38,6 +43,7 @@ const pendingDaemonSet = new DaemonSet({
resourceVersion: "pendingDaemonSet",
uid: "pendingDaemonSet",
namespace: "default",
selfLink: "/apis/apps/v1/daemonsets/default/pendingDaemonSet",
},
});
@@ -50,34 +56,37 @@ const runningPod = new Pod({
uid: "foobar",
ownerReferences: [{
uid: "runningDaemonSet",
apiVersion: "apps/v1",
kind: "DaemonSet",
name: "running",
}],
namespace: "default",
selfLink: "/api/v1/pods/default/foobar",
},
status: {
phase: "Running",
conditions: [
{
type: "Initialized",
status: "True",
lastProbeTime: 1,
lastTransitionTime: "1",
},
{
type: "Ready",
status: "True",
lastProbeTime: 1,
lastTransitionTime: "1",
},
],
hostIP: "10.0.0.1",
podIP: "10.0.0.1",
startTime: "now",
containerStatuses: [],
initContainerStatuses: [],
},
});
runningPod.status = {
phase: "Running",
conditions: [
{
type: "Initialized",
status: "True",
lastProbeTime: 1,
lastTransitionTime: "1",
},
{
type: "Ready",
status: "True",
lastProbeTime: 1,
lastTransitionTime: "1",
},
],
hostIP: "10.0.0.1",
podIP: "10.0.0.1",
startTime: "now",
containerStatuses: [],
initContainerStatuses: [],
};
const pendingPod = new Pod({
apiVersion: "foo",
kind: "Pod",
@@ -87,8 +96,12 @@ const pendingPod = new Pod({
uid: "foobar-pending",
ownerReferences: [{
uid: "pendingDaemonSet",
apiVersion: "apps/v1",
kind: "DaemonSet",
name: "pending",
}],
namespace: "default",
selfLink: "/api/v1/pods/default/foobar-pending",
},
});
@@ -101,22 +114,34 @@ const failedPod = new Pod({
uid: "foobar-failed",
ownerReferences: [{
uid: "failedDaemonSet",
apiVersion: "apps/v1",
kind: "DaemonSet",
name: "failed",
}],
namespace: "default",
selfLink: "/api/v1/pods/default/foobar-failed",
},
status: {
phase: "Failed",
conditions: [],
hostIP: "10.0.0.1",
podIP: "10.0.0.1",
startTime: "now",
},
});
failedPod.status = {
phase: "Failed",
conditions: [],
hostIP: "10.0.0.1",
podIP: "10.0.0.1",
startTime: "now",
};
describe("DaemonSet Store tests", () => {
beforeAll(() => {
podsStore.items = observable.array([
let daemonSetStore: DaemonSetStore;
beforeEach(() => {
const di = getDiForUnitTesting({ doGeneralOverrides: true });
di.override(storesAndApisCanBeCreatedInjectable, () => true);
const podStore = di.inject(podStoreInjectable);
daemonSetStore = di.inject(daemonSetStoreInjectable);
podStore.items = observable.array([
runningPod,
failedPod,
pendingPod,
@@ -4,11 +4,15 @@
*/
import { observable } from "mobx";
import { deploymentStore } from "../+workloads-deployments/deployments.store";
import { podsStore } from "../+workloads-pods/pods.store";
import type { DeploymentStore } from "../+workloads-deployments/store";
import deploymentStoreInjectable from "../+workloads-deployments/store.injectable";
import podStoreInjectable from "../+workloads-pods/store.injectable";
import type { PodSpec } from "../../../common/k8s-api/endpoints";
import { Deployment, Pod } from "../../../common/k8s-api/endpoints";
import storesAndApisCanBeCreatedInjectable from "../../stores-apis-can-be-created.injectable";
import { getDiForUnitTesting } from "../../getDiForUnitTesting";
const spec = {
const spec: PodSpec = {
containers: [{
name: "some",
image: "someimage",
@@ -39,28 +43,28 @@ const runningDeployment = new Deployment({
resourceVersion: "foobar",
uid: "foobar",
namespace: "default",
selfLink: "/apis/apps/v1/deployments/default/foobar",
},
});
runningDeployment.spec = {
replicas: 1,
selector: { matchLabels: {}},
strategy: {
type: "test",
rollingUpdate: {
maxSurge: 1,
maxUnavailable: 1,
},
},
template: {
metadata: {
labels: {
"name": "kube-state-metrics",
spec: {
replicas: 1,
selector: { matchLabels: {}},
strategy: {
type: "test",
rollingUpdate: {
maxSurge: 1,
maxUnavailable: 1,
},
},
spec,
template: {
metadata: {
labels: {
"name": "kube-state-metrics",
},
},
spec,
},
},
};
});
const failedDeployment = new Deployment({
apiVersion: "foo",
@@ -70,28 +74,28 @@ const failedDeployment = new Deployment({
resourceVersion: "failedDeployment",
uid: "failedDeployment",
namespace: "default",
selfLink: "/apis/apps/v1/deployments/default/failedDeployment",
},
});
failedDeployment.spec = {
replicas: 1,
selector: { matchLabels: {}},
strategy: {
type: "test",
rollingUpdate: {
maxSurge: 1,
maxUnavailable: 1,
},
},
template: {
metadata: {
labels: {
"name": "failedpods",
spec: {
replicas: 1,
selector: { matchLabels: {}},
strategy: {
type: "test",
rollingUpdate: {
maxSurge: 1,
maxUnavailable: 1,
},
},
spec,
template: {
metadata: {
labels: {
"name": "failedpods",
},
},
spec,
},
},
};
});
const pendingDeployment = new Deployment({
apiVersion: "foo",
@@ -101,28 +105,28 @@ const pendingDeployment = new Deployment({
resourceVersion: "pendingDeployment",
uid: "pendingDeployment",
namespace: "default",
selfLink: "/apis/apps/v1/deployments/default/pendingDeployment",
},
});
pendingDeployment.spec = {
replicas: 1,
selector: { matchLabels: {}},
strategy: {
type: "test",
rollingUpdate: {
maxSurge: 1,
maxUnavailable: 1,
},
},
template: {
metadata: {
labels: {
"mydeployment": "true",
spec: {
replicas: 1,
selector: { matchLabels: {}},
strategy: {
type: "test",
rollingUpdate: {
maxSurge: 1,
maxUnavailable: 1,
},
},
spec,
template: {
metadata: {
labels: {
"mydeployment": "true",
},
},
spec,
},
},
};
});
const runningPod = new Pod({
apiVersion: "foo",
@@ -135,32 +139,32 @@ const runningPod = new Pod({
"name": "kube-state-metrics",
},
namespace: "default",
selfLink: "/api/v1/pods/default/foobar",
},
status: {
phase: "Running",
conditions: [
{
type: "Initialized",
status: "True",
lastProbeTime: 1,
lastTransitionTime: "1",
},
{
type: "Ready",
status: "True",
lastProbeTime: 1,
lastTransitionTime: "1",
},
],
hostIP: "10.0.0.1",
podIP: "10.0.0.1",
startTime: "now",
containerStatuses: [],
initContainerStatuses: [],
},
});
runningPod.status = {
phase: "Running",
conditions: [
{
type: "Initialized",
status: "True",
lastProbeTime: 1,
lastTransitionTime: "1",
},
{
type: "Ready",
status: "True",
lastProbeTime: 1,
lastTransitionTime: "1",
},
],
hostIP: "10.0.0.1",
podIP: "10.0.0.1",
startTime: "now",
containerStatuses: [],
initContainerStatuses: [],
};
const pendingPod = new Pod({
apiVersion: "foo",
kind: "Pod",
@@ -172,6 +176,7 @@ const pendingPod = new Pod({
"mydeployment": "true",
},
namespace: "default",
selfLink: "/api/v1/pods/default/foobar-pending",
},
});
@@ -186,25 +191,34 @@ const failedPod = new Pod({
"name": "failedpods",
},
namespace: "default",
selfLink: "/api/v1/pods/default/foobar-failed",
},
status: {
phase: "Failed",
conditions: [],
hostIP: "10.0.0.1",
podIP: "10.0.0.1",
startTime: "now",
},
});
failedPod.status = {
phase: "Failed",
conditions: [],
hostIP: "10.0.0.1",
podIP: "10.0.0.1",
startTime: "now",
};
describe("Deployment Store tests", () => {
beforeAll(() => {
let deploymentStore: DeploymentStore;
beforeEach(() => {
const di = getDiForUnitTesting({ doGeneralOverrides: true });
di.override(storesAndApisCanBeCreatedInjectable, () => true);
const podStore = di.inject(podStoreInjectable);
// Add pods to pod store
podsStore.items = observable.array([
podStore.items = observable.array([
runningPod,
failedPod,
pendingPod,
]);
deploymentStore = di.inject(deploymentStoreInjectable);
});
it("gets Deployment statuses in proper sorting order", () => {
@@ -4,9 +4,12 @@
*/
import { observable } from "mobx";
import { jobStore } from "../+workloads-jobs/job.store";
import { podsStore } from "../+workloads-pods/pods.store";
import type { JobStore } from "../+workloads-jobs/store";
import jobStoreInjectable from "../+workloads-jobs/store.injectable";
import podStoreInjectable from "../+workloads-pods/store.injectable";
import { Job, Pod } from "../../../common/k8s-api/endpoints";
import storesAndApisCanBeCreatedInjectable from "../../stores-apis-can-be-created.injectable";
import { getDiForUnitTesting } from "../../getDiForUnitTesting";
const runningJob = new Job({
apiVersion: "foo",
@@ -16,6 +19,7 @@ const runningJob = new Job({
resourceVersion: "runningJob",
uid: "runningJob",
namespace: "default",
selfLink: "/apis/batch/v1/jobs/default/runningJob",
},
});
@@ -27,6 +31,7 @@ const failedJob = new Job({
resourceVersion: "failedJob",
uid: "failedJob",
namespace: "default",
selfLink: "/apis/batch/v1/jobs/default/failedJob",
},
});
@@ -38,6 +43,7 @@ const pendingJob = new Job({
resourceVersion: "pendingJob",
uid: "pendingJob",
namespace: "default",
selfLink: "/apis/batch/v1/jobs/default/pendingJob",
},
});
@@ -49,6 +55,7 @@ const succeededJob = new Job({
resourceVersion: "succeededJob",
uid: "succeededJob",
namespace: "default",
selfLink: "/apis/batch/v1/jobs/default/succeededJob",
},
});
@@ -61,34 +68,37 @@ const runningPod = new Pod({
uid: "foobar",
ownerReferences: [{
uid: "runningJob",
apiVersion: "v1",
kind: "Pod",
name: "running",
}],
namespace: "default",
selfLink: "/api/v1/pods/default/foobar",
},
status: {
phase: "Running",
conditions: [
{
type: "Initialized",
status: "True",
lastProbeTime: 1,
lastTransitionTime: "1",
},
{
type: "Ready",
status: "True",
lastProbeTime: 1,
lastTransitionTime: "1",
},
],
hostIP: "10.0.0.1",
podIP: "10.0.0.1",
startTime: "now",
containerStatuses: [],
initContainerStatuses: [],
},
});
runningPod.status = {
phase: "Running",
conditions: [
{
type: "Initialized",
status: "True",
lastProbeTime: 1,
lastTransitionTime: "1",
},
{
type: "Ready",
status: "True",
lastProbeTime: 1,
lastTransitionTime: "1",
},
],
hostIP: "10.0.0.1",
podIP: "10.0.0.1",
startTime: "now",
containerStatuses: [],
initContainerStatuses: [],
};
const pendingPod = new Pod({
apiVersion: "foo",
kind: "Pod",
@@ -98,8 +108,12 @@ const pendingPod = new Pod({
uid: "foobar-pending",
ownerReferences: [{
uid: "pendingJob",
apiVersion: "v1",
kind: "Pod",
name: "pending",
}],
namespace: "default",
selfLink: "/api/v1/pods/default/foobar-pending",
},
});
@@ -112,19 +126,22 @@ const failedPod = new Pod({
uid: "foobar-failed",
ownerReferences: [{
uid: "failedJob",
apiVersion: "v1",
kind: "Pod",
name: "failed",
}],
namespace: "default",
selfLink: "/api/v1/pods/default/foobar-failed",
},
status: {
phase: "Failed",
conditions: [],
hostIP: "10.0.0.1",
podIP: "10.0.0.1",
startTime: "now",
},
});
failedPod.status = {
phase: "Failed",
conditions: [],
hostIP: "10.0.0.1",
podIP: "10.0.0.1",
startTime: "now",
};
const succeededPod = new Pod({
apiVersion: "foo",
kind: "Pod",
@@ -134,21 +151,36 @@ const succeededPod = new Pod({
uid: "foobar-succeeded",
ownerReferences: [{
uid: "succeededJob",
apiVersion: "v1",
kind: "Pod",
name: "succeeded",
}],
namespace: "default",
selfLink: "/api/v1/pods/default/foobar-succeeded",
},
status: {
phase: "Succeeded",
conditions: [],
hostIP: "10.0.0.1",
podIP: "10.0.0.1",
startTime: "now",
},
});
succeededPod.status = {
phase: "Succeeded",
conditions: [],
hostIP: "10.0.0.1",
podIP: "10.0.0.1",
startTime: "now",
};
describe("Job Store tests", () => {
beforeAll(() => {
podsStore.items = observable.array([
let jobStore: JobStore;
beforeEach(() => {
const di = getDiForUnitTesting({ doGeneralOverrides: true });
di.override(storesAndApisCanBeCreatedInjectable, () => true);
jobStore = di.inject(jobStoreInjectable);
const podStore = di.inject(podStoreInjectable);
// Add pods to pod store
podStore.items = observable.array([
runningPod,
failedPod,
pendingPod,
@@ -4,7 +4,10 @@
*/
import { Pod } from "../../../common/k8s-api/endpoints";
import { podsStore } from "../+workloads-pods/pods.store";
import type { PodStore } from "../+workloads-pods/store";
import podStoreInjectable from "../+workloads-pods/store.injectable";
import storesAndApisCanBeCreatedInjectable from "../../stores-apis-can-be-created.injectable";
import { getDiForUnitTesting } from "../../getDiForUnitTesting";
const runningPod = new Pod({
apiVersion: "foo",
@@ -13,32 +16,33 @@ const runningPod = new Pod({
name: "foobar",
resourceVersion: "foobar",
uid: "foobar",
namespace: "default",
selfLink: "/api/v1/pods/default/foobar",
},
status: {
phase: "Running",
conditions: [
{
type: "Initialized",
status: "True",
lastProbeTime: 1,
lastTransitionTime: "1",
},
{
type: "Ready",
status: "True",
lastProbeTime: 1,
lastTransitionTime: "1",
},
],
hostIP: "10.0.0.1",
podIP: "10.0.0.1",
startTime: "now",
containerStatuses: [],
initContainerStatuses: [],
},
});
runningPod.status = {
phase: "Running",
conditions: [
{
type: "Initialized",
status: "True",
lastProbeTime: 1,
lastTransitionTime: "1",
},
{
type: "Ready",
status: "True",
lastProbeTime: 1,
lastTransitionTime: "1",
},
],
hostIP: "10.0.0.1",
podIP: "10.0.0.1",
startTime: "now",
containerStatuses: [],
initContainerStatuses: [],
};
const pendingPod = new Pod({
apiVersion: "foo",
kind: "Pod",
@@ -46,6 +50,8 @@ const pendingPod = new Pod({
name: "foobar-pending",
resourceVersion: "foobar",
uid: "foobar-pending",
namespace: "default",
selfLink: "/api/v1/pods/default/foobar-pending",
},
});
@@ -56,17 +62,18 @@ const failedPod = new Pod({
name: "foobar-failed",
resourceVersion: "foobar",
uid: "foobar-failed",
namespace: "default",
selfLink: "/api/v1/pods/default/foobar-failed",
},
status: {
phase: "Failed",
conditions: [],
hostIP: "10.0.0.1",
podIP: "10.0.0.1",
startTime: "now",
},
});
failedPod.status = {
phase: "Failed",
conditions: [],
hostIP: "10.0.0.1",
podIP: "10.0.0.1",
startTime: "now",
};
const evictedPod = new Pod({
apiVersion: "foo",
kind: "Pod",
@@ -74,18 +81,19 @@ const evictedPod = new Pod({
name: "foobar-evicted",
resourceVersion: "foobar",
uid: "foobar-evicted",
namespace: "default",
selfLink: "/api/v1/pods/default/foobar-evicted",
},
status: {
phase: "Failed",
reason: "Evicted",
conditions: [],
hostIP: "10.0.0.1",
podIP: "10.0.0.1",
startTime: "now",
},
});
evictedPod.status = {
phase: "Failed",
reason: "Evicted",
conditions: [],
hostIP: "10.0.0.1",
podIP: "10.0.0.1",
startTime: "now",
};
const succeededPod = new Pod({
apiVersion: "foo",
kind: "Pod",
@@ -93,20 +101,31 @@ const succeededPod = new Pod({
name: "foobar-succeeded",
resourceVersion: "foobar",
uid: "foobar-succeeded",
namespace: "default",
selfLink: "/api/v1/pods/default/foobar-succeeded",
},
status: {
phase: "Succeeded",
conditions: [],
hostIP: "10.0.0.1",
podIP: "10.0.0.1",
startTime: "now",
},
});
succeededPod.status = {
phase: "Succeeded",
conditions: [],
hostIP: "10.0.0.1",
podIP: "10.0.0.1",
startTime: "now",
};
describe("Pod Store tests", () => {
let podStore: PodStore;
beforeEach(() => {
const di = getDiForUnitTesting({ doGeneralOverrides: true });
di.override(storesAndApisCanBeCreatedInjectable, () => true);
podStore = di.inject(podStoreInjectable);
});
it("gets Pod statuses in proper sorting order", () => {
const statuses = Object.entries(podsStore.getStatuses([
const statuses = Object.entries(podStore.getStatuses([
pendingPod,
runningPod,
succeededPod,
@@ -125,7 +144,7 @@ describe("Pod Store tests", () => {
});
it("counts statuses properly", () => {
const statuses = Object.entries(podsStore.getStatuses([
const statuses = Object.entries(podStore.getStatuses([
pendingPod,
pendingPod,
pendingPod,
@@ -4,9 +4,12 @@
*/
import { observable } from "mobx";
import { podsStore } from "../+workloads-pods/pods.store";
import { replicaSetStore } from "../+workloads-replicasets/replicasets.store";
import podStoreInjectable from "../+workloads-pods/store.injectable";
import replicasetsStoreInjectable from "../+workloads-replicasets/store.injectable";
import type { ReplicaSetStore } from "../+workloads-replicasets/store";
import { ReplicaSet, Pod } from "../../../common/k8s-api/endpoints";
import storesAndApisCanBeCreatedInjectable from "../../stores-apis-can-be-created.injectable";
import { getDiForUnitTesting } from "../../getDiForUnitTesting";
const runningReplicaSet = new ReplicaSet({
apiVersion: "foo",
@@ -16,6 +19,7 @@ const runningReplicaSet = new ReplicaSet({
resourceVersion: "runningReplicaSet",
uid: "runningReplicaSet",
namespace: "default",
selfLink: "/apis/apps/v1/replicasets/default/runningReplicaSet",
},
});
@@ -27,6 +31,7 @@ const failedReplicaSet = new ReplicaSet({
resourceVersion: "failedReplicaSet",
uid: "failedReplicaSet",
namespace: "default",
selfLink: "/apis/apps/v1/replicasets/default/failedReplicaSet",
},
});
@@ -38,6 +43,7 @@ const pendingReplicaSet = new ReplicaSet({
resourceVersion: "pendingReplicaSet",
uid: "pendingReplicaSet",
namespace: "default",
selfLink: "/apis/apps/v1/replicasets/default/pendingReplicaSet",
},
});
@@ -50,34 +56,37 @@ const runningPod = new Pod({
uid: "foobar",
ownerReferences: [{
uid: "runningReplicaSet",
apiVersion: "v1",
kind: "ReplicaSet",
name: "running",
}],
namespace: "default",
selfLink: "/apis/apps/v1/replicasets/default/foobar",
},
status: {
phase: "Running",
conditions: [
{
type: "Initialized",
status: "True",
lastProbeTime: 1,
lastTransitionTime: "1",
},
{
type: "Ready",
status: "True",
lastProbeTime: 1,
lastTransitionTime: "1",
},
],
hostIP: "10.0.0.1",
podIP: "10.0.0.1",
startTime: "now",
containerStatuses: [],
initContainerStatuses: [],
},
});
runningPod.status = {
phase: "Running",
conditions: [
{
type: "Initialized",
status: "True",
lastProbeTime: 1,
lastTransitionTime: "1",
},
{
type: "Ready",
status: "True",
lastProbeTime: 1,
lastTransitionTime: "1",
},
],
hostIP: "10.0.0.1",
podIP: "10.0.0.1",
startTime: "now",
containerStatuses: [],
initContainerStatuses: [],
};
const pendingPod = new Pod({
apiVersion: "foo",
kind: "Pod",
@@ -87,8 +96,12 @@ const pendingPod = new Pod({
uid: "foobar-pending",
ownerReferences: [{
uid: "pendingReplicaSet",
apiVersion: "v1",
kind: "ReplicaSet",
name: "pending",
}],
namespace: "default",
selfLink: "/apis/apps/v1/replicasets/default/foobar-pending",
},
});
@@ -101,22 +114,34 @@ const failedPod = new Pod({
uid: "foobar-failed",
ownerReferences: [{
uid: "failedReplicaSet",
apiVersion: "v1",
kind: "ReplicaSet",
name: "failed",
}],
namespace: "default",
selfLink: "/apis/apps/v1/replicasets/default/foobar-failed",
},
status: {
phase: "Failed",
conditions: [],
hostIP: "10.0.0.1",
podIP: "10.0.0.1",
startTime: "now",
},
});
failedPod.status = {
phase: "Failed",
conditions: [],
hostIP: "10.0.0.1",
podIP: "10.0.0.1",
startTime: "now",
};
describe("ReplicaSet Store tests", () => {
beforeAll(() => {
podsStore.items = observable.array([
let replicaSetStore: ReplicaSetStore;
beforeEach(() => {
const di = getDiForUnitTesting({ doGeneralOverrides: true });
di.override(storesAndApisCanBeCreatedInjectable, () => true);
const podStore = di.inject(podStoreInjectable);
replicaSetStore = di.inject(replicasetsStoreInjectable);
podStore.items = observable.array([
runningPod,
failedPod,
pendingPod,
@@ -4,9 +4,12 @@
*/
import { observable } from "mobx";
import { podsStore } from "../+workloads-pods/pods.store";
import { statefulSetStore } from "../+workloads-statefulsets/statefulset.store";
import podStoreInjectable from "../+workloads-pods/store.injectable";
import type { StatefulSetStore } from "../+workloads-statefulsets/store";
import statefulSetStoreInjectable from "../+workloads-statefulsets/store.injectable";
import { StatefulSet, Pod } from "../../../common/k8s-api/endpoints";
import storesAndApisCanBeCreatedInjectable from "../../stores-apis-can-be-created.injectable";
import { getDiForUnitTesting } from "../../getDiForUnitTesting";
const runningStatefulSet = new StatefulSet({
apiVersion: "foo",
@@ -16,6 +19,7 @@ const runningStatefulSet = new StatefulSet({
resourceVersion: "runningStatefulSet",
uid: "runningStatefulSet",
namespace: "default",
selfLink: "/apis/apps/v1/statefulsets/default/runningStatefulSet",
},
});
@@ -27,6 +31,7 @@ const failedStatefulSet = new StatefulSet({
resourceVersion: "failedStatefulSet",
uid: "failedStatefulSet",
namespace: "default",
selfLink: "/apis/apps/v1/statefulsets/default/failedStatefulSet",
},
});
@@ -38,6 +43,7 @@ const pendingStatefulSet = new StatefulSet({
resourceVersion: "pendingStatefulSet",
uid: "pendingStatefulSet",
namespace: "default",
selfLink: "/apis/apps/v1/statefulsets/default/pendingStatefulSet",
},
});
@@ -50,34 +56,37 @@ const runningPod = new Pod({
uid: "foobar",
ownerReferences: [{
uid: "runningStatefulSet",
apiVersion: "v1",
kind: "StatefulSet",
name: "running",
}],
namespace: "default",
selfLink: "/apis/apps/v1/statefulsets/default/foobar",
},
status: {
phase: "Running",
conditions: [
{
type: "Initialized",
status: "True",
lastProbeTime: 1,
lastTransitionTime: "1",
},
{
type: "Ready",
status: "True",
lastProbeTime: 1,
lastTransitionTime: "1",
},
],
hostIP: "10.0.0.1",
podIP: "10.0.0.1",
startTime: "now",
containerStatuses: [],
initContainerStatuses: [],
},
});
runningPod.status = {
phase: "Running",
conditions: [
{
type: "Initialized",
status: "True",
lastProbeTime: 1,
lastTransitionTime: "1",
},
{
type: "Ready",
status: "True",
lastProbeTime: 1,
lastTransitionTime: "1",
},
],
hostIP: "10.0.0.1",
podIP: "10.0.0.1",
startTime: "now",
containerStatuses: [],
initContainerStatuses: [],
};
const pendingPod = new Pod({
apiVersion: "foo",
kind: "Pod",
@@ -87,8 +96,12 @@ const pendingPod = new Pod({
uid: "foobar-pending",
ownerReferences: [{
uid: "pendingStatefulSet",
apiVersion: "v1",
kind: "StatefulSet",
name: "pending",
}],
namespace: "default",
selfLink: "/apis/apps/v1/statefulsets/default/foobar-pending",
},
});
@@ -101,23 +114,36 @@ const failedPod = new Pod({
uid: "foobar-failed",
ownerReferences: [{
uid: "failedStatefulSet",
apiVersion: "v1",
kind: "StatefulSet",
name: "failed",
}],
namespace: "default",
selfLink: "/apis/apps/v1/statefulsets/default/foobar-failed",
},
status: {
phase: "Failed",
conditions: [],
hostIP: "10.0.0.1",
podIP: "10.0.0.1",
startTime: "now",
},
});
failedPod.status = {
phase: "Failed",
conditions: [],
hostIP: "10.0.0.1",
podIP: "10.0.0.1",
startTime: "now",
};
describe("StatefulSet Store tests", () => {
beforeAll(() => {
let statefulSetStore: StatefulSetStore;
beforeEach(() => {
const di = getDiForUnitTesting({ doGeneralOverrides: true });
di.override(storesAndApisCanBeCreatedInjectable, () => true);
statefulSetStore = di.inject(statefulSetStoreInjectable);
const podStore = di.inject(podStoreInjectable);
// Add pods to pod store
podsStore.items = observable.array([
podStore.items = observable.array([
runningPod,
failedPod,
pendingPod,