From c291f7fbd3f837a232f005bfecc44ee7a06f1727 Mon Sep 17 00:00:00 2001
From: Joshua Wallace <josho.wallace@gmail.com>
Date: Sat, 4 Jun 2022 14:40:51 -0400
Subject: [PATCH 1/2] fixed tests

---
 .../test/plugins/action/test_back_up_cancel_node.cpp       | 1 +
 .../test/plugins/action/test_controller_cancel_node.cpp    | 1 +
 .../plugins/action/test_drive_on_heading_cancel_node.cpp   | 1 +
 .../test/plugins/action/test_spin_cancel_node.cpp          | 1 +
 .../test/plugins/action/test_wait_cancel_node.cpp          | 1 +
 .../test/plugins/condition/test_is_path_valid.cpp          | 7 ++++---
 .../test/plugins/condition/test_path_expiring_timer.cpp    | 1 +
 7 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/nav2_behavior_tree/test/plugins/action/test_back_up_cancel_node.cpp b/nav2_behavior_tree/test/plugins/action/test_back_up_cancel_node.cpp
index 5bef6868e5..e1a04c82a7 100644
--- a/nav2_behavior_tree/test/plugins/action/test_back_up_cancel_node.cpp
+++ b/nav2_behavior_tree/test/plugins/action/test_back_up_cancel_node.cpp
@@ -83,6 +83,7 @@ class CancelBackUpActionTestFixture : public ::testing::Test
     config_ = nullptr;
     node_.reset();
     action_server_.reset();
+    client_.reset();
     factory_.reset();
   }
 
diff --git a/nav2_behavior_tree/test/plugins/action/test_controller_cancel_node.cpp b/nav2_behavior_tree/test/plugins/action/test_controller_cancel_node.cpp
index 3ca86a832b..cf754c5229 100644
--- a/nav2_behavior_tree/test/plugins/action/test_controller_cancel_node.cpp
+++ b/nav2_behavior_tree/test/plugins/action/test_controller_cancel_node.cpp
@@ -83,6 +83,7 @@ class CancelControllerActionTestFixture : public ::testing::Test
     config_ = nullptr;
     node_.reset();
     action_server_.reset();
+    client_.reset();
     factory_.reset();
   }
 
diff --git a/nav2_behavior_tree/test/plugins/action/test_drive_on_heading_cancel_node.cpp b/nav2_behavior_tree/test/plugins/action/test_drive_on_heading_cancel_node.cpp
index d0eb2b5bd5..6c6eb57233 100644
--- a/nav2_behavior_tree/test/plugins/action/test_drive_on_heading_cancel_node.cpp
+++ b/nav2_behavior_tree/test/plugins/action/test_drive_on_heading_cancel_node.cpp
@@ -86,6 +86,7 @@ class CancelDriveOnHeadingTestFixture : public ::testing::Test
     config_ = nullptr;
     node_.reset();
     action_server_.reset();
+    client_.reset();
     factory_.reset();
   }
 
diff --git a/nav2_behavior_tree/test/plugins/action/test_spin_cancel_node.cpp b/nav2_behavior_tree/test/plugins/action/test_spin_cancel_node.cpp
index 7909067381..978dc2d78f 100644
--- a/nav2_behavior_tree/test/plugins/action/test_spin_cancel_node.cpp
+++ b/nav2_behavior_tree/test/plugins/action/test_spin_cancel_node.cpp
@@ -83,6 +83,7 @@ class CancelSpinActionTestFixture : public ::testing::Test
     config_ = nullptr;
     node_.reset();
     action_server_.reset();
+    client_.reset();
     factory_.reset();
   }
 
diff --git a/nav2_behavior_tree/test/plugins/action/test_wait_cancel_node.cpp b/nav2_behavior_tree/test/plugins/action/test_wait_cancel_node.cpp
index 9e72f1413c..f1ed0750d8 100644
--- a/nav2_behavior_tree/test/plugins/action/test_wait_cancel_node.cpp
+++ b/nav2_behavior_tree/test/plugins/action/test_wait_cancel_node.cpp
@@ -83,6 +83,7 @@ class CancelWaitActionTestFixture : public ::testing::Test
     config_ = nullptr;
     node_.reset();
     action_server_.reset();
+    client_.reset();
     factory_.reset();
   }
 
diff --git a/nav2_behavior_tree/test/plugins/condition/test_is_path_valid.cpp b/nav2_behavior_tree/test/plugins/condition/test_is_path_valid.cpp
index 8984aac8c1..e086a937b1 100644
--- a/nav2_behavior_tree/test/plugins/condition/test_is_path_valid.cpp
+++ b/nav2_behavior_tree/test/plugins/condition/test_is_path_valid.cpp
@@ -67,9 +67,10 @@ class IsPathValidTestFixture : public ::testing::Test
   {
     delete config_;
     config_ = nullptr;
+    server_.reset();
     node_.reset();
     factory_.reset();
-    server_.reset();
+    tree_.reset();
   }
 
   static std::shared_ptr<IsPathValidService> server_;
@@ -98,9 +99,9 @@ TEST_F(IsPathValidTestFixture, test_behavior)
       </root>)";
 
   tree_ = std::make_shared<BT::Tree>(factory_->createTreeFromText(xml_txt, config_->blackboard));
-  std::this_thread::sleep_for(500ms);
+  // std::this_thread::sleep_for(500ms);
 
-  EXPECT_EQ(tree_->rootNode()->executeTick(), BT::NodeStatus::SUCCESS);
+  // EXPECT_EQ(tree_->rootNode()->executeTick(), BT::NodeStatus::SUCCESS);
 }
 
 int main(int argc, char ** argv)
diff --git a/nav2_behavior_tree/test/plugins/condition/test_path_expiring_timer.cpp b/nav2_behavior_tree/test/plugins/condition/test_path_expiring_timer.cpp
index b88fc4d634..385b1cfed8 100644
--- a/nav2_behavior_tree/test/plugins/condition/test_path_expiring_timer.cpp
+++ b/nav2_behavior_tree/test/plugins/condition/test_path_expiring_timer.cpp
@@ -43,6 +43,7 @@ class PathExpiringTimerConditionTestFixture : public nav2_behavior_tree::Behavio
   {
     delete config_;
     config_ = nullptr;
+    node_.reset();
     bt_node_.reset();
   }
 

From 0f515d97d5d02152ec3dde8f2e09dfa9dd44f325 Mon Sep 17 00:00:00 2001
From: Joshua Wallace <josho.wallace@gmail.com>
Date: Sat, 4 Jun 2022 14:49:29 -0400
Subject: [PATCH 2/2] undo

---
 .../test/plugins/condition/test_is_path_valid.cpp             | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/nav2_behavior_tree/test/plugins/condition/test_is_path_valid.cpp b/nav2_behavior_tree/test/plugins/condition/test_is_path_valid.cpp
index e086a937b1..21728b4fcc 100644
--- a/nav2_behavior_tree/test/plugins/condition/test_is_path_valid.cpp
+++ b/nav2_behavior_tree/test/plugins/condition/test_is_path_valid.cpp
@@ -99,9 +99,9 @@ TEST_F(IsPathValidTestFixture, test_behavior)
       </root>)";
 
   tree_ = std::make_shared<BT::Tree>(factory_->createTreeFromText(xml_txt, config_->blackboard));
-  // std::this_thread::sleep_for(500ms);
+  std::this_thread::sleep_for(500ms);
 
-  // EXPECT_EQ(tree_->rootNode()->executeTick(), BT::NodeStatus::SUCCESS);
+  EXPECT_EQ(tree_->rootNode()->executeTick(), BT::NodeStatus::SUCCESS);
 }
 
 int main(int argc, char ** argv)