From 66f7caef736fd611aa34df95da1b213c08550e45 Mon Sep 17 00:00:00 2001 From: rcourtman Date: Thu, 12 Feb 2026 18:20:16 +0000 Subject: [PATCH] =?UTF-8?q?refactor(naming-consistency):=20fix=20VMIpAddre?= =?UTF-8?q?ss=20=E2=86=92=20VMIPAddress=20in=20pkg/proxmox?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/monitoring/guest_metadata_test.go | 26 +++++++++---------- .../monitoring/monitor_extra_coverage_test.go | 2 +- pkg/proxmox/client.go | 4 +-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/monitoring/guest_metadata_test.go b/internal/monitoring/guest_metadata_test.go index 822232030..5ba3b638c 100644 --- a/internal/monitoring/guest_metadata_test.go +++ b/internal/monitoring/guest_metadata_test.go @@ -274,7 +274,7 @@ func TestProcessGuestNetworkInterfaces(t *testing.T) { { Name: "eth0", HardwareAddr: "00:11:22:33:44:55", - IPAddresses: []proxmox.VMIpAddress{ + IPAddresses: []proxmox.VMIPAddress{ {Address: "192.168.1.10", Prefix: 24}, }, }, @@ -290,7 +290,7 @@ func TestProcessGuestNetworkInterfaces(t *testing.T) { { Name: "lo", HardwareAddr: "00:00:00:00:00:00", - IPAddresses: []proxmox.VMIpAddress{ + IPAddresses: []proxmox.VMIPAddress{ {Address: "127.0.0.1", Prefix: 8}, {Address: "127.0.0.2", Prefix: 8}, }, @@ -305,7 +305,7 @@ func TestProcessGuestNetworkInterfaces(t *testing.T) { { Name: "eth0", HardwareAddr: "00:11:22:33:44:55", - IPAddresses: []proxmox.VMIpAddress{ + IPAddresses: []proxmox.VMIPAddress{ {Address: "fe80::1", Prefix: 64}, {Address: "FE80::abcd", Prefix: 64}, }, @@ -320,7 +320,7 @@ func TestProcessGuestNetworkInterfaces(t *testing.T) { { Name: "lo", HardwareAddr: "00:00:00:00:00:00", - IPAddresses: []proxmox.VMIpAddress{ + IPAddresses: []proxmox.VMIPAddress{ {Address: "::1", Prefix: 128}, }, }, @@ -334,7 +334,7 @@ func TestProcessGuestNetworkInterfaces(t *testing.T) { { Name: "eth0", HardwareAddr: "00:11:22:33:44:55", - IPAddresses: []proxmox.VMIpAddress{ + IPAddresses: []proxmox.VMIPAddress{ {Address: "192.168.1.10", Prefix: 24}, {Address: "127.0.0.1", Prefix: 8}, {Address: "fe80::1", Prefix: 64}, @@ -353,7 +353,7 @@ func TestProcessGuestNetworkInterfaces(t *testing.T) { { Name: "eth0", HardwareAddr: "00:11:22:33:44:55", - IPAddresses: []proxmox.VMIpAddress{ + IPAddresses: []proxmox.VMIPAddress{ {Address: "192.168.1.10", Prefix: 24}, {Address: "192.168.1.10", Prefix: 24}, {Address: "192.168.1.10", Prefix: 24}, @@ -371,14 +371,14 @@ func TestProcessGuestNetworkInterfaces(t *testing.T) { { Name: "eth0", HardwareAddr: "00:11:22:33:44:55", - IPAddresses: []proxmox.VMIpAddress{ + IPAddresses: []proxmox.VMIPAddress{ {Address: "192.168.1.10", Prefix: 24}, }, }, { Name: "eth1", HardwareAddr: "AA:BB:CC:DD:EE:FF", - IPAddresses: []proxmox.VMIpAddress{ + IPAddresses: []proxmox.VMIPAddress{ {Address: "192.168.1.10", Prefix: 24}, // same IP on different interface }, }, @@ -395,14 +395,14 @@ func TestProcessGuestNetworkInterfaces(t *testing.T) { { Name: "eth1", HardwareAddr: "AA:BB:CC:DD:EE:FF", - IPAddresses: []proxmox.VMIpAddress{ + IPAddresses: []proxmox.VMIPAddress{ {Address: "10.0.0.5", Prefix: 8}, }, }, { Name: "eth0", HardwareAddr: "00:11:22:33:44:55", - IPAddresses: []proxmox.VMIpAddress{ + IPAddresses: []proxmox.VMIPAddress{ {Address: "192.168.1.10", Prefix: 24}, }, }, @@ -447,7 +447,7 @@ func TestProcessGuestNetworkInterfaces(t *testing.T) { { Name: " eth0 ", HardwareAddr: " 00:11:22:33:44:55 ", - IPAddresses: []proxmox.VMIpAddress{ + IPAddresses: []proxmox.VMIPAddress{ {Address: "192.168.1.10", Prefix: 24}, }, }, @@ -463,7 +463,7 @@ func TestProcessGuestNetworkInterfaces(t *testing.T) { { Name: "eth0", HardwareAddr: "00:11:22:33:44:55", - IPAddresses: []proxmox.VMIpAddress{ + IPAddresses: []proxmox.VMIPAddress{ {Address: " 192.168.1.10 ", Prefix: 24}, }, }, @@ -479,7 +479,7 @@ func TestProcessGuestNetworkInterfaces(t *testing.T) { { Name: "eth0", HardwareAddr: "00:11:22:33:44:55", - IPAddresses: []proxmox.VMIpAddress{ + IPAddresses: []proxmox.VMIPAddress{ {Address: "", Prefix: 0}, {Address: " ", Prefix: 0}, {Address: "192.168.1.10", Prefix: 24}, diff --git a/internal/monitoring/monitor_extra_coverage_test.go b/internal/monitoring/monitor_extra_coverage_test.go index a441be4f6..e2f5b8980 100644 --- a/internal/monitoring/monitor_extra_coverage_test.go +++ b/internal/monitoring/monitor_extra_coverage_test.go @@ -326,7 +326,7 @@ func TestMonitor_PollVMsAndContainersEfficient_Extra(t *testing.T) { {Mountpoint: "/", TotalBytes: 100 * 1024 * 1024 * 1024, UsedBytes: 50 * 1024 * 1024 * 1024, Type: "ext4"}, }, netIfaces: []proxmox.VMNetworkInterface{ - {Name: "eth0", IPAddresses: []proxmox.VMIpAddress{{Address: "192.168.1.100", Prefix: 24}}}, + {Name: "eth0", IPAddresses: []proxmox.VMIPAddress{{Address: "192.168.1.100", Prefix: 24}}}, }, } diff --git a/pkg/proxmox/client.go b/pkg/proxmox/client.go index 4b69b1655..d2c4a0852 100644 --- a/pkg/proxmox/client.go +++ b/pkg/proxmox/client.go @@ -1477,7 +1477,7 @@ func parseUint64Flexible(value interface{}) (uint64, error) { } } -type VMIpAddress struct { +type VMIPAddress struct { Address string `json:"ip-address"` Prefix int `json:"prefix"` } @@ -1485,7 +1485,7 @@ type VMIpAddress struct { type VMNetworkInterface struct { Name string `json:"name"` HardwareAddr string `json:"hardware-address"` - IPAddresses []VMIpAddress `json:"ip-addresses"` + IPAddresses []VMIPAddress `json:"ip-addresses"` Statistics interface{} `json:"statistics,omitempty"` HasIp4Gateway bool `json:"has-ipv4-synth-gateway,omitempty"` HasIp6Gateway bool `json:"has-ipv6-synth-gateway,omitempty"`