diff --git a/src/common/k8s-api/endpoints/pod.api.ts b/src/common/k8s-api/endpoints/pod.api.ts
index 7b0bf55e9e..28c871b57f 100644
--- a/src/common/k8s-api/endpoints/pod.api.ts
+++ b/src/common/k8s-api/endpoints/pod.api.ts
@@ -294,8 +294,10 @@ export interface CephfsSource {
secretRef?: SecretReference;
/**
* Whether the filesystem is used as readOnly.
+ *
+ * @default false
*/
- readOnly: boolean;
+ readOnly?: boolean;
}
export interface CinderSource {
diff --git a/src/renderer/components/+workloads-pods/details/volumes/variants/__tests__/__snapshots__/ceph-fs.test.tsx.snap b/src/renderer/components/+workloads-pods/details/volumes/variants/__tests__/__snapshots__/ceph-fs.test.tsx.snap
new file mode 100644
index 0000000000..5e03a7f9f5
--- /dev/null
+++ b/src/renderer/components/+workloads-pods/details/volumes/variants/__tests__/__snapshots__/ceph-fs.test.tsx.snap
@@ -0,0 +1,226 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[` should render 'false' for Readonly when false is provided 1`] = `
+
+
+
+
+ Mount Path
+
+
+ /
+
+
+
+
+ Username
+
+
+ admin
+
+
+
+
+ Secret Filepath
+
+
+ /etc/ceph/user.secret
+
+
+
+
+ Readonly
+
+
+ false
+
+
+
+`;
+
+exports[` should render 'false' for Readonly when not provided 1`] = `
+
+
+
+
+ Mount Path
+
+
+ /
+
+
+
+
+ Username
+
+
+ admin
+
+
+
+
+ Secret Filepath
+
+
+ /etc/ceph/user.secret
+
+
+
+
+ Readonly
+
+
+ false
+
+
+
+`;
+
+exports[` should render 'true' for Readonly when true is provided 1`] = `
+
+
+
+
+ Mount Path
+
+
+ /
+
+
+
+
+ Username
+
+
+ admin
+
+
+
+
+ Secret Filepath
+
+
+ /etc/ceph/user.secret
+
+
+
+
+ Readonly
+
+
+ true
+
+
+
+`;
diff --git a/src/renderer/components/+workloads-pods/details/volumes/variants/__tests__/ceph-fs.test.tsx b/src/renderer/components/+workloads-pods/details/volumes/variants/__tests__/ceph-fs.test.tsx
new file mode 100644
index 0000000000..967a2a0fc9
--- /dev/null
+++ b/src/renderer/components/+workloads-pods/details/volumes/variants/__tests__/ceph-fs.test.tsx
@@ -0,0 +1,116 @@
+/**
+ * Copyright (c) OpenLens Authors. All rights reserved.
+ * Licensed under MIT License. See LICENSE in root directory for more information.
+ */
+
+import { render } from "@testing-library/react";
+import React from "react";
+import type { CephfsSource } from "../../../../../../../common/k8s-api/endpoints";
+import { Pod } from "../../../../../../../common/k8s-api/endpoints";
+import { CephFs } from "../ceph-fs";
+
+describe("", () => {
+ it("should render 'false' for Readonly when not provided", () => {
+ const cephfsName = "my-ceph";
+ const cephfsVolume: CephfsSource = {
+ monitors: [],
+ };
+ const pod = new Pod({
+ apiVersion: "v1",
+ kind: "Pod",
+ metadata: {
+ name: "my-pod",
+ namespace: "default",
+ resourceVersion: "1",
+ uid: "123",
+ selfLink: "/api/v1/pod/default/my-pod",
+ },
+ spec: {
+ volumes: [{
+ name: cephfsName,
+ cephfs: cephfsVolume,
+ }],
+ },
+ });
+ const result = render((
+
+ ));
+
+ expect(result.container).toMatchSnapshot();
+ expect(result.getByTestId("cephfs-readonly").innerText).toBe("false");
+ });
+
+ it("should render 'false' for Readonly when false is provided", () => {
+ const cephfsName = "my-ceph";
+ const cephfsVolume: CephfsSource = {
+ monitors: [],
+ readOnly: false,
+ };
+ const pod = new Pod({
+ apiVersion: "v1",
+ kind: "Pod",
+ metadata: {
+ name: "my-pod",
+ namespace: "default",
+ resourceVersion: "1",
+ uid: "123",
+ selfLink: "/api/v1/pod/default/my-pod",
+ },
+ spec: {
+ volumes: [{
+ name: cephfsName,
+ cephfs: cephfsVolume,
+ }],
+ },
+ });
+ const result = render((
+
+ ));
+
+ expect(result.container).toMatchSnapshot();
+ expect(result.getByTestId("cephfs-readonly").innerText).toBe("false");
+ });
+
+ it("should render 'true' for Readonly when true is provided", () => {
+ const cephfsName = "my-ceph";
+ const cephfsVolume: CephfsSource = {
+ monitors: [],
+ readOnly: true,
+ };
+ const pod = new Pod({
+ apiVersion: "v1",
+ kind: "Pod",
+ metadata: {
+ name: "my-pod",
+ namespace: "default",
+ resourceVersion: "1",
+ uid: "123",
+ selfLink: "/api/v1/pod/default/my-pod",
+ },
+ spec: {
+ volumes: [{
+ name: cephfsName,
+ cephfs: cephfsVolume,
+ }],
+ },
+ });
+ const result = render((
+
+ ));
+
+ expect(result.container).toMatchSnapshot();
+ expect(result.getByTestId("cephfs-readonly").innerText).toBe("true");
+ });
+});
diff --git a/src/renderer/components/+workloads-pods/details/volumes/variants/ceph-fs.tsx b/src/renderer/components/+workloads-pods/details/volumes/variants/ceph-fs.tsx
index 0b44e7d355..4367269eb4 100644
--- a/src/renderer/components/+workloads-pods/details/volumes/variants/ceph-fs.tsx
+++ b/src/renderer/components/+workloads-pods/details/volumes/variants/ceph-fs.tsx
@@ -10,7 +10,7 @@ import type { VolumeVariantComponent } from "../variant-helpers";
import { LocalRef } from "../variant-helpers";
export const CephFs: VolumeVariantComponent<"cephfs"> = (
- ({ pod, variant: { monitors, path = "/", user = "admin", secretFile = "/etc/ceph/user.secret", secretRef, readOnly }}) => (
+ ({ pod, variant: { monitors, path = "/", user = "admin", secretFile = "/etc/ceph/user.secret", secretRef, readOnly = false }}) => (
<>
@@ -39,7 +39,7 @@ export const CephFs: VolumeVariantComponent<"cephfs"> = (
)
}
-
+
{readOnly.toString()}
>
diff --git a/src/renderer/components/drawer/drawer-item.tsx b/src/renderer/components/drawer/drawer-item.tsx
index 737749f783..1c9758b7d2 100644
--- a/src/renderer/components/drawer/drawer-item.tsx
+++ b/src/renderer/components/drawer/drawer-item.tsx
@@ -13,6 +13,7 @@ export interface DrawerItemProps extends React.HTMLAttributes {
labelsOnly?: boolean;
hidden?: boolean;
renderBoolean?: boolean; // show "true" or "false" for all of the children elements are "typeof boolean"
+ valueTestId?: string;
}
export function DrawerItem({
@@ -23,6 +24,7 @@ export function DrawerItem({
hidden = false,
className,
renderBoolean,
+ valueTestId,
...elemProps
}: DrawerItemProps) {
if (hidden) {
@@ -36,7 +38,7 @@ export function DrawerItem({
title={title}
>
{name}
- {displayBooleans(renderBoolean, children)}
+ {displayBooleans(renderBoolean, children)}
);
}