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 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.")

View File

@ -10,4 +10,6 @@ Library Collections
Resource resources.resource
Library BuiltIn
Library connector.py
Library Process
Library Process

View File

@ -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