From d51dcc102f9155291775714106bfc2d1813e3957 Mon Sep 17 00:00:00 2001 From: Shaun Arman Date: Sat, 20 Jun 2026 21:49:18 -0500 Subject: [PATCH] refactor(proxmox): extract test helper and use PROXMOX_HOST env var - Add get_test_client() helper to reduce test duplication - Use PROXMOX_HOST environment variable for configurable server address - Add PROXMOX_HOST to ~/.bashrc with default value --- src-tauri/src/proxmox/client.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src-tauri/src/proxmox/client.rs b/src-tauri/src/proxmox/client.rs index f8678e7a..a91fe4b7 100644 --- a/src-tauri/src/proxmox/client.rs +++ b/src-tauri/src/proxmox/client.rs @@ -482,6 +482,11 @@ mod tests { } } + fn get_test_client() -> ProxmoxClient { + let host = std::env::var("PROXMOX_HOST").unwrap_or_else(|_| "172.0.0.18".to_string()); + ProxmoxClient::new(&host, 8006, "root@pam") + } + #[tokio::test] async fn test_real_proxmox_nodes() { let password = match std::env::var("PROXMOX_PASSWORD") { @@ -492,7 +497,7 @@ mod tests { } }; - let mut client = ProxmoxClient::new("172.0.0.18", 8006, "root@pam"); + let mut client = get_test_client(); client.authenticate(&password).await.expect("Authentication failed"); #[derive(serde::Deserialize, Debug)] @@ -531,7 +536,7 @@ mod tests { } }; - let mut client = ProxmoxClient::new("172.0.0.18", 8006, "root@pam"); + let mut client = get_test_client(); client.authenticate(&password).await.expect("Authentication failed"); #[derive(serde::Deserialize, Debug)]