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.

Pin TLS in the TrueNAS telemetry pipeline fixture

pulse-triage[bot]dc6a66a62cb1
diff --git a/internal/monitoring/truenas_poller_test.go b/internal/monitoring/truenas_poller_test.go
index af4425c40f..af66fc999e 100644
--- a/internal/monitoring/truenas_poller_test.go
+++ b/internal/monitoring/truenas_poller_test.go
@@ -2,6 +2,7 @@ package monitoring
import (
"context"
+ "crypto/sha256"
"encoding/json"
"errors"
"fmt"
@@ -2227,7 +2228,7 @@ func TestTrueNASPartialReportingPipeline(t *testing.T) {
{`[{"name":"cpu","legend":["usage"],"data":[[1789000060,0]]},{"name":"memory","legend":["free"],"data":[[1789000060,0]]},{"name":"interface","legend":["received"],"data":[[1789000060,0]]},{"name":"disk","legend":["write"],"data":[[1789000060,0]]}]`, 200, map[string]float64{"cpu": 0, "memory": 100, "netin": 0, "diskwrite": 0}, ""},
}
var current atomic.Int64
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ server := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
switch r.URL.Path {
case "/api/v2.0/system/info":
@@ -2245,7 +2246,8 @@ func TestTrueNASPartialReportingPipeline(t *testing.T) {
}
}))
defer server.Close()
- client, err := truenas.NewClient(truenas.ClientConfig{Host: server.URL, APIKey: "synthetic"})
+ fingerprint := fmt.Sprintf("%x", sha256.Sum256(server.Certificate().Raw))
+ client, err := truenas.NewClient(truenas.ClientConfig{Host: server.URL, APIKey: "synthetic", Fingerprint: fingerprint})
if err != nil {
t.Fatal(err)
}