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.

refactor: Remove duplicate isLoopback function from hostagent

rcourtmane5f128923912
diff --git a/internal/hostagent/agent.go b/internal/hostagent/agent.go
index def8bbb82c..b67d4132b4 100644
--- a/internal/hostagent/agent.go
+++ b/internal/hostagent/agent.go
@@ -325,15 +325,6 @@ func normalisePlatform(platform string) string {
}
}
-func isLoopback(flags []string) bool {
- for _, flag := range flags {
- if strings.EqualFold(flag, "loopback") {
- return true
- }
- }
- return false
-}
-
// collectTemperatures attempts to collect temperature data from the local system.
// Returns an empty Sensors struct if collection fails (best-effort).
func (a *Agent) collectTemperatures(ctx context.Context) agentshost.Sensors {
diff --git a/internal/hostagent/agent_test.go b/internal/hostagent/agent_test.go
index d3ea90e736..5733c89c9e 100644
--- a/internal/hostagent/agent_test.go
+++ b/internal/hostagent/agent_test.go
@@ -72,65 +72,3 @@ func TestNormalisePlatform(t *testing.T) {
}
}
-func TestIsLoopback(t *testing.T) {
- tests := []struct {
- name string
- flags []string
- expected bool
- }{
- {
- name: "loopback lowercase",
- flags: []string{"up", "loopback"},
- expected: true,
- },
- {
- name: "LOOPBACK uppercase",
- flags: []string{"up", "LOOPBACK"},
- expected: true,
- },
- {
- name: "Loopback mixed case",
- flags: []string{"up", "Loopback"},
- expected: true,
- },
- {
- name: "loopback only flag",
- flags: []string{"loopback"},
- expected: true,
- },
- {
- name: "no loopback flag",
- flags: []string{"up", "broadcast", "running"},
- expected: false,
- },
- {
- name: "empty flags",
- flags: []string{},
- expected: false,
- },
- {
- name: "nil flags",
- flags: nil,
- expected: false,
- },
- {
- name: "loopback first",
- flags: []string{"loopback", "up"},
- expected: true,
- },
- {
- name: "loopback in middle",
- flags: []string{"up", "loopback", "running"},
- expected: true,
- },
- }
-
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- result := isLoopback(tt.flags)
- if result != tt.expected {
- t.Errorf("isLoopback(%v) = %v, want %v", tt.flags, result, tt.expected)
- }
- })
- }
-}