mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-09-25 18:58:39 +02:00
get result always is multiline, should fix a lot of errors
This commit is contained in:
parent
9520d8b3e4
commit
6429dbda88
@ -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}
|
||||
|
@ -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
|
||||
|
@ -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}
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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}
|
||||
|
Loading…
x
Reference in New Issue
Block a user