enh(tests): new test for generic-snmp

This commit is contained in:
David Boucher 2025-02-28 18:29:28 +01:00
parent 447fb9c18e
commit 8a25007654
2 changed files with 19 additions and 1 deletions

View File

@ -9,6 +9,7 @@ Test Timeout 120s
*** Variables ***
${CMD} ${CENTREON_PLUGINS} --plugin=os::linux::snmp::plugin
${GS_CMD} ${GENERIC_SNMP} -j experimental/examples/cpu.json
*** Test Cases ***
@ -23,7 +24,7 @@ cpu ${tc}
... --snmp-community=os/linux/snmp/network-interfaces
... --snmp-timeout=1
... ${extra_options}
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
Examples: tc extra_options expected_result --
@ -37,3 +38,18 @@ cpu ${tc}
... 8 --critical-average='0' CRITICAL: 1 CPU(s) average usage is 2.00 % | 'total_cpu_avg'=2.00%;;0:0;0;100 'cpu'=2.00%;;;0;100
... 9 --warning-core='0' WARNING: CPU '0' usage : 2.00 % | 'total_cpu_avg'=2.00%;;;0;100 'cpu'=2.00%;0:0;;0;100
... 10 --critical-core='0' CRITICAL: CPU '0' usage : 2.00 % | 'total_cpu_avg'=2.00%;;;0;100 'cpu'=2.00%;;0:0;0;100
gs_cpu ${tc}
[Tags] os linux generic-snmp
${command} Catenate
... ${GS_CMD}
... --hostname=${HOSTNAME}
... --port=2024
... --snmp-version=${SNMPVERSION}
... --community=os/linux/snmp/network-interfaces
... ${extra_options}
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
Examples: tc extra_options expected_result --
... 1 ${EMPTY} OK: 1 CPU(s) average usage is 2.00 % - CPU '0' usage : 2.00 % | 'total_cpu_avg'=2.00%;;;0;100 'cpu'=2.00%;;;0;100

View File

@ -6,6 +6,8 @@ Library Process
*** Variables ***
${CENTREON_PLUGINS} perl ${CURDIR}${/}..${/}..${/}src${/}centreon_plugins.pl
${GENERIC_SNMP} experimental/target/release/generic-snmp
# one we use package, we need to remove the "perl" part to be sure the plugin is executable and is correctly formated
# with a shebang at the top.
${HOSTNAME} 127.0.0.1