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 8943C1FF17C for <inbox@lore.proxmox.com>; Wed, 14 May 2025 09:30:29 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 016943EFAC; Wed, 14 May 2025 09:30:51 +0200 (CEST) Message-ID: <19b33a62-828c-4fad-abc7-02e598ff7f81@proxmox.com> Date: Wed, 14 May 2025 09:30:02 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta To: Lukas Wagner <l.wagner@proxmox.com>, Proxmox Datacenter Manager development discussion <pdm-devel@lists.proxmox.com> References: <20250513130450.2702542-1-d.csapak@proxmox.com> <0b0cdabb-341f-4d81-b1c3-2570c81a30f3@proxmox.com> Content-Language: en-US From: Dominik Csapak <d.csapak@proxmox.com> In-Reply-To: <0b0cdabb-341f-4d81-b1c3-2570c81a30f3@proxmox.com> X-SPAM-LEVEL: Spam detection results: 0 AWL 0.021 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 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pdm-devel] [PATCH datacenter-manager] server: fake remotes: adapt to changed ClientFactory trait 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" <pdm-devel-bounces@lists.proxmox.com> On 5/13/25 15:25, Lukas Wagner wrote: > For the record, I already sent a patch for this in a previous patch series. > > https://lore.proxmox.com/pdm-devel/20250418083210.74982-6-l.wagner@proxmox.com/T/#u > yes, i noticed just before you sent this mail (see my other response, that weirdly only contains a html part....) but good to see that we basically have sent the same diff ^^ also, would it make sense to extend the fake remote part? 3 improvements i noticed that would be nice imho * simulate more api calls * fix some values (e.g. maxdisk is smaller than disk for hosts) * add some pseudo random dynamic values? so that it changes over time a bit (e.g. via a configurable jitter percentage) this would be nice to fully test the ui without having to setup multiple test clusters > On 2025-05-13 15:04, Dominik Csapak wrote: >> that trait changed some types, so we have to adapt here, namely >> * use the crate::connection::PveClient type instead of typing it manually >> * use Arc instead of Box >> >> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com> >> --- >> server/src/test_support/fake_remote.rs | 26 +++++++++++++------------- >> 1 file changed, 13 insertions(+), 13 deletions(-) >> >> diff --git a/server/src/test_support/fake_remote.rs b/server/src/test_support/fake_remote.rs >> index 0161d8e..c52bc32 100644 >> --- a/server/src/test_support/fake_remote.rs >> +++ b/server/src/test_support/fake_remote.rs >> @@ -1,4 +1,4 @@ >> -use std::{collections::HashMap, time::Duration}; >> +use std::{collections::HashMap, sync::Arc, time::Duration}; >> >> use anyhow::{bail, Error}; >> use pdm_api_types::{remotes::Remote, Authid, ConfigDigest}; >> @@ -6,13 +6,16 @@ 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")] >> @@ -74,8 +77,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, >> @@ -88,7 +91,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") >> } >> >> @@ -96,10 +99,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") >> } >> >> @@ -118,7 +118,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>, > _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel