centreon-plugins/tests/storage/synology/snmp/storage-synology-snmp.robot
omercier fe90a52295
new(tests): initiated unit tests (#5138)
Co-authored-by: May <110405507+mushroomempires@users.noreply.github.com>
Co-authored-by: Paul Oureib <poureib@centreon.com>

REFS: CTOR-805
2024-08-16 09:34:33 +02:00

89 lines
5.0 KiB
Plaintext

*** Settings ***
Documentation Storage Synology SNMP
Resource ${CURDIR}${/}..${/}..${/}..${/}resources/import.resource
Test Timeout 120s
*** Variables ***
${CMD} ${CENTREON_PLUGINS} --plugin=storage::synology::snmp::plugin
&{check_components_test1}
... description=Checking disk components when all disks are ok
... snmpcommunity=storage/synology/snmp/synology-disk-ok
... expected_output=OK: All 8 components are ok [2/2 disk, 2/2 fan, 1/1 psu, 2/2 raid, 1/1 system]. | 'Disk 1#hardware.disk.bad_sectors.count'=0;;;0; 'Disk 2#hardware.disk.bad_sectors.count'=0;;;0; 'hardware.disk.count'=2;;;; 'hardware.fan.count'=2;;;; 'hardware.psu.count'=1;;;; 'hardware.raid.count'=2;;;; 'hardware.system.count'=1;;;;
&{check_components_test2}
... description=Checking disk components when one disks is warning
... snmpcommunity=storage/synology/snmp/synology-disk-warning
... expected_output=WARNING: Disk 'Disk 2' health is warning | 'Disk 1#hardware.disk.bad_sectors.count'=0;;;0; 'Disk 2#hardware.disk.bad_sectors.count'=0;;;0; 'hardware.disk.count'=2;;;; 'hardware.fan.count'=2;;;; 'hardware.psu.count'=1;;;; 'hardware.raid.count'=2;;;; 'hardware.system.count'=1;;;;
&{check_components_test3}
... description=Checking disk components when one disks is critical
... snmpcommunity=storage/synology/snmp/synology-disk-critical
... expected_output=CRITICAL: Disk 'Disk 2' health is critical | 'Disk 1#hardware.disk.bad_sectors.count'=0;;;0; 'Disk 2#hardware.disk.bad_sectors.count'=0;;;0; 'hardware.disk.count'=2;;;; 'hardware.fan.count'=2;;;; 'hardware.psu.count'=1;;;; 'hardware.raid.count'=2;;;; 'hardware.system.count'=1;;;;
&{check_components_test4}
... description=Checking disk components when one disks is failing
... snmpcommunity=storage/synology/snmp/synology-disk-failing
... expected_output=CRITICAL: Disk 'Disk 2' health is failing | 'Disk 1#hardware.disk.bad_sectors.count'=0;;;0; 'Disk 2#hardware.disk.bad_sectors.count'=0;;;0; 'hardware.disk.count'=2;;;; 'hardware.fan.count'=2;;;; 'hardware.psu.count'=1;;;; 'hardware.raid.count'=2;;;; 'hardware.system.count'=1;;;;
@{check_components_tests}
... &{check_components_test1}
... &{check_components_test2}
... &{check_components_test3}
... &{check_components_test4}
&{uptime_t1}
... description=Uptime check expected to be OK
... snmpcommunity=storage/synology/snmp/synology-disk-ok
... warning=
... critical=
... expected_output=OK: System uptime is: 46m 5s | 'uptime'=2765.00s;;;0;
&{uptime_t2}
... description=Uptime check expected to be warning
... snmpcommunity=storage/synology/snmp/synology-disk-ok
... warning=10
... critical=
... expected_output=WARNING: System uptime is: 46m 5s | 'uptime'=2765.00s;0:10;;0;
&{uptime_t3}
... description=Uptime check expected to be critical
... snmpcommunity=storage/synology/snmp/synology-disk-ok
... warning=
... critical=10
... expected_output=CRITICAL: System uptime is: 46m 5s | 'uptime'=2765.00s;;0:10;0;
@{uptime_tests}
... &{uptime_t1}
... &{uptime_t2}
... &{uptime_t3}
*** Test Cases ***
Components
[Tags] storage synology snmp
FOR ${check_components_test} IN @{check_components_tests}
${command} Catenate
... ${CMD}
... --mode=components
... --hostname=${HOSTNAME}
... --snmp-version=${SNMPVERSION}
... --snmp-port=${SNMPPORT}
... --snmp-community=${check_components_test.snmpcommunity}
Ctn Run Command And Check Result As Strings ${command} ${check_components_test.expected_output}
END
Uptime
[Tags] storage synology snmp
FOR ${test_item} IN @{uptime_tests}
${command} Catenate
... ${CMD}
... --mode=uptime
... --hostname=${HOSTNAME}
... --snmp-version=${SNMPVERSION}
... --snmp-port=${SNMPPORT}
... --snmp-community=${test_item.snmpcommunity}
... --warning-uptime=${test_item.warning}
... --critical-uptime=${test_item.critical}
Ctn Run Command And Check Result As Strings ${command} ${test_item.expected_output}
END