centreon-plugins/tests
sdepassio 5a23b681ec
Ctor 1018 perl json path dependencies issue (#5469)
Refs: CTOR-1018
2025-03-05 09:20:04 +01:00
..
apps feat(vmware8-esx): add MVP modes (#5482) 2025-03-04 11:56:38 +01:00
centreon/plugins enh(passwordmgr-centreonvault): adapt vault module for plugins to the new specs (#5302) 2024-12-05 14:23:12 +01:00
cloud Plugin(cloud::azure::network::vpngateway::plugin) - Mode(vpn-gateway-status) : Wrong variable assignment (#5342) 2025-02-20 16:30:34 +01:00
cpan-libraries Ctor 1018 perl json path dependencies issue (#5469) 2025-03-05 09:20:04 +01:00
database fix(informix-snmp): consider log files in backedUpButNeeded state as free space in log-file-usage mode (#5352) (#4943) 2025-01-10 14:42:05 +01:00
hardware WIP 2025-03-04 16:17:00 +01:00
monitoring/iplabel/ekara/restapi fix(iplabel): don't show perfdata when the last execution don't have perfdata 2025-02-25 11:37:07 +01:00
network enh(network::chapsvision::crossing::snmp): Update antivirus OIDs (#5413) 2025-03-04 14:12:23 +01:00
os feat(option): added --change-output-adv option to alter output and exit code (#5155, #5379) 2025-01-13 10:24:42 +01:00
resources spellcheck 2025-03-04 16:55:36 +01:00
scripts enh(lenovo-snmp): added system-health, memory and cpu components to hardware mode (#5359) 2025-01-10 15:06:39 +01:00
storage fix(storage::emc::datadomain::snmp): fixed cleaning mode by adding timezone option CTOR-1415 (#5453) 2025-03-04 14:24:30 +01:00
README.md CTOR-644-plugin-network-moxa-switch-snmp-mode-interfaces-option-add-duplex-status-duplex-unknown (#5420) 2025-02-04 17:17:55 +01:00

README.md

centreon-plugins Automated tests

Robot tests

In this project robot Framework is used to order the integration tests.

install snmpsim

See docker image in ./github/docker/testing/ to find the right package to install and the method to install it. Once snmpsim is installed, you need to create the snmp user :

useradd snmp
mkdir -p /var/lib/snmp/cert_indexes/
chown snmp:snmp -R /var/lib/snmp/cert_indexes/

to launch snmpsim use this from the root of the project (one level above this file) :

sudo snmpsim-command-responder --logging-method=null --agent-udpv4-endpoint=127.0.0.1:2024 --process-user=snmp --process-group=snmp --data-dir='./tests' &
# to test it :  snmpwalk -v2c -c hardware/server/lenovo/xcc/snmp/system-health-ok 127.0.0.1:2024

test should be run with the "robot" binary, indicating the path to the test file to run. robot consider every file with .robot extension and try to execute every test case in it.

robot tests/

you can filter the tests run by specifying -e to exclude and -i to include a specific tag before the file path.

Get new data

Http

Any curl -v command should give enough info to create new tests/plugins on new http services.

If the plugin already exists, you can use the plugin to gater the data with the --debug --verbose options.

Snmp

To get snmp data, you can use the snmpwalk command on the host you want to monitor.

snmpwalk -ObentU -v2c -c 'public' localhost .1

Anonymize tests

As most snmpwalk are provided by users, a script allow to anonymize the data and remove oid not used. the option --no-anonymization allow to not anonymize the data and only remove oid not used.

perl ./tests/scripts/slim_walk.pl --snmpwalk-path=tests/hardware/client.snmpwalk > smaller-file.snmpwalk

unit tests

In this project perl test::v0 is used to run unit tests.

test coverage

To check your test coverage you can use Deve::Cover when launching any type of test, prepend this to your command :

PERL5OPT=-MDevel::Cover

for exemple for robot :

PERL5OPT=-MDevel::Cover robot tests/

It will create a cover_db/ folder to store all data, you can use the cover to generate a html report.

cover

Then open the coverage.html file in the cover_db/ folder to navigate your code with coverage.