add debug + default teardonw/setup

This commit is contained in:
omercier 2025-08-08 14:51:31 +02:00
parent cb7e4dffd6
commit 054c80c50c
4 changed files with 21 additions and 15 deletions

5
tests/__init__.robot Normal file
View File

@ -0,0 +1,5 @@
*** Settings ***
Documentation Handle Connector start/stop
Suite Setup Ctn Generic Suite Setup
Suite Teardown Ctn Stop Connector

View File

@ -58,7 +58,7 @@ class ConnectorLibrary:
return line return line
return None return None
def ctn_stop_connector(self): def ctn_kill_connector(self):
if self.process: if self.process:
self.process.terminate() self.process.terminate()
self.process = None self.process = None
@ -87,10 +87,10 @@ def ctn_start_connector():
connector.ctn_start_connector() connector.ctn_start_connector()
return connector return connector
def ctn_stop_connector(): def ctn_kill_connector():
global connector global connector
if connector: if connector:
connector.ctn_stop_connector() connector.ctn_kill_connector()
connector = None connector = None
else: else:
print("No connector to stop.") print("No connector to stop.")

View File

@ -11,3 +11,5 @@ Resource resources.resource
Library BuiltIn Library BuiltIn
Library connector.py Library connector.py
Library Process Library Process

View File

@ -52,10 +52,11 @@ Ctn Cleanup Cache
Remove File ${/}dev${/}shm${/}* Remove File ${/}dev${/}shm${/}*
Ctn Generic Suite Setup Ctn Generic Suite Setup
Log To Console Starting connector
Ctn Cleanup Cache Ctn Cleanup Cache
Set Environment Variable TZ UTC Set Environment Variable TZ UTC
Ctn Clear Connector Log Ctn Clear Connector Log
Remove Files /tmp/connector.output.* Remove Files /tmp/connector.output*
Remove File /tmp/connector.log Remove File /tmp/connector.log
Ctn Start Connector Ctn Start Connector
@ -63,18 +64,12 @@ Ctn Clear Connector Log
[Documentation] Safely empties the connector log file without deleting it [Documentation] Safely empties the connector log file without deleting it
Create File /tmp/connector.log Create File /tmp/connector.log
Start connector Ctn Stop Connector
Ctn Cleanup Cache Log To Console Killing connector
Set Environment Variable TZ UTC
Ctn Clear Connector Log
Remove Files /tmp/connector.output.*
Ctn Start Connector
Stop Connector
Terminate All Processes Terminate All Processes
Remove Files /tmp/connector.output.* Ctn Kill Connector
Remove Files /tmp/connector.output*
Remove File /tmp/connector.log Remove File /tmp/connector.log
Ctn Stop Connector
Ctn Run Command Without Connector And Check Result As Regexp Ctn Run Command Without Connector And Check Result As Regexp
[Arguments] ${command} ${expected_result} [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.output
Remove File /tmp/connector.command.log Remove File /tmp/connector.command.log
IF $tc == 0 or "centreon_plugins.pl" in $command 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} Ctn Run Command Without Connector And Check Result As Strings ${command} ${expected_result}
ELSE ELSE
Log To Console [PC]
Ctn Run Command With Connector And Check Result As Strings ${command} ${expected_result} ${tc} ${timeout} Ctn Run Command With Connector And Check Result As Strings ${command} ${expected_result} ${tc} ${timeout}
END END
@ -177,8 +174,10 @@ Ctn Run Command And Check Result As Regexp
Remove File /tmp/connector.output Remove File /tmp/connector.output
Remove File /tmp/connector.command.log Remove File /tmp/connector.command.log
IF $tc == 0 or "centreon_plugins.pl" in $command 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} Ctn Run Command Without Connector And Check Result As Regexp ${command} ${expected_result}
ELSE ELSE
Log To Console [PC]
Ctn Run Command With Connector And Check Result As Regexp ${command} ${expected_result} ${tc} ${timeout} Ctn Run Command With Connector And Check Result As Regexp ${command} ${expected_result} ${tc} ${timeout}
END END