From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pdm-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9])
	by lore.proxmox.com (Postfix) with ESMTPS id 8A29B1FF15C
	for <inbox@lore.proxmox.com>; Fri, 18 Apr 2025 10:32:52 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id F13BD3841C;
	Fri, 18 Apr 2025 10:32:48 +0200 (CEST)
From: Lukas Wagner <l.wagner@proxmox.com>
To: pdm-devel@lists.proxmox.com
Date: Fri, 18 Apr 2025 10:32:09 +0200
Message-Id: <20250418083210.74982-6-l.wagner@proxmox.com>
X-Mailer: git-send-email 2.39.5
In-Reply-To: <20250418083210.74982-1-l.wagner@proxmox.com>
References: <20250418083210.74982-1-l.wagner@proxmox.com>
MIME-Version: 1.0
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.017 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: [pdm-devel] [PATCH proxmox-datacenter-manager v4 5/6] fake remote:
 make the fake_remote feature compile again
X-BeenThere: pdm-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox Datacenter Manager development discussion
 <pdm-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pdm-devel>, 
 <mailto:pdm-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pdm-devel/>
List-Post: <mailto:pdm-devel@lists.proxmox.com>
List-Help: <mailto:pdm-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel>, 
 <mailto:pdm-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox Datacenter Manager development discussion
 <pdm-devel@lists.proxmox.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pdm-devel-bounces@lists.proxmox.com
Sender: "pdm-devel" <pdm-devel-bounces@lists.proxmox.com>

The ClientFactory trait was changed in Wolfgang's multi-client patches,
this commit adapts the fake remote feature to the changes.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
---

Notes:
    new in v2

 server/src/test_support/fake_remote.rs | 29 +++++++++++++-------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/server/src/test_support/fake_remote.rs b/server/src/test_support/fake_remote.rs
index 40f68807..840c2131 100644
--- a/server/src/test_support/fake_remote.rs
+++ b/server/src/test_support/fake_remote.rs
@@ -1,18 +1,22 @@
-use std::{collections::HashMap, time::Duration};
+use std::{collections::HashMap, sync::Arc, time::Duration};
 
 use anyhow::{bail, Error};
+use serde::Deserialize;
+
 use pdm_api_types::{remotes::Remote, Authid, ConfigDigest};
 use pdm_config::remotes::RemoteConfig;
 use proxmox_product_config::ApiLockGuard;
 use proxmox_section_config::typed::SectionConfigData;
 use pve_api_types::{
-    client::PveClient, ClusterMetrics, ClusterMetricsData, ClusterNodeIndexResponse,
-    ClusterNodeIndexResponseStatus, ClusterResource, ClusterResourceKind, ClusterResourceType,
-    ListTasks, ListTasksResponse, PveUpid, StorageContent,
+    ClusterMetrics, ClusterMetricsData, ClusterNodeIndexResponse, ClusterNodeIndexResponseStatus,
+    ClusterResource, ClusterResourceKind, ClusterResourceType, ListTasks, ListTasksResponse,
+    PveUpid, StorageContent,
 };
-use serde::Deserialize;
 
-use crate::{connection::ClientFactory, pbs_client::PbsClient};
+use crate::{
+    connection::{ClientFactory, PveClient},
+    pbs_client::PbsClient,
+};
 
 #[derive(Deserialize, Clone)]
 #[serde(rename_all = "kebab-case")]
@@ -77,8 +81,8 @@ impl FakeRemoteConfig {
 
 #[async_trait::async_trait]
 impl ClientFactory for FakeClientFactory {
-    fn make_pve_client(&self, _remote: &Remote) -> Result<Box<dyn PveClient + Send + Sync>, Error> {
-        Ok(Box::new(FakePveClient {
+    fn make_pve_client(&self, _remote: &Remote) -> Result<Arc<PveClient>, Error> {
+        Ok(Arc::new(FakePveClient {
             nr_of_vms: self.config.vms_per_pve_remote,
             nr_of_cts: self.config.cts_per_pve_remote,
             nr_of_nodes: self.config.nodes_per_pve_remote,
@@ -91,7 +95,7 @@ impl ClientFactory for FakeClientFactory {
         &self,
         _remote: &Remote,
         _target_endpoint: Option<&str>,
-    ) -> Result<Box<dyn PveClient + Send + Sync>, Error> {
+    ) -> Result<Arc<PveClient>, Error> {
         bail!("not implemented")
     }
 
@@ -99,10 +103,7 @@ impl ClientFactory for FakeClientFactory {
         bail!("not implemented")
     }
 
-    async fn make_pve_client_and_login(
-        &self,
-        _remote: &Remote,
-    ) -> Result<Box<dyn PveClient + Send + Sync>, Error> {
+    async fn make_pve_client_and_login(&self, _remote: &Remote) -> Result<Arc<PveClient>, Error> {
         bail!("not implemented")
     }
 
@@ -121,7 +122,7 @@ struct FakePveClient {
 }
 
 #[async_trait::async_trait]
-impl PveClient for FakePveClient {
+impl pve_api_types::client::PveClient for FakePveClient {
     async fn cluster_resources(
         &self,
         _ty: Option<ClusterResourceKind>,
-- 
2.39.5



_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel