From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pve-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 B00CF1FF164
	for <inbox@lore.proxmox.com>; Fri, 31 Jan 2025 10:36:24 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id 848C628AA3;
	Fri, 31 Jan 2025 10:36:20 +0100 (CET)
Message-ID: <cf974cef-3e76-4385-841b-46b9f58a1f06@proxmox.com>
Date: Fri, 31 Jan 2025 10:36:14 +0100
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
 Daniel Herzig <d.herzig@proxmox.com>
References: <20250130113121.157273-1-d.herzig@proxmox.com>
 <20250130113121.157273-4-d.herzig@proxmox.com>
Content-Language: en-US
From: Fiona Ebner <f.ebner@proxmox.com>
In-Reply-To: <20250130113121.157273-4-d.herzig@proxmox.com>
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.048 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: Re: [pve-devel] [PATCH qemu-server v3 3/6] fix #4225: qemuserver,
 test: put eject_nonrequired_isos in place
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>

Am 30.01.25 um 12:31 schrieb Daniel Herzig:
> @@ -393,6 +410,25 @@ $pci_module->mock(
>      }
>  );
>  
> +my $pve_storage_plugin_module = Test::MockModule->new("PVE::Storage::Plugin");
> +$pve_storage_plugin_module->mock(
> +    activate_storage => sub {
> +       return 1;
> +    },
> +);
> +
> +my $pve_storage_cifsplugin_module = Test::MockModule->new("PVE::Storage::CIFSPlugin");
> +$pve_storage_cifsplugin_module->mock(
> +    check_connection => sub {
> +	return 1;
> +    },
> +    cifs_is_mounted => sub {
> +	my ($scfg, $mountdata) = @_;
> +	my ($mountpoint, $server, $share) = $scfg->@{'path', 'server', 'share'};
> +	return $mountpoint;
> +    },
> +);
> +

Can't we avoid mocking PVE::Storage::Plugin and
PVE::Storage::CIFSPlugin? It should be enough to just mock the top-level
storage API from PVE::Storage. Ideally, the qemu-server package should
not have any idea how the storage package works internally. You can add
conditionals for the storage IDs if you need specific behavior for
certain storages.

>  sub diff($$) {
>      my ($a, $b) = @_;
>      return if $a eq $b;



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