Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

test(recovery): prove degraded metadata rendering

rcourtman3287150c5e52
diff --git a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
index 03f33a4c45..710baaf6cc 100644
--- a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
+++ b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
@@ -373,6 +373,69 @@ describe('Recovery', () => {
}
});
+ it('renders degraded recovery records when item refs and details metadata are omitted', async () => {
+ rollupsPayload.push({
+ rollupId: 'res:pvc-1',
+ itemResourceId: 'pvc-1',
+ display: {
+ itemLabel: 'default/data',
+ itemType: 'pvc',
+ },
+ lastAttemptAt: '2026-02-15T11:00:00.000Z',
+ lastSuccessAt: '2026-02-15T11:00:00.000Z',
+ lastOutcome: 'success',
+ platforms: ['kubernetes'],
+ });
+ pointsByRollupId['res:pvc-1'] = [
+ {
+ id: 'pvc-point-1',
+ platform: 'kubernetes',
+ kind: 'snapshot',
+ mode: 'snapshot',
+ outcome: 'success',
+ completedAt: '2026-02-15T11:00:00.000Z',
+ display: {
+ itemLabel: 'default/data',
+ itemType: 'pvc',
+ namespaceLabel: 'default',
+ detailsSummary: 'Immutable copy',
+ },
+ },
+ ];
+
+ try {
+ render(() => <Recovery />);
+
+ const item = await screen.findByText('default/data');
+ fireEvent.click(item);
+
+ await screen.findByText('Recovery Events');
+ const tables = await screen.findAllByRole('table');
+ const historyTable = tables[tables.length - 1];
+ expect(within(historyTable).getByText('default/data')).toBeInTheDocument();
+ expect(within(historyTable).getByText('PVC')).toBeInTheDocument();
+ expect(within(historyTable).getByText('K8s')).toBeInTheDocument();
+ expect(within(historyTable).getByText('Immutable copy')).toBeInTheDocument();
+
+ fireEvent.click(within(historyTable).getByText('11:00'));
+
+ const detailsPanel = await screen.findByText('Recovery Point Details');
+ const detailsCell = detailsPanel.closest('td');
+ expect(detailsCell).not.toBeNull();
+ expect(within(detailsCell as HTMLTableCellElement).getByText('Item Type')).toBeInTheDocument();
+ expect(within(detailsCell as HTMLTableCellElement).getByText('PVC')).toBeInTheDocument();
+ expect(
+ within(detailsCell as HTMLTableCellElement).getByText('Namespace / Group'),
+ ).toBeInTheDocument();
+ expect(within(detailsCell as HTMLTableCellElement).getByText('default')).toBeInTheDocument();
+ expect(within(detailsCell as HTMLTableCellElement).queryByText('Item Ref')).not.toBeInTheDocument();
+ expect(within(detailsCell as HTMLTableCellElement).queryByText('Target Ref')).not.toBeInTheDocument();
+ } finally {
+ rollupsPayload.pop();
+ delete pointsByRollupId['res:pvc-1'];
+ }
+ });
+
it('keeps recovery history width aligned with canonical column specs', async () => {
render(() => <Recovery />);
diff --git a/frontend-modern/src/utils/__tests__/recoveryPlatformModel.test.ts b/frontend-modern/src/utils/__tests__/recoveryPlatformModel.test.ts
index f8914da6d6..258837bffa 100644
--- a/frontend-modern/src/utils/__tests__/recoveryPlatformModel.test.ts
+++ b/frontend-modern/src/utils/__tests__/recoveryPlatformModel.test.ts
@@ -163,4 +163,56 @@ describe('recoveryPlatformModel', () => {
meta: { page: 1, limit: 100, total: 1, totalPages: 1 },
});
});
+
+ it('preserves display fallback data when degraded recovery metadata fields are omitted', () => {
+ expect(
+ normalizeRecoveryPoint({
+ id: 'point-malformed',
+ provider: 'kubernetes',
+ kind: 'snapshot',
+ mode: 'snapshot',
+ outcome: 'success',
+ subjectResourceId: 'pvc-1',
+ display: {
+ subjectLabel: 'default/data',
+ subjectType: 'k8s-pvc',
+ detailsSummary: 'Immutable copy',
+ },
+ }),
+ ).toEqual({
+ id: 'point-malformed',
+ platform: 'kubernetes',
+ kind: 'snapshot',
+ mode: 'snapshot',
+ outcome: 'success',
+ itemResourceId: 'pvc-1',
+ display: {
+ itemLabel: 'default/data',
+ itemType: 'k8s-pvc',
+ detailsSummary: 'Immutable copy',
+ },
+ });
+
+ expect(
+ normalizeRecoveryRollup({
+ rollupId: 'rollup-malformed',
+ lastOutcome: 'warning',
+ subjectResourceId: 'pvc-1',
+ providers: ['kubernetes'],
+ display: {
+ subjectLabel: 'default/data',
+ subjectType: 'k8s-pvc',
+ },
+ }),
+ ).toEqual({
+ rollupId: 'rollup-malformed',
+ lastOutcome: 'warning',
+ itemResourceId: 'pvc-1',
+ platforms: ['kubernetes'],
+ display: {
+ itemLabel: 'default/data',
+ itemType: 'k8s-pvc',
+ },
+ });
+ });
});