all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH proxmox] apt: tests: remove output directories before running test
@ 2023-06-05 15:26 Fiona Ebner
  2023-09-07  8:30 ` [pve-devel] superseded: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Fiona Ebner @ 2023-06-05 15:26 UTC (permalink / raw)
  To: pve-devel

I blindly assumed that cargo would re-create the TMPDIR before each
test run, but that doesn't seem to be the case and the test_digest
test now fails the second time when running 'cargo test' twice.

So partially revert 9b7c533 ("apt: tests: create temporary test
directories in CARGO_TARGET_TMPDIR") and re-introduce the
remove-before-test logic.

Fixes: 9b7c533 ("apt: tests: create temporary test directories in CARGO_TARGET_TMPDIR")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 proxmox-apt/tests/repositories.rs | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/proxmox-apt/tests/repositories.rs b/proxmox-apt/tests/repositories.rs
index be6aaff..64ecdbb 100644
--- a/proxmox-apt/tests/repositories.rs
+++ b/proxmox-apt/tests/repositories.rs
@@ -24,6 +24,11 @@ fn test_parse_write_dir(read_dir: &str) -> Result<(), Error> {
     let write_dir = tmp_dir.join("sources.list.d.actual");
     let expected_dir = test_dir.join("sources.list.d.expected");
 
+    if write_dir.is_dir() {
+        std::fs::remove_dir_all(&write_dir)
+            .map_err(|err| format_err!("unable to remove dir {:?} - {}", write_dir, err))?;
+    }
+
     std::fs::create_dir_all(&write_dir)
         .map_err(|err| format_err!("unable to create dir {:?} - {}", write_dir, err))?;
 
@@ -92,6 +97,11 @@ fn test_digest() -> Result<(), Error> {
     let read_dir = test_dir.join("sources.list.d");
     let write_dir = tmp_dir.join("sources.list.d.digest");
 
+    if write_dir.is_dir() {
+        std::fs::remove_dir_all(&write_dir)
+            .map_err(|err| format_err!("unable to remove dir {:?} - {}", write_dir, err))?;
+    }
+
     std::fs::create_dir_all(&write_dir)
         .map_err(|err| format_err!("unable to create dir {:?} - {}", write_dir, err))?;
 
-- 
2.39.2





^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pve-devel] superseded: [PATCH proxmox] apt: tests: remove output directories before running test
  2023-06-05 15:26 [pve-devel] [PATCH proxmox] apt: tests: remove output directories before running test Fiona Ebner
@ 2023-09-07  8:30 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2023-09-07  8:30 UTC (permalink / raw)
  To: Proxmox VE development discussion, Fiona Ebner

Am 05/06/2023 um 17:26 schrieb Fiona Ebner:
> I blindly assumed that cargo would re-create the TMPDIR before each
> test run, but that doesn't seem to be the case and the test_digest
> test now fails the second time when running 'cargo test' twice.
> 
> So partially revert 9b7c533 ("apt: tests: create temporary test
> directories in CARGO_TARGET_TMPDIR") and re-introduce the
> remove-before-test logic.
> 
> Fixes: 9b7c533 ("apt: tests: create temporary test directories in CARGO_TARGET_TMPDIR")
> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
> ---
>  proxmox-apt/tests/repositories.rs | 10 ++++++++++
>  1 file changed, 10 insertions(+)

for the record, as we talked off-list:

I run into this my own and missed that there was already a patch on the list.

Thus I quick fixed it directly [0]: for the test case I run into, but you showed
my your patch and I then decided that we can factor that cleanup+create out and
did so with [1]. So this patch here should now be fully superseded.

[0]: https://git.proxmox.com/?p=proxmox.git;a=commitdiff;h=ae3c04a76b0b82597b63989e1a97ae919af03168
[1]: https://git.proxmox.com/?p=proxmox.git;a=commitdiff;h=4e2cc6fd53dec2b61d54e25b3e8b9b1fb0bf43d3




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-09-07  8:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-05 15:26 [pve-devel] [PATCH proxmox] apt: tests: remove output directories before running test Fiona Ebner
2023-09-07  8:30 ` [pve-devel] superseded: " Thomas Lamprecht

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal