From 3f460aa830e30515ea56cc41ea710a4fecf521fa Mon Sep 17 00:00:00 2001 From: Aliaksandr Nikitsin Date: Fri, 4 Oct 2024 17:53:13 +0200 Subject: [PATCH] stop monitoring when test run is cancelled --- framework/python/src/core/testrun.py | 5 +++-- framework/python/src/net_orc/network_orchestrator.py | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/framework/python/src/core/testrun.py b/framework/python/src/core/testrun.py index f16066516..e22faf3e5 100644 --- a/framework/python/src/core/testrun.py +++ b/framework/python/src/core/testrun.py @@ -381,12 +381,13 @@ def start(self): def stop(self): + # First, change the status to stopping + self.get_session().stop() + # Prevent discovering new devices whilst stopping if self.get_net_orc().get_listener() is not None: self.get_net_orc().get_listener().stop_listener() - self.get_session().stop() - self._stop_tests() self._stop_network(kill=True) self.get_session().set_status(TestrunStatus.CANCELLED) diff --git a/framework/python/src/net_orc/network_orchestrator.py b/framework/python/src/net_orc/network_orchestrator.py index 90e108a40..b8e7befd2 100644 --- a/framework/python/src/net_orc/network_orchestrator.py +++ b/framework/python/src/net_orc/network_orchestrator.py @@ -301,7 +301,10 @@ def _start_device_monitor(self, device): time.sleep(1) # Check Testrun hasn't been cancelled - if self._session.get_status() == TestrunStatus.CANCELLED: + if self._session.get_status() in ( + TestrunStatus.STOPPING, + TestrunStatus.CANCELLED + ): sniffer.stop() return