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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
fix(truenas): refresh health after manual tests
rcourtmandee729163e99
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex aec2258279..5ace94203b 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -470,6 +470,11 @@ connection form contract. When the operator is editing a saved connection, thatsame path must also accept the in-flight form payload and merge unchangedmasked secrets on the server, so edit-dialog tests do not force credentialre-entry just to validate changed host or TLS fields.+When an operator runs a row-level saved-connection test from that workspace,+`useTrueNASSettingsPanelState.ts` must reload the shared connection summary+after the request completes so the card reflects refreshed last-success or+last-error state instead of leaving stale health beside a success or failure+toast.When that same platform workspace reports TrueNAS as unavailable, the disabledstate must mean the server has explicitly opted out of the default-on TrueNASintegration, not that operators still need to enable a hidden feature gate fordiff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 23393acc53..b75145a08c 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -634,7 +634,12 @@ material instead of forcing the frontend to round-trip redaction placeholdersback through the draft-test API. That saved-connection test route must alsoaccept the edit-form payload for an existing connection and merge unchangedmasked secrets server-side, so editing operators can test changed host / port /-TLS fields before saving without re-entering retained credentials.+TLS fields before saving without re-entering retained credentials. For+row-level saved-connection tests with no edit overlay payload, that same route+must update the canonical TrueNAS poll summary owner so subsequent+`/api/truenas/connections` reads reflect refreshed last-success or last-error+state instead of leaving settings health disconnected from manual operator+tests.That same `/api/truenas/connections` list boundary now also owns theoperator-facing runtime summary for those configured connections. The listresponse must carry the canonical redacted config together with poll healthdiff --git a/docs/release-control/v6/internal/subsystems/monitoring.md b/docs/release-control/v6/internal/subsystems/monitoring.mdindex d1073fab78..c08eb818fb 100644--- a/docs/release-control/v6/internal/subsystems/monitoring.md+++ b/docs/release-control/v6/internal/subsystems/monitoring.md@@ -232,7 +232,11 @@ surface. `internal/monitoring/truenas_poller.go` must honor each configuredTrueNAS connection's `pollIntervalSeconds`, keep the next poll schedule pluslast success/failure state in one canonical runtime owner, and project the mostrecent discovered host/pool/dataset/app/disk/recovery counts there instead of-recomputing settings health panel-by-panel.+recomputing settings health panel-by-panel. That same poller-owned summary must+also absorb manual saved-connection test results from the shared+`POST /api/truenas/connections/{id}/test` path, so row-level operator tests in+settings update the canonical last success / last error state instead of+stopping at disconnected toast notifications.That same runtime owner also defines the feature-default contract for TrueNAS:the API-backed integration is on by default, and `PULSE_ENABLE_TRUENAS` is anexplicit opt-out switch rather than a required bootstrap toggle.diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex cf26f4f421..9bd22a8b72 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -88,7 +88,7 @@ querying, and the operator-facing storage health presentation layer.22. Keep backend-native platform actions on the adjacent AI/runtime and platform contracts. When `internal/api/` wires native TrueNAS app control for Assistant, storage and recovery may consume the refreshed recovery points afterward, but they must not grow a parallel recovery-local action transport or action-specific payload shape.23. Keep backend-native platform diagnostics on the adjacent AI/runtime and platform contracts. When `internal/api/` wires native TrueNAS app log reads for Assistant, storage and recovery may use those diagnostics during investigation, but they must not grow a parallel recovery-local log transport or diagnostic payload shape.24. Keep backend-native platform configuration reads on the adjacent AI/runtime and platform contracts. When `internal/api/` wires native TrueNAS app config for Assistant, storage and recovery may use that runtime shape during investigation, but they must not grow a parallel recovery-local config transport or provider-shaped configuration payload.-25. Keep provider-backed poll cadence and settings-runtime health on the adjacent platform-connections contract. When shared `internal/api/` and poller wiring expose TrueNAS last-sync status, failure summaries, discovered contribution counts, or platform handoff links in settings, storage and recovery may consume the resulting datasets, apps, disks, and recovery artifacts but must not redefine those settings-runtime health semantics or connection-level handoffs in storage/recovery-local transport or page flows.+25. Keep provider-backed poll cadence and settings-runtime health on the adjacent platform-connections contract. When shared `internal/api/` and poller wiring expose TrueNAS last-sync status, failure summaries, discovered contribution counts, manual saved-test status refresh, or platform handoff links in settings, storage and recovery may consume the resulting datasets, apps, disks, and recovery artifacts but must not redefine those settings-runtime health semantics or connection-level handoffs in storage/recovery-local transport or page flows.26. Keep cross-surface recovery handoffs on the shared route-helper contract. When infrastructure or other unified-resource consumers expose TrueNAS recovery links, they must reuse the canonical `frontend-modern/src/routing/resourceLinks.ts` recovery builder with owned `platform` and `node` queries instead of inventing drawer-local recovery URLs or treating PBS services as the only infrastructure-to-recovery path.27. Keep alert-side recovery drill-ins on that same shared route-helper contract. When alert investigation surfaces such as resource-incident panels expose recovery follow-up links for TrueNAS or future API-backed platforms, they must route through the canonical `frontend-modern/src/routing/resourceLinks.ts` recovery builder instead of freezing alert-local recovery URLs or introducing another provider-shaped recovery handoff vocabulary.diff --git a/frontend-modern/src/components/Settings/__tests__/useTrueNASSettingsPanelState.test.tsx b/frontend-modern/src/components/Settings/__tests__/useTrueNASSettingsPanelState.test.tsxindex 980e9624ae..b1197ed06c 100644--- a/frontend-modern/src/components/Settings/__tests__/useTrueNASSettingsPanelState.test.tsx+++ b/frontend-modern/src/components/Settings/__tests__/useTrueNASSettingsPanelState.test.tsx@@ -121,6 +121,22 @@ describe('useTrueNASSettingsPanelState', () => {enabled: true,},] as never);+ vi.mocked(TrueNASAPI.listConnections).mockResolvedValueOnce([+ {+ id: 'conn-1',+ name: 'tower',+ host: 'truenas.local',+ apiKey: '********',+ pollIntervalSeconds: 60,+ useHttps: true,+ insecureSkipVerify: false,+ enabled: true,+ poll: {+ intervalSeconds: 60,+ lastSuccessAt: '2026-03-30T10:00:00Z',+ },+ },+ ] as never);vi.mocked(TrueNASAPI.testSavedConnection).mockResolvedValueOnce({ success: true } as never);const { result } = renderHook(() => useTrueNASSettingsPanelState());@@ -134,6 +150,8 @@ describe('useTrueNASSettingsPanelState', () => {expect(notificationStore.success).toHaveBeenCalledWith('TrueNAS connection successful for tower',);+ expect(TrueNASAPI.listConnections).toHaveBeenCalledTimes(2);+ expect(result.connections()[0].poll?.lastSuccessAt).toBe('2026-03-30T10:00:00Z');});it('tests edited saved connections through the canonical saved-connection API path', async () => {diff --git a/frontend-modern/src/components/Settings/useTrueNASSettingsPanelState.ts b/frontend-modern/src/components/Settings/useTrueNASSettingsPanelState.tsindex 1569f8abe7..b943692702 100644--- a/frontend-modern/src/components/Settings/useTrueNASSettingsPanelState.ts+++ b/frontend-modern/src/components/Settings/useTrueNASSettingsPanelState.ts@@ -263,6 +263,7 @@ export function useTrueNASSettingsPanelState() {logger.error('[TrueNAS Settings] Saved connection test failed', error);} finally {setTesting(false);+ await loadConnections();}};diff --git a/internal/api/contract_test.go b/internal/api/contract_test.goindex 1ee64239a0..4319b85b14 100644--- a/internal/api/contract_test.go+++ b/internal/api/contract_test.go@@ -29,6 +29,7 @@ import ("github.com/rcourtman/pulse-go-rewrite/internal/monitoring""github.com/rcourtman/pulse-go-rewrite/internal/recovery""github.com/rcourtman/pulse-go-rewrite/internal/relay"+ "github.com/rcourtman/pulse-go-rewrite/internal/truenas""github.com/rcourtman/pulse-go-rewrite/internal/unifiedresources""github.com/rcourtman/pulse-go-rewrite/internal/updates"authpkg "github.com/rcourtman/pulse-go-rewrite/pkg/auth"@@ -100,6 +101,42 @@ func TestContract_TrueNASConnectionsDisabledMessageIsExplicit(t *testing.T) {}}+func TestContract_TrueNASSavedConnectionTestsUpdateRuntimeSummary(t *testing.T) {+ setTrueNASFeatureForTest(t, true)++ connection := config.TrueNASInstance{+ ID: "conn-1",+ Name: "tower",+ Host: "truenas.local",+ Port: 443,+ APIKey: "super-secret",+ UseHTTPS: true,+ InsecureSkipVerify: false,+ Enabled: true,+ }+ handler, persistence, _ := newTrueNASHandlersForTest(t, nil)+ if err := persistence.SaveTrueNASConfig([]config.TrueNASInstance{connection}); err != nil {+ t.Fatalf("seed truenas config: %v", err)+ }+ poller := monitoring.NewTrueNASPoller(nil, time.Minute, nil)+ handler.getPoller = func(context.Context) *monitoring.TrueNASPoller { return poller }+ handler.newClient = func(cfg truenas.ClientConfig) (trueNASClient, error) {+ return &fakeTrueNASClient{}, nil+ }++ req := httptest.NewRequest(http.MethodPost, "/api/truenas/connections/conn-1/test", nil)+ rec := httptest.NewRecorder()+ handler.HandleTestSavedConnection(rec, req)++ if rec.Code != http.StatusOK {+ t.Fatalf("expected 200, got %d: %s", rec.Code, rec.Body.String())+ }+ summary := poller.ConnectionSummaries("default", []config.TrueNASInstance{connection})[connection.ID]+ if summary.Poll == nil || summary.Poll.LastSuccessAt == nil {+ t.Fatalf("expected saved manual test to refresh poll summary, got %+v", summary.Poll)+ }+}+func TestContract_SSOTestRejectsMetadataURLWithUserinfo(t *testing.T) {called := make(chan struct{}, 1)metadataServer := newIPv4HTTPServer(t, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {diff --git a/internal/api/truenas_handlers.go b/internal/api/truenas_handlers.goindex df61c151cc..c4eaf7b1db 100644--- a/internal/api/truenas_handlers.go+++ b/internal/api/truenas_handlers.go@@ -275,7 +275,7 @@ func (h *TrueNASHandlers) HandleTestConnection(w http.ResponseWriter, r *http.Rereturn}- h.testConnectionInstance(w, r, instance)+ h.writeConnectionTestResult(w, r, instance)}// HandleTestSavedConnection validates connectivity for one saved TrueNAS@@ -309,7 +309,8 @@ func (h *TrueNASHandlers) HandleTestSavedConnection(w http.ResponseWriter, r *htcontinue}normalizeTrueNASInstance(&instance)- if payload, hasPayload, ok := decodeOptionalTrueNASInstanceRequest(w, r); !ok {+ payload, hasPayload, ok := decodeOptionalTrueNASInstanceRequest(w, r)+ if !ok {return} else if hasPayload {payload.ID = connectionID@@ -321,18 +322,53 @@ func (h *TrueNASHandlers) HandleTestSavedConnection(w http.ResponseWriter, r *ht}instance = payload}- h.testConnectionInstance(w, r, instance)+ invalidConfig, err := h.testConnectionInstance(r, instance)+ if err != nil {+ if !hasPayload && h != nil && h.getPoller != nil {+ if poller := h.getPoller(r.Context()); poller != nil {+ poller.RecordConnectionTestFailure(resolveTenantOrgID(r), connectionID, instance, err, time.Now().UTC())+ }+ }+ if invalidConfig {+ writeErrorResponse(w, http.StatusBadRequest, "truenas_invalid_config", "Invalid TrueNAS connection configuration", map[string]string{"error": err.Error()})+ return+ }+ writeErrorResponse(w, http.StatusBadRequest, "truenas_connection_failed", "Failed to connect to TrueNAS", map[string]string{"error": err.Error()})+ return+ }+ if !hasPayload && h != nil && h.getPoller != nil {+ if poller := h.getPoller(r.Context()); poller != nil {+ poller.RecordConnectionTestSuccess(resolveTenantOrgID(r), connectionID, instance, time.Now().UTC())+ }+ }+ writeJSON(w, http.StatusOK, map[string]any{"success": true})return}writeErrorResponse(w, http.StatusNotFound, "truenas_not_found", "Connection not found", nil)}-func (h *TrueNASHandlers) testConnectionInstance(+func (h *TrueNASHandlers) writeConnectionTestResult(w http.ResponseWriter,r *http.Request,instance config.TrueNASInstance,) {+ invalidConfig, err := h.testConnectionInstance(r, instance)+ if err != nil {+ if invalidConfig {+ writeErrorResponse(w, http.StatusBadRequest, "truenas_invalid_config", "Invalid TrueNAS connection configuration", map[string]string{"error": err.Error()})+ return+ }+ writeErrorResponse(w, http.StatusBadRequest, "truenas_connection_failed", "Failed to connect to TrueNAS", map[string]string{"error": err.Error()})+ return+ }+ writeJSON(w, http.StatusOK, map[string]any{"success": true})+}++func (h *TrueNASHandlers) testConnectionInstance(+ r *http.Request,+ instance config.TrueNASInstance,+) (bool, error) {newClient := h.newClientif newClient == nil {newClient = func(cfg truenas.ClientConfig) (trueNASClient, error) { return truenas.NewClient(cfg) }@@ -350,8 +386,7 @@ func (h *TrueNASHandlers) testConnectionInstance(Timeout: 10 * time.Second,})if err != nil {- writeErrorResponse(w, http.StatusBadRequest, "truenas_invalid_config", "Invalid TrueNAS connection configuration", map[string]string{"error": err.Error()})- return+ return true, err}defer client.Close()@@ -359,11 +394,9 @@ func (h *TrueNASHandlers) testConnectionInstance(defer cancel()if err := client.TestConnection(ctx); err != nil {- writeErrorResponse(w, http.StatusBadRequest, "truenas_connection_failed", "Failed to connect to TrueNAS", map[string]string{"error": err.Error()})- return+ return false, err}-- writeJSON(w, http.StatusOK, map[string]any{"success": true})+ return false, nil}func normalizeTrueNASInstance(instance *config.TrueNASInstance) {diff --git a/internal/api/truenas_handlers_test.go b/internal/api/truenas_handlers_test.goindex e26564d921..d4d381631e 100644--- a/internal/api/truenas_handlers_test.go+++ b/internal/api/truenas_handlers_test.go@@ -492,21 +492,22 @@ func TestTrueNASHandlers_HandleTestConnection_SuccessAndFailure(t *testing.T) {func TestTrueNASHandlers_HandleTestSavedConnection_UsesStoredSecrets(t *testing.T) {setTrueNASFeatureForTest(t, true)+ connection := config.TrueNASInstance{+ ID: "conn-1",+ Name: "tower",+ Host: "truenas.local",+ Port: 443,+ APIKey: "super-secret",+ UseHTTPS: true,+ InsecureSkipVerify: false,+ Enabled: true,+ }handler, persistence, _ := newTrueNASHandlersForTest(t, nil)- if err := persistence.SaveTrueNASConfig([]config.TrueNASInstance{- {- ID: "conn-1",- Name: "tower",- Host: "truenas.local",- Port: 443,- APIKey: "super-secret",- UseHTTPS: true,- InsecureSkipVerify: false,- Enabled: true,- },- }); err != nil {+ if err := persistence.SaveTrueNASConfig([]config.TrueNASInstance{connection}); err != nil {t.Fatalf("seed truenas config: %v", err)}+ poller := monitoring.NewTrueNASPoller(nil, time.Second, nil)+ handler.getPoller = func(context.Context) *monitoring.TrueNASPoller { return poller }var gotConfig truenas.ClientConfighandler.newClient = func(cfg truenas.ClientConfig) (trueNASClient, error) {@@ -524,6 +525,10 @@ func TestTrueNASHandlers_HandleTestSavedConnection_UsesStoredSecrets(t *testing.if gotConfig.Host != "truenas.local" || gotConfig.APIKey != "super-secret" || !gotConfig.UseHTTPS {t.Fatalf("unexpected saved client config: %+v", gotConfig)}+ summary := poller.ConnectionSummaries("default", []config.TrueNASInstance{connection})[connection.ID]+ if summary.Poll == nil || summary.Poll.LastSuccessAt == nil {+ t.Fatalf("expected saved retest to update poll summary success state, got %+v", summary.Poll)+ }missingReq := httptest.NewRequest(http.MethodPost, "/api/truenas/connections/missing/test", nil)missingRec := httptest.NewRecorder()@@ -534,6 +539,47 @@ func TestTrueNASHandlers_HandleTestSavedConnection_UsesStoredSecrets(t *testing.}}+func TestTrueNASHandlers_HandleTestSavedConnection_UpdatesPollSummaryFailure(t *testing.T) {+ setTrueNASFeatureForTest(t, true)++ connection := config.TrueNASInstance{+ ID: "conn-1",+ Name: "tower",+ Host: "truenas.local",+ Port: 443,+ APIKey: "super-secret",+ UseHTTPS: true,+ InsecureSkipVerify: false,+ Enabled: true,+ }+ handler, persistence, _ := newTrueNASHandlersForTest(t, nil)+ if err := persistence.SaveTrueNASConfig([]config.TrueNASInstance{connection}); err != nil {+ t.Fatalf("seed truenas config: %v", err)+ }+ poller := monitoring.NewTrueNASPoller(nil, time.Second, nil)+ handler.getPoller = func(context.Context) *monitoring.TrueNASPoller { return poller }+ handler.newClient = func(cfg truenas.ClientConfig) (trueNASClient, error) {+ return &fakeTrueNASClient{+ testConnection: func(context.Context) error { return errors.New("authentication failed") },+ }, nil+ }++ req := httptest.NewRequest(http.MethodPost, "/api/truenas/connections/conn-1/test", nil)+ rec := httptest.NewRecorder()+ handler.HandleTestSavedConnection(rec, req)++ if rec.Code != http.StatusBadRequest {+ t.Fatalf("expected 400, got %d: %s", rec.Code, rec.Body.String())+ }+ summary := poller.ConnectionSummaries("default", []config.TrueNASInstance{connection})[connection.ID]+ if summary.Poll == nil || summary.Poll.LastError == nil {+ t.Fatalf("expected saved retest failure to update poll summary, got %+v", summary.Poll)+ }+ if summary.Poll.LastError.Message != "authentication failed" {+ t.Fatalf("expected failure message preserved, got %+v", summary.Poll.LastError)+ }+}+func TestTrueNASHandlers_HandleTestSavedConnection_MergesEditedPayloadWithStoredSecrets(t *testing.T) {setTrueNASFeatureForTest(t, true)diff --git a/internal/monitoring/truenas_poller.go b/internal/monitoring/truenas_poller.goindex e25d2e449c..d5aa3b4397 100644--- a/internal/monitoring/truenas_poller.go+++ b/internal/monitoring/truenas_poller.go@@ -684,7 +684,9 @@ func (p *TrueNASPoller) recordConnectionSuccessLocked(status.lastError = nilstatus.consecutiveFailures = 0status.nextPollAt = at.Add(p.effectiveRuntimePollInterval(instance))- status.observed = buildTrueNASObservedSummary(snapshot)+ if snapshot != nil {+ status.observed = buildTrueNASObservedSummary(snapshot)+ }}func (p *TrueNASPoller) recordConnectionFailureLocked(@@ -710,6 +712,55 @@ func (p *TrueNASPoller) recordConnectionFailureLocked(}}+// RecordConnectionTestSuccess updates one saved TrueNAS connection summary after+// a manual row-level test without clearing the last observed contribution+// summary.+func (p *TrueNASPoller) RecordConnectionTestSuccess(+ orgID string,+ connID string,+ instance config.TrueNASInstance,+ at time.Time,+) {+ if p == nil {+ return+ }+ connID = strings.TrimSpace(connID)+ if connID == "" {+ return+ }+ orgID = normalizeTrueNASOrgID(orgID)+ instance.ApplyDefaults()++ p.mu.Lock()+ defer p.mu.Unlock()+ p.recordConnectionSuccessLocked(orgID, connID, instance, at, nil)+}++// RecordConnectionTestFailure updates one saved TrueNAS connection summary after+// a manual row-level test failure while preserving any previously observed+// resource contribution summary.+func (p *TrueNASPoller) RecordConnectionTestFailure(+ orgID string,+ connID string,+ instance config.TrueNASInstance,+ err error,+ at time.Time,+) {+ if p == nil || err == nil {+ return+ }+ connID = strings.TrimSpace(connID)+ if connID == "" {+ return+ }+ orgID = normalizeTrueNASOrgID(orgID)+ instance.ApplyDefaults()++ p.mu.Lock()+ defer p.mu.Unlock()+ p.recordConnectionFailureLocked(orgID, connID, instance, err, at)+}+func buildTrueNASObservedSummary(snapshot *truenas.FixtureSnapshot) *TrueNASConnectionObservedSummary {if snapshot == nil {return nildiff --git a/internal/monitoring/truenas_poller_test.go b/internal/monitoring/truenas_poller_test.goindex c33f4ba71c..d824aa09fb 100644--- a/internal/monitoring/truenas_poller_test.go+++ b/internal/monitoring/truenas_poller_test.go@@ -3,6 +3,7 @@ package monitoringimport ("bytes""context"+ "errors""fmt""net""net/http"@@ -325,6 +326,47 @@ func TestTrueNASPollerConnectionSummariesCaptureFailures(t *testing.T) {}}+func TestTrueNASPollerManualConnectionTestsUpdateSummariesWithoutClearingObservedCounts(t *testing.T) {+ poller := NewTrueNASPoller(nil, time.Minute, nil)+ connection := config.TrueNASInstance{+ ID: "manual-test-conn",+ Host: "manual-test.local",+ APIKey: "secret",+ UseHTTPS: true,+ Enabled: true,+ PollIntervalSecs: 120,+ }+ connection.ApplyDefaults()++ snapshot := &truenas.FixtureSnapshot{+ System: truenas.SystemInfo{+ Hostname: "manual-test",+ },+ Pools: []truenas.Pool{{Name: "tank"}},+ }+ firstSuccess := time.Date(2026, time.March, 30, 10, 0, 0, 0, time.UTC)+ failureAt := firstSuccess.Add(2 * time.Minute)+ manualSuccessAt := failureAt.Add(2 * time.Minute)++ poller.mu.Lock()+ poller.recordConnectionSuccessLocked("default", connection.ID, connection, firstSuccess, snapshot)+ poller.recordConnectionFailureLocked("default", connection.ID, connection, errors.New("manual auth failed"), failureAt)+ poller.mu.Unlock()++ poller.RecordConnectionTestSuccess("default", connection.ID, connection, manualSuccessAt)++ summary := poller.ConnectionSummaries("default", []config.TrueNASInstance{connection})[connection.ID]+ if summary.Poll == nil || summary.Poll.LastSuccessAt == nil {+ t.Fatalf("expected manual success to update poll summary, got %+v", summary.Poll)+ }+ if summary.Poll.LastError != nil {+ t.Fatalf("expected manual success to clear previous error, got %+v", summary.Poll.LastError)+ }+ if summary.Observed == nil || summary.Observed.Host != "manual-test" || summary.Observed.StoragePools != 1 {+ t.Fatalf("expected observed summary to be preserved after manual success, got %+v", summary.Observed)+ }+}+func TestTrueNASPollerHonorsConfiguredPollInterval(t *testing.T) {previous := truenas.IsFeatureEnabled()truenas.SetFeatureEnabled(true)diff --git a/tests/integration/tests/21-truenas-settings-platform-connections.spec.ts b/tests/integration/tests/21-truenas-settings-platform-connections.spec.tsindex 998a09e1c8..54389e2989 100644--- a/tests/integration/tests/21-truenas-settings-platform-connections.spec.ts+++ b/tests/integration/tests/21-truenas-settings-platform-connections.spec.ts@@ -31,6 +31,13 @@ const WORKFLOW_SCREENSHOT_PATH = path.resolve('tmp','truenas-settings-platform-workflow.png',);+const HEALTH_REFRESH_SCREENSHOT_PATH = path.resolve(+ __dirname,+ '..',+ '..',+ 'tmp',+ 'truenas-settings-health-refresh.png',+);const test = base.extend<{}, WorkerFixtures>({storageState: async ({ authStorageStatePath }, use) => {@@ -452,6 +459,98 @@ test.describe('TrueNAS platform connections settings', () => {await page.screenshot({ path: WORKFLOW_SCREENSHOT_PATH, fullPage: true });});+ test('saved connection tests refresh runtime health in the settings card', async ({ page }) => {+ const failedAt = new Date(Date.now() - 5 * 60_000).toISOString();+ const recoveredAt = new Date().toISOString();+ let savedTestCalls = 0;+ let connection = {+ id: 'conn-1',+ name: 'Tower NAS',+ host: 'tower.local',+ port: 443,+ apiKey: '********',+ useHttps: true,+ insecureSkipVerify: false,+ enabled: true,+ pollIntervalSeconds: 60,+ poll: {+ intervalSeconds: 60,+ lastAttemptAt: failedAt,+ consecutiveFailures: 2,+ lastError: {+ at: failedAt,+ message: 'authentication failed',+ category: 'auth',+ },+ },+ observed: {+ host: 'tower',+ resourceId: 'tower',+ collectedAt: failedAt,+ systems: 1,+ storagePools: 2,+ datasets: 12,+ apps: 4,+ disks: 8,+ recoveryArtifacts: 18,+ },+ };++ await page.route('**/api/truenas/connections**', async (route) => {+ const request = route.request();+ const method = request.method();+ const pathname = new URL(request.url()).pathname;++ if (pathname === '/api/truenas/connections' && method === 'GET') {+ await route.fulfill({+ status: 200,+ contentType: 'application/json',+ body: JSON.stringify([connection]),+ });+ return;+ }++ if (pathname === '/api/truenas/connections/conn-1/test' && method === 'POST') {+ savedTestCalls += 1;+ connection = {+ ...connection,+ poll: {+ intervalSeconds: 60,+ lastSuccessAt: recoveredAt,+ },+ };+ await route.fulfill({+ status: 200,+ contentType: 'application/json',+ body: JSON.stringify({ success: true }),+ });+ return;+ }++ await route.continue();+ });++ await page.goto('/settings/infrastructure/platforms/truenas', {+ waitUntil: 'domcontentloaded',+ });+ await page.waitForURL(/\/settings\/infrastructure\/platforms\/truenas/, {+ timeout: 15_000,+ });++ const connectionCard = page.getByTestId('truenas-connection-conn-1');+ await expect(connectionCard).toContainText('Sync failing');+ await expect(connectionCard).toContainText('authentication failed');++ await connectionCard.getByRole('button', { name: 'Test' }).click();++ await expect.poll(() => savedTestCalls).toBe(1);+ await expect(connectionCard).toContainText('Healthy');+ await expect(connectionCard).not.toContainText('authentication failed');++ fs.mkdirSync(path.dirname(HEALTH_REFRESH_SCREENSHOT_PATH), { recursive: true });+ await page.screenshot({ path: HEALTH_REFRESH_SCREENSHOT_PATH, fullPage: true });+ });+test('counts TrueNAS alongside the other platform connections on the operations summary', async ({page,}) => {