From 054c80c50c07ed8d9a69f6f3fae4e3621680f117 Mon Sep 17 00:00:00 2001 From: omercier Date: Fri, 8 Aug 2025 14:51:31 +0200 Subject: [PATCH] add debug + default teardonw/setup --- tests/__init__.robot | 5 +++++ tests/resources/connector.py | 6 +++--- tests/resources/import.resource | 4 +++- tests/resources/resources.resource | 21 ++++++++++----------- 4 files changed, 21 insertions(+), 15 deletions(-) create mode 100644 tests/__init__.robot diff --git a/tests/__init__.robot b/tests/__init__.robot new file mode 100644 index 000000000..99a60a476 --- /dev/null +++ b/tests/__init__.robot @@ -0,0 +1,5 @@ +*** Settings *** +Documentation Handle Connector start/stop +Suite Setup Ctn Generic Suite Setup +Suite Teardown Ctn Stop Connector + diff --git a/tests/resources/connector.py b/tests/resources/connector.py index b49b9fedc..a917121e6 100644 --- a/tests/resources/connector.py +++ b/tests/resources/connector.py @@ -58,7 +58,7 @@ class ConnectorLibrary: return line return None - def ctn_stop_connector(self): + def ctn_kill_connector(self): if self.process: self.process.terminate() self.process = None @@ -87,10 +87,10 @@ def ctn_start_connector(): connector.ctn_start_connector() return connector -def ctn_stop_connector(): +def ctn_kill_connector(): global connector if connector: - connector.ctn_stop_connector() + connector.ctn_kill_connector() connector = None else: print("No connector to stop.") diff --git a/tests/resources/import.resource b/tests/resources/import.resource index 3519b7d90..f137b0efd 100644 --- a/tests/resources/import.resource +++ b/tests/resources/import.resource @@ -10,4 +10,6 @@ Library Collections Resource resources.resource Library BuiltIn Library connector.py -Library Process \ No newline at end of file +Library Process + + diff --git a/tests/resources/resources.resource b/tests/resources/resources.resource index cf9fcef06..b3326fa3b 100644 --- a/tests/resources/resources.resource +++ b/tests/resources/resources.resource @@ -52,10 +52,11 @@ Ctn Cleanup Cache Remove File ${/}dev${/}shm${/}* Ctn Generic Suite Setup + Log To Console Starting connector Ctn Cleanup Cache Set Environment Variable TZ UTC Ctn Clear Connector Log - Remove Files /tmp/connector.output.* + Remove Files /tmp/connector.output* Remove File /tmp/connector.log Ctn Start Connector @@ -63,18 +64,12 @@ Ctn Clear Connector Log [Documentation] Safely empties the connector log file without deleting it Create File /tmp/connector.log -Start connector - Ctn Cleanup Cache - Set Environment Variable TZ UTC - Ctn Clear Connector Log - Remove Files /tmp/connector.output.* - Ctn Start Connector - -Stop Connector +Ctn Stop Connector + Log To Console Killing connector Terminate All Processes - Remove Files /tmp/connector.output.* + Ctn Kill Connector + Remove Files /tmp/connector.output* Remove File /tmp/connector.log - Ctn Stop Connector Ctn Run Command Without Connector And Check Result As Regexp [Arguments] ${command} ${expected_result} @@ -167,8 +162,10 @@ Ctn Run Command And Check Result As Strings Remove File /tmp/connector.output Remove File /tmp/connector.command.log IF $tc == 0 or "centreon_plugins.pl" in $command + Log To Console [PS] Ctn Run Command Without Connector And Check Result As Strings ${command} ${expected_result} ELSE + Log To Console [PC] Ctn Run Command With Connector And Check Result As Strings ${command} ${expected_result} ${tc} ${timeout} END @@ -177,8 +174,10 @@ Ctn Run Command And Check Result As Regexp Remove File /tmp/connector.output Remove File /tmp/connector.command.log IF $tc == 0 or "centreon_plugins.pl" in $command + Log To Console [PS] Ctn Run Command Without Connector And Check Result As Regexp ${command} ${expected_result} ELSE + Log To Console [PC] Ctn Run Command With Connector And Check Result As Regexp ${command} ${expected_result} ${tc} ${timeout} END