public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Thomas Ellmenreich" <t.ellmenreich@proxmox.com>
To: "Lukas Wagner" <l.wagner@proxmox.com>, <pdm-devel@lists.proxmox.com>
Subject: Re: [PATCH datacenter-manager v2 14/20] tests: add helpers for building API-handler-level integration tests
Date: Fri, 21 Aug 2026 11:57:30 +0200	[thread overview]
Message-ID: <DKUJ6S869TUG.3LQQF9KBAZVDJ@proxmox.com> (raw)
In-Reply-To: <20260820145220.418032-15-l.wagner@proxmox.com>

I tried to set up a quick tests just to see how everything worked and it
looks good, only noticed on thing.

On Thu Aug 20, 2026 at 4:52 PM CEST, Lukas Wagner wrote:

[snip]

> +macro_rules! test_pve_client {
> +    ($ty:ident { $($overrides:tt)* }) => {
> +
> +        pub struct $ty(crate::common::PveTestRemote);
> +
> +        #[async_trait::async_trait]
> +        impl pve_api_types::client::PveClient for $ty {
> +            async fn list_nodes(
> +                &self,
> +            ) -> Result<Vec<pve_api_types::ClusterNodeIndexResponse>, proxmox_client::Error> {
> +                let mut nodes = Vec::new();
> +
> +                for i in 0..self.0.nodes {
> +                    nodes.push(ClusterNodeIndexResponse {
                                  ^
                                  Here, you forgot to add `pve_api_types::`,
                                  forcing the user of the macro to import it.
                                  This means you can probably also remove the
                                  import of `ClusterNodeIndexResponse` from
                                  your tests.

> +                        cpu: Some(0.0),
> +                        level: None,
> +                        maxcpu: Some(4),
> +                        maxmem: Some(4096),
> +                        mem: Some(1000),
> +                        node: format!("{}-node-{i}", self.0.name),
> +                        ssl_fingerprint: None,
> +                        status: pve_api_types::ClusterNodeIndexResponseStatus::Online,
> +                        uptime: Some(1000),
> +                    });
> +                }
> +
> +                Ok(nodes)
> +            }
> +            $($overrides)*
> +        }
> +
> +        impl $ty {
> +            /// Name of the remote this client was created for.
> +            pub fn remote(&self) -> &str {
> +                &self.0.name
> +            }
> +
> +            /// Shared state of the remote this client was created for.
> +            pub fn state(&self) -> crate::common::TestRemoteState {
> +                self.0.state.clone()
> +            }
> +        }
> +    };
> +}
> +
> +pub(crate) use test_pve_client;





  reply	other threads:[~2026-08-21  9:57 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-20 14:52 [PATCH datacenter-manager/proxmox v2 00/20] inject application context via API macro for easier integration testing Lukas Wagner
2026-08-20 14:52 ` [PATCH proxmox v2 01/20] router: introduce shared state Lukas Wagner
2026-08-20 14:52 ` [PATCH proxmox v2 02/20] rest-server: allow to inject " Lukas Wagner
2026-08-20 14:52 ` [PATCH proxmox v2 03/20] api-macro: support shared state extraction type Lukas Wagner
2026-08-20 14:52 ` [PATCH datacenter-manager v2 04/20] context: promote context to a dir-style module Lukas Wagner
2026-08-20 14:52 ` [PATCH datacenter-manager v2 05/20] pdm-config: remotes: rename trait methods to read/write/lock Lukas Wagner
2026-08-20 14:52 ` [PATCH datacenter-manager v2 06/20] pdm-config: subscriptions: " Lukas Wagner
2026-08-20 14:52 ` [PATCH datacenter-manager v2 07/20] remote iterator: pass remote config reader explicitly Lukas Wagner
2026-08-20 14:52 ` [PATCH datacenter-manager v2 08/20] context: introduce a ContextFactory to build application context Lukas Wagner
2026-08-20 14:52 ` [PATCH datacenter-manager v2 09/20] context: establish PdmApplication object Lukas Wagner
2026-08-21  9:52   ` Thomas Ellmenreich
2026-08-21 12:26     ` Lukas Wagner
2026-08-20 14:52 ` [PATCH datacenter-manager v2 10/20] context: register PdmApplication in router Lukas Wagner
2026-08-20 14:52 ` [PATCH datacenter-manager v2 11/20] parallel fetcher: pass arguments to closure in a single type Lukas Wagner
2026-08-20 14:52 ` [PATCH datacenter-manager v2 12/20] parallel fetcher: support a custom client factory Lukas Wagner
2026-08-20 14:52 ` [PATCH datacenter-manager v2 13/20] api: sdn: use PdmApplication handle for accessing remotes Lukas Wagner
2026-08-20 14:52 ` [PATCH datacenter-manager v2 14/20] tests: add helpers for building API-handler-level integration tests Lukas Wagner
2026-08-21  9:57   ` Thomas Ellmenreich [this message]
2026-08-21 12:25     ` Lukas Wagner
2026-08-20 14:52 ` [PATCH datacenter-manager v2 15/20] tests: add example tests for SDN API routes Lukas Wagner
2026-08-20 14:52 ` [PATCH datacenter-manager v2 16/20] api-cache: add wrapper type Lukas Wagner
2026-08-20 14:52 ` [PATCH datacenter-manager v2 17/20] context: provide api-cache on the app object Lukas Wagner
2026-08-20 14:52 ` [PATCH datacenter-manager v2 18/20] api: subscriptions: use PdmApplication instead of globals Lukas Wagner
2026-08-20 14:52 ` [PATCH datacenter-manager v2 19/20] pdm-config: subscriptions: drop unused accessor functions Lukas Wagner
2026-08-20 14:52 ` [PATCH datacenter-manager v2 20/20] tests: add example tests for remote subscription management Lukas Wagner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DKUJ6S869TUG.3LQQF9KBAZVDJ@proxmox.com \
    --to=t.ellmenreich@proxmox.com \
    --cc=l.wagner@proxmox.com \
    --cc=pdm-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal