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.

Control the backup count poll clock before mounting its consumer

pulse-triage[bot]187b3034d1ba
diff --git a/frontend-modern/src/features/proxmox/__tests__/backupServerCountEvidence.test.tsx b/frontend-modern/src/features/proxmox/__tests__/backupServerCountEvidence.test.tsx
index 85e68220d7..0ea9aea458 100644
--- a/frontend-modern/src/features/proxmox/__tests__/backupServerCountEvidence.test.tsx
+++ b/frontend-modern/src/features/proxmox/__tests__/backupServerCountEvidence.test.tsx
@@ -126,6 +126,7 @@ describe('PBS server count identity', () => {
});
it('replaces exact server counts on polling, withdrawing failed reads without losing capacity', async () => {
+ vi.useFakeTimers({ toFake: ['Date', 'setInterval', 'clearInterval'] });
vi.stubGlobal('scrollTo', vi.fn());
window.history.replaceState({}, '', '/proxmox/backups/date');
let payload = inventory(entry('pbs-main'), entry('pbs-main', 'tank', '2'));
@@ -164,17 +165,13 @@ describe('PBS server count identity', () => {
// Only the query's actual 30-second polling is advanced; no direct call to
// the count producer and no fabricated rendered rows in this consumer test.
- vi.useFakeTimers();
payload = inventory(entry('main'), entry('main', 'tank', '2'), entry('main', 'tank', '3'));
await vi.advanceTimersByTimeAsync(30_000);
- vi.useRealTimers();
await waitFor(() => expect(displayedCounts(table)).toEqual(['3', '0']));
expect(screen.getByTestId('pbs-count-owner-detail')).toBe(detail);
- vi.useFakeTimers();
failed = true;
await vi.advanceTimersByTimeAsync(30_000);
- vi.useRealTimers();
await screen.findByRole('button', { name: 'Retry PBS inventory' });
await waitFor(() => expect(displayedCounts(table)).toEqual(['Unavailable', 'Unavailable']));
expect(within(table).getAllByText('40.0%')).toHaveLength(2);