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.

Fix test failures from API signature changes

rcourtman94b07a892e90
diff --git a/internal/monitoring/monitor_temperature_toggle_test.go b/internal/monitoring/monitor_temperature_toggle_test.go
deleted file mode 100644
index 7e13bb88a3..0000000000
--- a/internal/monitoring/monitor_temperature_toggle_test.go
+++ /dev/null
@@ -1,43 +0,0 @@
-package monitoring
-
-import (
- "path/filepath"
- "testing"
-
- "github.com/rcourtman/pulse-go-rewrite/internal/config"
-)
-
-func TestMonitorTemperatureCollectorToggle(t *testing.T) {
- t.Parallel()
-
- cfg := &config.Config{TemperatureMonitoringEnabled: false}
-
- service := newTemperatureService(false, "root", filepath.Join(t.TempDir(), "id_ed25519_sensors"), 22)
-
- m := &Monitor{
- config: cfg,
- tempService: service,
- }
-
- if provider := m.temperatureService(); provider == nil {
- t.Fatalf("expected temperature service to be present")
- } else if provider.Enabled() {
- t.Fatalf("expected service to start disabled")
- }
-
- m.EnableTemperatureMonitoring()
- if !cfg.TemperatureMonitoringEnabled {
- t.Fatalf("expected config flag to be true after enabling")
- }
- if provider := m.temperatureService(); provider == nil || !provider.Enabled() {
- t.Fatalf("expected service to be enabled after EnableTemperatureMonitoring")
- }
-
- m.DisableTemperatureMonitoring()
- if cfg.TemperatureMonitoringEnabled {
- t.Fatalf("expected config flag to be false after disabling")
- }
- if provider := m.temperatureService(); provider == nil || provider.Enabled() {
- t.Fatalf("expected service to be disabled after DisableTemperatureMonitoring")
- }
-}
diff --git a/internal/ssh/knownhosts/manager_test.go b/internal/ssh/knownhosts/manager_test.go
index 9d741c0e29..d29ce63898 100644
--- a/internal/ssh/knownhosts/manager_test.go
+++ b/internal/ssh/knownhosts/manager_test.go
@@ -14,7 +14,7 @@ func TestEnsureCreatesFileAndCaches(t *testing.T) {
path := filepath.Join(dir, "known_hosts")
var calls int
- keyscan := func(ctx context.Context, host string, timeout time.Duration) ([]byte, error) {
+ keyscan := func(ctx context.Context, host string, port int, timeout time.Duration) ([]byte, error) {
calls++
return []byte(host + " ssh-ed25519 AAAA"), nil
}
@@ -44,7 +44,7 @@ func TestEnsureUsesSanitizedOutput(t *testing.T) {
dir := t.TempDir()
path := filepath.Join(dir, "known_hosts")
- keyscan := func(ctx context.Context, host string, timeout time.Duration) ([]byte, error) {
+ keyscan := func(ctx context.Context, host string, port int, timeout time.Duration) ([]byte, error) {
return []byte(`# comment
example.com ssh-ed25519 AAAA
example.com,192.0.2.10 ssh-rsa BBBB
@@ -74,7 +74,7 @@ func TestEnsureReturnsErrorWhenNoEntries(t *testing.T) {
dir := t.TempDir()
path := filepath.Join(dir, "known_hosts")
- mgr, err := NewManager(path, WithKeyscanFunc(func(ctx context.Context, host string, timeout time.Duration) ([]byte, error) {
+ mgr, err := NewManager(path, WithKeyscanFunc(func(ctx context.Context, host string, port int, timeout time.Duration) ([]byte, error) {
return []byte("|1|hash|salt ssh-ed25519 AAAA\n"), nil
}))
if err != nil {
@@ -91,7 +91,7 @@ func TestEnsureRespectsContextCancellation(t *testing.T) {
dir := t.TempDir()
path := filepath.Join(dir, "known_hosts")
- keyscan := func(ctx context.Context, host string, timeout time.Duration) ([]byte, error) {
+ keyscan := func(ctx context.Context, host string, port int, timeout time.Duration) ([]byte, error) {
<-ctx.Done()
return nil, ctx.Err()
}