diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..9e2372829 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +log.html +output.xml +report.html \ No newline at end of file diff --git a/tests/resources/resources.resource b/tests/resources/resources.resource index 9d8d1cd44..aa5d4191b 100644 --- a/tests/resources/resources.resource +++ b/tests/resources/resources.resource @@ -29,3 +29,14 @@ Start Mockoon Stop Mockoon Terminate All Processes + +Ctn Run Command And Check Result As Strings + [Arguments] ${command} ${expected_result} + ${output} Run ${command} + ${output} Strip String ${output} + Should Be Equal As Strings + ... ${expected_result} + ... ${output} + ... Wrong output result for command:\n${command}\n\nObtained:\n${output}\n\nExpected:\n${expected_result}\n + ... values=False + ... collapse_spaces=True \ No newline at end of file diff --git a/tests/robot/apps/automation/ansible/tower/hosts.robot b/tests/robot/apps/automation/ansible/tower/hosts.robot index 383b2ee89..930597bac 100644 --- a/tests/robot/apps/automation/ansible/tower/hosts.robot +++ b/tests/robot/apps/automation/ansible/tower/hosts.robot @@ -27,14 +27,7 @@ Hosts ${tc} ${command} Catenate ... ${CMD} ... --mode=hosts - ${output} Run ${command} - ${output} Strip String ${output} - Should Be Equal As Strings - ... ${expected_result} - ... ${output} - ... Wrong output result for command:\n${command}\n\nObtained:\n${output}\n\nExpected:\n${expected_result}\n - ... values=False - ... collapse_spaces=True + Ctn Run Command And Check Result As Strings ${command} ${expected_result} Examples: tc snmpcommunity expected_result -- ... 1 os/linux/snmp/list-diskio OK: Hosts total: 10, failed: 0 - All hosts are ok | 'hosts.total.count'=10;;;0; 'hosts.failed.count'=0;;;0;10 diff --git a/tests/robot/apps/automation/ansible/tower/jobs.robot b/tests/robot/apps/automation/ansible/tower/jobs.robot index 11594b538..7ace1dab0 100644 --- a/tests/robot/apps/automation/ansible/tower/jobs.robot +++ b/tests/robot/apps/automation/ansible/tower/jobs.robot @@ -29,14 +29,7 @@ jobs ${tc} ... --mode=jobs ... ${extraoptions} Log ${cmd} - ${output} Run ${command} - ${output} Strip String ${output} - Should Be Equal As Strings - ... ${expected_result} - ... ${output} - ... Wrong output result for command:\n${command}\n\nObtained:\n${output}\n\nExpected:\n${expected_result}\n - ... values=False - ... collapse_spaces=True + Ctn Run Command And Check Result As Strings ${command} ${expected_result} Examples: tc extraoptions expected_result -- ... 1 --filter-name='' OK: Jobs total: 2, successful: 0, failed: 0, running: 0 | 'jobs.total.count'=2;;;0; 'jobs.successful.count'=0;;;0;2 'jobs.failed.count'=0;;;0;2 'jobs.running.count'=0;;;0;2 'jobs.canceled.count'=0;;;0;2 'jobs.pending.count'=0;;;0;2 'jobs.default.count'=0;;;0;2 diff --git a/tests/robot/apps/microsoft/hyperv/2012/local/nodeintegrationservice.robot b/tests/robot/apps/microsoft/hyperv/2012/local/nodeintegrationservice.robot index 5177aaadb..2aaf93b12 100644 --- a/tests/robot/apps/microsoft/hyperv/2012/local/nodeintegrationservice.robot +++ b/tests/robot/apps/microsoft/hyperv/2012/local/nodeintegrationservice.robot @@ -23,13 +23,7 @@ HyperV 2022 ${tc}/3 ${command} Catenate ... ${CMD} ... --filter-vm='${filter_vm}' - - ${output} Run ${command} - ${output} Strip String ${output} - Should Be Equal As Strings - ... ${output} - ... ${expected_result} - ... \nWrong output result for command:\n${command}\n\nExpected:\n${expected_result}\nCommand output:\n${output}\n\n + Ctn Run Command And Check Result As Strings ${command} ${expected_result} Examples: tc filter_vm expected_result -- ... 1 ${EMPTY} CRITICAL: 1 problem(s) detected diff --git a/tests/robot/apps/protocols/http/collection-centreon-web.robot b/tests/robot/apps/protocols/http/collection-centreon-web.robot index 09aa89efd..4e7d0ced6 100644 --- a/tests/robot/apps/protocols/http/collection-centreon-web.robot +++ b/tests/robot/apps/protocols/http/collection-centreon-web.robot @@ -23,15 +23,11 @@ ${CMD} ${CENTREON_PLUGINS} --plugin=apps::protocols::http::plugin *** Test Cases *** Check if ${test_desc} on Centreon [Tags] centreon collections http - ${output} Run - ... ${CMD} --config=${CURDIR}/${collection} - ${output} Strip String ${output} - Should Be Equal As Strings - ... ${output} - ... ${expected} - ... Wrong output result:\n\n ${output}\nInstead of:\n ${expected}\n\n + ${command} Catenate + ... ${CMD} --config=${CURDIR}/${collection} + Ctn Run Command And Check Result As Strings ${command} ${expected_result} - Examples: test_desc collection expected -- + Examples: test_desc collection expected_result -- ... authentication succeeds collection-centreon-web-check-auth.collection.json OK: Authentication resulted in 200 HTTP code ... hosts are down collection-centreon-web-check-down-hosts.collection.json OK: All hosts are UP | 'hostsRequest.down.count'=0;0;;0;1 ... commands are broken collection-centreon-web-check-broken-commands.collection.json WARNING:${SPACE} - Service FakeHostThatIsDown/Svc-BadCommand output is '(Execute command failed)' | 'commands.broken.count'=1;0;;0; diff --git a/tests/robot/apps/protocols/snmp/collection-sputnik.robot b/tests/robot/apps/protocols/snmp/collection-sputnik.robot index 134412437..18893c1e9 100644 --- a/tests/robot/apps/protocols/snmp/collection-sputnik.robot +++ b/tests/robot/apps/protocols/snmp/collection-sputnik.robot @@ -22,12 +22,7 @@ SNMP Collection - Sputnik Environment ${tc}/3 ... --snmp-community=apps/protocols/snmp/collection-sputnik ... --config=${CURDIR}${/}..${/}..${/}..${/}..${/}..${/}src/contrib/collection/snmp/sputnik-environment.json - ${output} Run ${command} - ${output} Strip String ${output} - Should Be Equal As Strings - ... ${output} - ... ${expected_result} - ... ${command}\nWrong output result for compliance of ${expected_result}{\n}Command output:{\n}${output}{\n}{\n}{\n} + Ctn Run Command And Check Result As Strings ${command} ${expected_result} Examples: tc expected_result -- ... 1 OK: Sensor '1' temperature is '20.06'°C and humidity is '33'% | '1#environment.temperature.celsius'=20.06C;;;; '1#environment.humidity.percent'=33%;;;0;100 diff --git a/tests/robot/apps/protocols/snmp/hashicorp-password-manager.robot b/tests/robot/apps/protocols/snmp/hashicorp-password-manager.robot index 41d02f6f1..16eae15e3 100644 --- a/tests/robot/apps/protocols/snmp/hashicorp-password-manager.robot +++ b/tests/robot/apps/protocols/snmp/hashicorp-password-manager.robot @@ -16,7 +16,7 @@ ${CMD} ${CENTREON_PLUGINS} --plugin apps::protocols::snmp::plugin - check hashicorp vault manager${Name} [Documentation] Check hashicorp vaultmanager [Tags] snmp vault - ${cmd_hashicorp} Catenate + ${command} Catenate ... ${CMD} ... --pass-manager=hashicorpvault ... --vault-address=${HOSTNAME} @@ -34,15 +34,10 @@ check hashicorp vault manager${Name} ... --format-ok='current value is: \\%{details_ok}' ... --format-details-warning='current value is: \\%{details_warning}' ... --format-details-critical='current value is: \\%{details_critical}' - ${output} Run - ... ${cmd_hashicorp} - ${output} Strip String ${output} - Should Be Equal As Strings - ... ${output} - ... ${result} - ... ${cmd_hashicorp}\n\n Wrong output result for hashicorp auth manager on snmp generic plugin, output got :\n${output} \nExpected : \n ${result}\n + + Ctn Run Command And Check Result As Strings ${command} ${expected_result} - Examples: Name path-param 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 diff --git a/tests/robot/cloud/azure/policyinsights/policystates/cloud-azure-policyinsights-policystates.robot b/tests/robot/cloud/azure/policyinsights/policystates/cloud-azure-policyinsights-policystates.robot index f894a142e..ec2518dd5 100644 --- a/tests/robot/cloud/azure/policyinsights/policystates/cloud-azure-policyinsights-policystates.robot +++ b/tests/robot/cloud/azure/policyinsights/policystates/cloud-azure-policyinsights-policystates.robot @@ -63,10 +63,6 @@ Azure PolicyInsights PolicyStates compliance IF ${length} > 0 ${command} Catenate ${command} --resource-type=${compliance_value.resourcetype} END - ${output} Run ${command} - ${output} Strip String ${output} - Should Be Equal As Strings - ... ${output} - ... ${compliance_value.result} - ... Wrong output result for compliance of ${compliance_value}.{\n}Command output:{\n}${output} + + Ctn Run Command And Check Result As Strings ${command} ${compliance_value.result} END diff --git a/tests/robot/hardware/devices/camera/avigilon/snmp/memory.robot b/tests/robot/hardware/devices/camera/avigilon/snmp/memory.robot index c5f50d8d3..3f1b51a02 100644 --- a/tests/robot/hardware/devices/camera/avigilon/snmp/memory.robot +++ b/tests/robot/hardware/devices/camera/avigilon/snmp/memory.robot @@ -24,12 +24,7 @@ Avigilon camera Memory ${tc}/3 ... --warning-available='${warning_available}' ... --critical-available='${critical_available}' - ${output} Run ${command} - ${output} Strip String ${output} - Should Be Equal As Strings - ... ${output} - ... ${expected_result} - ... \nWrong output result for command:\n${command}\n\nExpected:\n${expected_result}\nCommand output:\n${output}\n\n + Ctn Run Command And Check Result As Strings ${command} ${expected_result} Examples: tc warning_available critical_available expected_result -- ... 1 ${EMPTY} ${EMPTY} OK: total system memory available: 464.85 KB | 'memory.available'=476004B;;;0; diff --git a/tests/robot/hardware/devices/camera/avigilon/snmp/storage.robot b/tests/robot/hardware/devices/camera/avigilon/snmp/storage.robot index c7503181c..33b422adb 100644 --- a/tests/robot/hardware/devices/camera/avigilon/snmp/storage.robot +++ b/tests/robot/hardware/devices/camera/avigilon/snmp/storage.robot @@ -25,12 +25,7 @@ Avigilon camera Storage ${tc}/3 ... --critical-status='${critical_status}' ... --unknown-status='${unknown_status}' - ${output} Run ${command} - ${output} Strip String ${output} - Should Be Equal As Strings - ... ${output} - ... ${expected_result} - ... \nWrong output result for command:\n${command}\n\nExpected:\n${expected_result}\nCommand output:\n${output}\n\n + Ctn Run Command And Check Result As Strings ${command} ${expected_result} Examples: tc warning_status critical_status unknown_status expected_result -- ... 1 ${EMPTY} ${EMPTY} ${EMPTY} OK: state of the SD card: mediaNotPresent diff --git a/tests/robot/hardware/devices/camera/avigilon/snmp/temperature.robot b/tests/robot/hardware/devices/camera/avigilon/snmp/temperature.robot index 51597160f..63461c14c 100644 --- a/tests/robot/hardware/devices/camera/avigilon/snmp/temperature.robot +++ b/tests/robot/hardware/devices/camera/avigilon/snmp/temperature.robot @@ -26,12 +26,7 @@ Avigilon camera Temperature ${tc}/5 ... --warning-status='${warning_status}' ... --critical-status='${critical_status}' - ${output} Run ${command} - ${output} Strip String ${output} - Should Be Equal As Strings - ... ${output} - ... ${expected_result} - ... \nWrong output result for command:\n${command}\n\nExpected:\n${expected_result}\nCommand output:\n${output}\n\n + Ctn Run Command And Check Result As Strings ${command} ${expected_result} Examples: tc warning_temperature critical_temperature warning_status critical_status expected_result -- ... 1 ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} OK: temperature: 23.00 C, sensor 1 [type:mainSensor] status: ok | 'sensor.temperature.celsius'=23C;;;0; diff --git a/tests/robot/hardware/sensors/apc/snmp/hardware-sensors-apc-snmp.robot b/tests/robot/hardware/sensors/apc/snmp/hardware-sensors-apc-snmp.robot index c90871374..9dc74e06e 100644 --- a/tests/robot/hardware/sensors/apc/snmp/hardware-sensors-apc-snmp.robot +++ b/tests/robot/hardware/sensors/apc/snmp/hardware-sensors-apc-snmp.robot @@ -22,12 +22,7 @@ APC Sensors ${tc}/9 ${command} Append Option To Command ${command} --critical ${critical} ${command} Append Option To Command ${command} --component ${component} - ${output} Run ${command} - ${output} Strip String ${output} - Should Be Equal As Strings - ... ${output} - ... ${expected_result} - ... Wrong output result for compliance of ${expected_result}{\n}Command output:{\n}${output}{\n}{\n}{\n} + Ctn Run Command And Check Result As Strings ${command} ${expected_result} # --component 'temperature' --warning='humidity,.,45:65' --critical='humidity,.,35:70' Examples: tc component warning critical expected_result -- ... 1 _empty_ _empty_ _empty_ OK: All 2 components are ok [2/2 temperatures]. | 'Main Module:Sonde de temperature#hardware.sensor.temperature.celsius'=23C;;;; 'Main Module:Sonde de temperature#hardware.sensor.humidity.percentage'=35%;;;0;100 'hardware.temperature.count'=2;;;; diff --git a/tests/robot/hardware/ups/inmatics/sputnik/snmp/hardware-ups-sputnik-snmp.robot b/tests/robot/hardware/ups/inmatics/sputnik/snmp/hardware-ups-sputnik-snmp.robot index ab7cc9079..b8bb55b34 100644 --- a/tests/robot/hardware/ups/inmatics/sputnik/snmp/hardware-ups-sputnik-snmp.robot +++ b/tests/robot/hardware/ups/inmatics/sputnik/snmp/hardware-ups-sputnik-snmp.robot @@ -33,12 +33,7 @@ Sputnik UPS - Environment ${tc}/9 ${opt} Append Option --filter-id ${filter_id} ${command} Catenate ${command} ${opt} - ${output} Run ${command} - ${output} Strip String ${output} - Should Be Equal As Strings - ... ${output} - ... ${expected_result} - ... Wrong output result for compliance of ${expected_result}{\n}Command output:{\n}${output}{\n}{\n}{\n} + Ctn Run Command And Check Result As Strings ${command} ${expected_result} Examples: tc filter_id w_temperature c_temperature w_humidity c_humidity expected_result -- ... 1 1 30 50 50 70 OK: 'Sensor 1': temperature 20.06 C, humidity 33 % | 'Sensor 1#environment.temperature.celsius'=20.06C;0:30;0:50;; 'Sensor 1#environment.humidity.percentage'=33%;0:50;0:70;0;100 diff --git a/tests/robot/hardware/ups/socomec/netvision/snmp/hardware-ups-socomec-netvision-snmp.robot b/tests/robot/hardware/ups/socomec/netvision/snmp/hardware-ups-socomec-netvision-snmp.robot index 3ea0cb6b3..1bcef49b0 100644 --- a/tests/robot/hardware/ups/socomec/netvision/snmp/hardware-ups-socomec-netvision-snmp.robot +++ b/tests/robot/hardware/ups/socomec/netvision/snmp/hardware-ups-socomec-netvision-snmp.robot @@ -27,12 +27,7 @@ Battery ${tc}/4 ${opt} Append Option --critical-temperature ${c_temperature} ${command} Catenate ${command} ${opt} - ${output} Run ${command} - ${output} Strip String ${output} - Should Be Equal As Strings - ... ${output} - ... ${expected_result} - ... ${command} \nWrong output result for compliance of ${expected_result}{\n}Command output:{\n}${output}{\n}{\n}{\n} + Ctn Run Command And Check Result As Strings ${command} ${expected_result} Examples: tc w_temperature c_temperature expected_result -- ... 1 30 50 OK: battery status is normal - charge remaining: 100% (0 minutes remaining) | 'battery.charge.remaining.percent'=100%;;;0;100 'battery.charge.remaining.minutes'=0;;;0; 'battery.voltage.volt'=339.1V;;;; 'battery.temperature.celsius'=22C;0:30;0:50;; diff --git a/tests/robot/network/aruba/instant/snmp/aruba-instant-ap-usage.robot b/tests/robot/network/aruba/instant/snmp/aruba-instant-ap-usage.robot index 6bc9586ee..be24da5b9 100644 --- a/tests/robot/network/aruba/instant/snmp/aruba-instant-ap-usage.robot +++ b/tests/robot/network/aruba/instant/snmp/aruba-instant-ap-usage.robot @@ -66,10 +66,5 @@ Network Aruba Instant SNMP plugin ... --snmp-community=${ap_usage_tc.snmpcommunity} Log To Console ${command} - ${output} Run ${command} - ${output} Strip String ${output} - Should Be Equal As Strings - ... ${output} - ... ${ap_usage_tc.result} - ... Wrong output result for compliance of ${ap_usage_tc.result}{\n}Command output:{\n}${output}{\n}{\n}{\n} + Ctn Run Command And Check Result As Strings ${command} ${ap_usage_tc.result} END diff --git a/tests/robot/network/cisco/meraki/cloudcontroller/restapi/vpntunnels.robot b/tests/robot/network/cisco/meraki/cloudcontroller/restapi/vpntunnels.robot index 8c6fa0f8d..59876807d 100644 --- a/tests/robot/network/cisco/meraki/cloudcontroller/restapi/vpntunnels.robot +++ b/tests/robot/network/cisco/meraki/cloudcontroller/restapi/vpntunnels.robot @@ -31,16 +31,13 @@ Create cache from API Check if ${test_desc} works [Tags] meraki api vpn network - ${output} Run - ... ${CMD} --mode=vpn-tunnels --filter-network-name=${filter_network_name} --cache-use --critical-total-dormant=1: + ${command} Catenate + ... ${CMD} + ... --mode=vpn-tunnels --filter-network-name=${filter_network_name} --cache-use --critical-total-dormant=1: + + Ctn Run Command And Check Result As Strings ${command} ${expected_result} - ${output} Strip String ${output} - Should Be Equal As Strings - ... ${output} - ... ${expected} - ... Wrong output result:\n\n ${output}\nInstead of:\n ${expected}\n\n - - Examples: test_desc filter_network_name expected -- + Examples: test_desc filter_network_name expected_result -- ... all links .* OK: vpn tunnel 'C3PO-R2P2-BB88' status: dormant [mode: spoke] | 'vpn.tunnels.online.count'=0;;;0;1 'vpn.tunnels.offline.count'=0;;;0;1 'vpn.tunnels.dormant.count'=1;;1:;0;1 ... empty filter ${EMPTY} OK: vpn tunnel 'C3PO-R2P2-BB88' status: dormant [mode: spoke] | 'vpn.tunnels.online.count'=0;;;0;1 'vpn.tunnels.offline.count'=0;;;0;1 'vpn.tunnels.dormant.count'=1;;1:;0;1 ... absurd filter toto CRITICAL: Vpn tunnels dormant: 0 | 'vpn.tunnels.online.count'=0;;;0;0 'vpn.tunnels.offline.count'=0;;;0;0 'vpn.tunnels.dormant.count'=0;;1:;0;0 diff --git a/tests/robot/network/citrix/netscaler/snmp/mode/components/netscaler-health.robot b/tests/robot/network/citrix/netscaler/snmp/mode/components/netscaler-health.robot index 485a78049..2fa17547b 100644 --- a/tests/robot/network/citrix/netscaler/snmp/mode/components/netscaler-health.robot +++ b/tests/robot/network/citrix/netscaler/snmp/mode/components/netscaler-health.robot @@ -23,12 +23,7 @@ check psu components ${tc}/2 ... --component=psu ... --alternative-status-mapping='${alternative_status_mapping}' - ${output} Run ${command} - ${output} Strip String ${output} - Should Be Equal As Strings - ... ${output} - ... ${expected_result} - ... \nWrong output result for command:\n${command}\n\nExpected:\n${expected_result}\nCommand output:\n${output}\n + Ctn Run Command And Check Result As Strings ${command} ${expected_result} Examples: tc alternative_status_mapping community expected_result -- ... 1 true psu-citrix-v13 OK: All 4 components are ok [4/4 psus]. | 'count_psu'=4;;;; diff --git a/tests/robot/network/fortinet/fortigate/snmp/network-fortinet-fortigate-snmp.robot b/tests/robot/network/fortinet/fortigate/snmp/network-fortinet-fortigate-snmp.robot index ccfbdfb88..1b7faf639 100644 --- a/tests/robot/network/fortinet/fortigate/snmp/network-fortinet-fortigate-snmp.robot +++ b/tests/robot/network/fortinet/fortigate/snmp/network-fortinet-fortigate-snmp.robot @@ -382,14 +382,8 @@ Network Fortinet Fortigate SNMP link monitor ... ${command} ... --critical-packet-loss=${fortinet_fortigate_linkmonitor_test.criticalpacketloss} END - ${output} Run ${command} Log To Console . no_newline=true - ${output} Strip String ${output} - Should Be Equal As Strings - ... ${output} - ... ${fortinet_fortigate_linkmonitor_test.result} - ... Wrong result output for:${\n}Command: ${\n}${command}${\n}${\n}Expected output: ${\n}${fortinet_fortigate_linkmonitor_test.result}${\n}${\n}Obtained output:${\n}${output}${\n}${\n}${\n} - ... values=False + Ctn Run Command And Check Result As Strings ${command} ${fortinet_fortigate_linkmonitor_test.result} END Network Fortinet Fortigate SNMP list link monitor @@ -421,12 +415,6 @@ Network Fortinet Fortigate SNMP list link monitor ... ${command} ... --filter-vdom=${fortinet_fortigate_listlinkmonitors_test.filtervdom} END - ${output} Run ${command} Log To Console . no_newline=true - ${output} Strip String ${output} - Should Be Equal As Strings - ... ${output} - ... ${fortinet_fortigate_listlinkmonitors_test.result} - ... Wrong result output for:${\n}Command: ${\n}${command}${\n}${\n}Expected output: ${\n}${fortinet_fortigate_listlinkmonitors_test.result}${\n}${\n}Obtained output:${\n}${output}${\n}${\n}${\n} - ... values=False + Ctn Run Command And Check Result As Strings ${command} ${fortinet_fortigate_listlinkmonitors_test.result} END