]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/osd-summary.pipe.spec.ts
import ceph 15.2.14
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / ceph / dashboard / osd-summary.pipe.spec.ts
index 5b7010907d3408d301464ade07839b2e9fdc2edb..6df9bf4d4e8709d74b35a811ca3faa1b180bd0fb 100644 (file)
@@ -45,7 +45,7 @@ describe('OsdSummaryPipe', () => {
     ]);
   });
 
-  it('transforms having 3 osd with 2 up, 1 in, 1 down, 1 out', () => {
+  it('transforms having 3 osd with 2 up, 1 in, 1 down, 2 out', () => {
     const value = {
       osds: [
         { up: 1, in: 1 },
@@ -71,18 +71,18 @@ describe('OsdSummaryPipe', () => {
         class: 'card-text-line-break'
       },
       {
-        content: '1 down, 1 out',
+        content: '1 down, 2 out',
         class: 'card-text-error'
       }
     ]);
   });
 
-  it('transforms having 3 osd with 2 up, 2 in, 1 down, 0 out', () => {
+  it('transforms having 3 osd with 2 up, 3 in, 1 down, 0 out', () => {
     const value = {
       osds: [
         { up: 1, in: 1 },
         { up: 1, in: 1 },
-        { up: 0, in: 0 }
+        { up: 0, in: 1 }
       ]
     };
     expect(pipe.transform(value)).toEqual([
@@ -95,7 +95,7 @@ describe('OsdSummaryPipe', () => {
         class: 'card-text-line-break'
       },
       {
-        content: '2 up, 2 in',
+        content: '2 up, 3 in',
         class: ''
       },
       {
@@ -140,4 +140,37 @@ describe('OsdSummaryPipe', () => {
       }
     ]);
   });
+
+  it('transforms having 4 osd with 3 up, 2 in, 1 down, another 2 out', () => {
+    const value = {
+      osds: [
+        { up: 1, in: 1 },
+        { up: 1, in: 0 },
+        { up: 1, in: 0 },
+        { up: 0, in: 1 }
+      ]
+    };
+    expect(pipe.transform(value)).toEqual([
+      {
+        content: '4 total',
+        class: ''
+      },
+      {
+        content: '',
+        class: 'card-text-line-break'
+      },
+      {
+        content: '3 up, 2 in',
+        class: ''
+      },
+      {
+        content: '',
+        class: 'card-text-line-break'
+      },
+      {
+        content: '1 down, 2 out',
+        class: 'card-text-error'
+      }
+    ]);
+  });
 });