diff --git a/tests/apps/nmap/cli/discovery.robot b/tests/apps/nmap/cli/discovery.robot index 73a61fdff..d0fc840f8 100644 --- a/tests/apps/nmap/cli/discovery.robot +++ b/tests/apps/nmap/cli/discovery.robot @@ -25,7 +25,7 @@ Container usage ${tc} ... --subnet='127.0.0.1/32' ... ${extraoptions} - Ctn Run Command And Check Result As Json ${command} ${expected_result} + Ctn Run Command Without Connector And Check Result As Json ${command} ${expected_result} Examples: tc extraoptions expected_result -- ... 1 ${EMPTY} {"end_time":1747232859,"discovered_items":1,"results":[{"hostname":"localhost","ip":"127.0.0.1","hostnames":[{"type":"PTR","name":"localhost"}],"vendor":null,"status":"up","addresses":[{"address":"127.0.0.1","type":"ipv4"}],"os_accuracy":null,"os":null,"services":null,"type":"unknown"}],"duration":0,"start_time":1747232859} diff --git a/tests/apps/protocols/http/collection-centreon-web.robot b/tests/apps/protocols/http/collection-centreon-web.robot index dc13ec7ab..90678d434 100644 --- a/tests/apps/protocols/http/collection-centreon-web.robot +++ b/tests/apps/protocols/http/collection-centreon-web.robot @@ -25,7 +25,7 @@ Check if ${test_desc} on Centreon [Tags] centreon collections http ${command} Catenate ... ${CMD} --config=${CURDIR}/${collection} - Ctn Run Command And Check Result As Strings ${command} ${expected_result} ${tc} + Ctn Run Command And Check Result As Strings ${command} ${expected_result} Examples: test_desc collection expected_result -- ... authentication succeeds collection-centreon-web-check-auth.collection.json OK: Authentication resulted in 200 HTTP code diff --git a/tests/apps/protocols/snmp/hashicorp-password-manager.robot b/tests/apps/protocols/snmp/hashicorp-password-manager.robot index 96cc59e29..08eec02e3 100644 --- a/tests/apps/protocols/snmp/hashicorp-password-manager.robot +++ b/tests/apps/protocols/snmp/hashicorp-password-manager.robot @@ -8,7 +8,6 @@ Test Timeout 120s *** Variables *** ${MOCKOON_JSON} ${CURDIR}${/}vault-authentication-hashicorp.json - ${CMD} ${CENTREON_PLUGINS} --plugin apps::protocols::snmp::plugin --hostname=${HOSTNAME} @@ -37,7 +36,7 @@ check hashicorp vault manager${Name} Ctn Run Command And Check Result As Strings ${command} ${expected_result} - Examples: Name path-param expected_result -- - ... default path --auth-path='' --auth-settings="password=secrethashicorpPassword" OK: current value is: Linux centreon-devbox 5.10.0-28-amd64 #1 SMP Debian 5.10.209-2 (2024-01-31) x86_64 - ... wrong path --auth-path='specific-url' --auth-settings="password=secrethashicorpPassword" OK: current value is: Linux centreon-devbox 5.10.0-28-amd64 #1 SMP Debian 5.10.209-2 (2024-01-31) x86_64 - ... wrong password --auth-path='' --auth-settings="password=WrongPassword" UNKNOWN: 401 Unauthorized + Examples: Name path-param expected_result -- + ... default path --auth-path='' --auth-settings="password=secrethashicorpPassword" OK: current value is: Linux centreon-devbox 5.10.0-28-amd64 #1 SMP Debian 5.10.209-2 (2024-01-31) x86_64 + ... wrong path --auth-path='specific-url' --auth-settings="password=secrethashicorpPassword" OK: current value is: Linux centreon-devbox 5.10.0-28-amd64 #1 SMP Debian 5.10.209-2 (2024-01-31) x86_64 + ... wrong password --auth-path='' --auth-settings="password=WrongPassword" UNKNOWN: 401 Unauthorized diff --git a/tests/apps/proxmox/ve/restapi/discovery.robot b/tests/apps/proxmox/ve/restapi/discovery.robot index fb86089cf..c787f9441 100644 --- a/tests/apps/proxmox/ve/restapi/discovery.robot +++ b/tests/apps/proxmox/ve/restapi/discovery.robot @@ -28,7 +28,7 @@ Discovery ${tc} ... ${CMD} ... ${extra_options} - Ctn Run Command And Check Result As Regexp ${command} ${expected_regexp} + Ctn Run Command Without Connector And Check Result As Regexp ${command} ${expected_regexp} Examples: tc extraoptions expected_regexp -- ... 1 ${EMPTY} "discovered_items":3 diff --git a/tests/resources/connector.py b/tests/resources/connector.py index 5b1d02e43..e42aad11e 100644 --- a/tests/resources/connector.py +++ b/tests/resources/connector.py @@ -199,8 +199,8 @@ def ctn_extract_multiline_result_from_log(tc, log_path="/tmp/connector.log", out for line in lines: if not in_result: - m = re.search(r'reporting check result #(\d+).*output:(.*)', line) - if m and str(m.group(1)) == str(tc): + m = re.search(r'reporting check result #(\d+) check:' + str(tc) + ' .*output:(.*)', line) + if m: result_lines.append(m.group(2).strip()) in_result = True else: diff --git a/tests/resources/resources.resource b/tests/resources/resources.resource index 1c1721f40..e24790b3c 100644 --- a/tests/resources/resources.resource +++ b/tests/resources/resources.resource @@ -109,8 +109,8 @@ Ctn Verify Command Without Connector Output Ctn Connector Log Contains Result [Arguments] ${tc} - ${result}= Grep File /tmp/connector.log reporting check result - #\d+ check:${tc}${SPACE} + ${result}= Grep File /tmp/connector.log reporting check result*check:${tc} + IF "${result}" == '' ${toto}= Grep File /tmp/connector.log . @@ -125,7 +125,6 @@ Ctn Wait Until Connector Result Available ... ${timeout} ... .2 ... File Should Not Be Empty /tmp/connector.log - File Should Not Be Empty /tmp/connector.log Wait Until Keyword Succeeds ... ${timeout} ... .2 @@ -136,13 +135,12 @@ Ctn Run Command With Connector And Return Result Remove File /tmp/connector.output Remove File /tmp/connector.command.log Create File /tmp/connector.log - File Should Be Empty /tmp/connector.log Ctn Send To Connector ${tc} ${command} ${timeout} Ctn Wait Until Connector Result Available ${tc} ${timeout} # 1. Extract the result from the log and write to /tmp/connector.output - Ctn Extract Result From Log ${tc} + Ctn Extract Multiline Result From Log ${tc} timeout=${timeout} # 2. Read the file ${output} Get File /tmp/connector.output ${output} Strip String ${output}