From 240fb981bb0acd2ae6de2ff6572cbd611f99eaf7 Mon Sep 17 00:00:00 2001
From: cgeek <cem.moreau@gmail.com>
Date: Wed, 18 Oct 2023 12:40:38 +0200
Subject: [PATCH] fix(#125): fix: e2e tests were keeping the node running of
 failing tests

---
 end2end-tests/tests/common/mod.rs     | 7 +++++++
 end2end-tests/tests/cucumber_tests.rs | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/end2end-tests/tests/common/mod.rs b/end2end-tests/tests/common/mod.rs
index 1667ff60e..e34982eb5 100644
--- a/end2end-tests/tests/common/mod.rs
+++ b/end2end-tests/tests/common/mod.rs
@@ -87,6 +87,13 @@ impl Process {
     }
 }
 
+// Do not let the process keep running after the tests ended
+impl Drop for Process {
+    fn drop(&mut self) {
+        self.kill()
+    }
+}
+
 pub const DISTANCE_ORACLE_LOCAL_PATH: &str = "../target/debug/distance-oracle";
 const DUNITER_DOCKER_PATH: &str = "/usr/local/bin/duniter";
 const DUNITER_LOCAL_PATH: &str = "../target/debug/duniter";
diff --git a/end2end-tests/tests/cucumber_tests.rs b/end2end-tests/tests/cucumber_tests.rs
index f706b170d..dcb7d842b 100644
--- a/end2end-tests/tests/cucumber_tests.rs
+++ b/end2end-tests/tests/cucumber_tests.rs
@@ -613,7 +613,7 @@ async fn main() {
             if keep_running {
                 while running.load(Ordering::SeqCst) {}
             }
-
+            // Early kill (not waiting destructor) to save CPU/memory
             if let Some(world) = maybe_world {
                 world.kill();
             }
-- 
GitLab