Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ctor 862 automated test #5204

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions tests/os/windows/snmp/cpu.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
*** Settings ***
Documentation Linux Local Systemd-sc-status

Resource ${CURDIR}${/}..${/}..${/}..${/}resources/import.resource

Test Timeout 120s


*** Variables ***
${CMD} ${CENTREON_PLUGINS}

*** Test Cases ***
cpu ${tc}
[Tags] os linux
${command} Catenate
... ${CMD}
... --plugin=os::windows::snmp::plugin
... --mode=cpu
... --hostname=${HOSTNAME}
... --snmp-version=${SNMPVERSION}
... --snmp-port=${SNMPPORT}
... --snmp-community=os/windows/snmp/windows_anon
... --snmp-timeout=1
... --critical-average=${critical-average}
... --warning-average=${warning-average}
... --warning-core=${warning-core}
... --critical-core=${critical-core}

Ctn Run Command And Check Result As Strings ${command} ${expected_result}

Examples: tc critical-average warning-average warning-core critical-core expected_result --
... 2 '90' '80' ${EMPTY} ${EMPTY} OK: 2 CPU(s) average usage is 0.50 % | 'total_cpu_avg'=0.50%;0:80;0:90;0;100 'cpu_0'=1.00%;;;0;100 'cpu_1'=0.00%;;;0;100
... 3 '1180' '0' ${EMPTY} ${EMPTY} WARNING: 2 CPU(s) average usage is 0.50 % | 'total_cpu_avg'=0.50%;0:0;0:1180;0;100 'cpu_0'=1.00%;;;0;100 'cpu_1'=0.00%;;;0;100
... 4 ${EMPTY} ${EMPTY} '0' '0' CRITICAL: CPU '0' usage : 1.00 % | 'total_cpu_avg'=0.50%;;;0;100 'cpu_0'=1.00%;0:0;0:0;0;100 'cpu_1'=0.00%;0:0;0:0;0;100
... 5 '0' '0' ${EMPTY} ${EMPTY} CRITICAL: 2 CPU(s) average usage is 0.50 % | 'total_cpu_avg'=0.50%;0:0;0:0;0;100 'cpu_0'=1.00%;;;0;100 'cpu_1'=0.00%;;;0;100
31 changes: 31 additions & 0 deletions tests/os/windows/snmp/interfaces.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
*** Settings ***
Documentation Linux Local Systemd-sc-status

Resource ${CURDIR}${/}..${/}..${/}..${/}resources/import.resource

Test Timeout 120s


*** Variables ***
${CMD} ${CENTREON_PLUGINS}

*** Test Cases ***
interfaces ${tc}
[Tags] os linux
${command} Catenate
... ${CMD}
... --plugin=os::windows::snmp::plugin
... --mode=interfaces
... --hostname=${HOSTNAME}
... --snmp-version=${SNMPVERSION}
... --snmp-port=${SNMPPORT}
... --snmp-community=os/windows/snmp/windows_anon
... --snmp-timeout=1
... ${extra_options}

Ctn Run Command And Check Result As Strings ${command} ${expected_result}

Examples: tc extra_options expected_result --
... 1 --show-cache $VAR1 = {};
... 2 --display-transform-src='eth' UNKNOWN: Can't construct cache...
Comment on lines +29 to +30
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are not the results that are expected from the plugin


31 changes: 31 additions & 0 deletions tests/os/windows/snmp/list-interfaces.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
*** Settings ***
Documentation Linux Local Systemd-sc-status

Resource ${CURDIR}${/}..${/}..${/}..${/}resources/import.resource

Test Timeout 120s


*** Variables ***
${CMD} ${CENTREON_PLUGINS} --plugin=os::windows::snmp::plugin

*** Test Cases ***
list-interfaces ${tc}
[Tags] os linux
${command} Catenate
... ${CMD}
... --mode=list-interfaces
... --hostname=${HOSTNAME}
... --snmp-version=${SNMPVERSION}
... --snmp-port=${SNMPPORT}
... --snmp-community=os/windows/snmp/windows_anon
... ${extra_options}

Ctn Run Command And Check Result As Strings ${command} ${expected_result}

Examples: tc extra_options expected_result --
... 1 --add-extra-oid='' UNKNOWN: Can't get interfaces...
... 2 --add-extra-oid='' UNKNOWN: Can't get interfaces...
... 3 --add-mac-address='' UNKNOWN: Can't get interfaces...
... 4 --display-transform-src='eth' UNKNOWN: Can't get interfaces...
... 5 --display-transform-dst='ens' UNKNOWN: Can't get interfaces...
Comment on lines +27 to +31
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are not the results that are expected from the plugin

29 changes: 29 additions & 0 deletions tests/os/windows/snmp/list-processes.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
*** Settings ***
Documentation Linux Local Systemd-sc-status

Resource ${CURDIR}${/}..${/}..${/}..${/}resources/import.resource

Test Timeout 120s


*** Variables ***
${CMD} ${CENTREON_PLUGINS}

*** Test Cases ***
list-processes ${tc}
[Tags] os linux
${command} Catenate
... ${CMD}
... --plugin=os::windows::snmp::plugin
... --mode=list-processes
... --hostname=${HOSTNAME}
... --snmp-version=${SNMPVERSION}
... --snmp-port=${SNMPPORT}
... --snmp-community=os/windows/snmp/windows_anon
... ${extra_options}

Ctn Run Command And Check Result As Strings ${command} ${expected_result}

Examples: tc extra_options expected_result --
... 1 --filter-name UNKNOWN: SNMP Table Request: Cant get a single value.
... 2 --add-stats UNKNOWN: SNMP Table Request: Cant get a single value.
Comment on lines +28 to +29
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are not the results that are expected from the plugin

29 changes: 29 additions & 0 deletions tests/os/windows/snmp/list-services.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
*** Settings ***
Documentation Linux Local Systemd-sc-status

Resource ${CURDIR}${/}..${/}..${/}..${/}resources/import.resource

Test Timeout 120s


*** Variables ***
${CMD} ${CENTREON_PLUGINS}

*** Test Cases ***
list-services ${tc}
[Tags] os linux
${command} Catenate
... ${CMD}
... --plugin=os::windows::snmp::plugin
... --mode=list-services
... --hostname=${HOSTNAME}
... --snmp-version=${SNMPVERSION}
... --snmp-port=${SNMPPORT}
... --snmp-community=os/windows/snmp/windows_anon
... ${extra_options}

Ctn Run Command And Check Result As Strings ${command} ${expected_result}

Examples: tc extra_options expected_result --
... 1 --filter-name=toto UNKNOWN: SNMP Table Request: Cant get a single value.
... 2 --filter-name='' UNKNOWN: SNMP Table Request: Cant get a single value.
Comment on lines +28 to +29
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are not the results that are expected from the plugin

31 changes: 31 additions & 0 deletions tests/os/windows/snmp/list-storages.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
*** Settings ***
Documentation Linux Local Systemd-sc-status

Resource ${CURDIR}${/}..${/}..${/}..${/}resources/import.resource

Test Timeout 120s


*** Variables ***
${CMD} ${CENTREON_PLUGINS}

*** Test Cases ***
list-storages ${tc}
[Tags] os linux
${command} Catenate
... ${CMD}
... --plugin=os::windows::snmp::plugin
... --mode=list-storages
... --hostname=${HOSTNAME}
... --snmp-version=${SNMPVERSION}
... --snmp-port=${SNMPPORT}
... --snmp-community=os/windows/snmp/windows_anon
... --snmp-timeout=1
... ${extra_options}

Ctn Run Command And Check Result As Strings ${command} ${expected_result}

Examples: tc extra_options expected_result --
... 1 --display-transform-src='dev' List storage: 'Serial Number 5a987053' [size = 63720910848B] [id = 1] Skipping storage 'D:\\\\ Label:SSS_X64FRE_FR-FR_DV9 Serial Number cf70e675': no type or no matching filter type Skipping storage 'Virtual Memory': no type or no matching filter type Skipping storage 'Physical Memory': no type or no matching filter type
... 2 -display-transform-dst='run' List storage: 'Serial Number 5a987053' [size = 63720910848B] [id = 1] Skipping storage 'D:\\\\ Label:SSS_X64FRE_FR-FR_DV9 Serial Number cf70e675': no type or no matching filter type Skipping storage 'Virtual Memory': no type or no matching filter type Skipping storage 'Physical Memory': no type or no matching filter type
... 3 --filter-storage-type='^(hrStorageFixedDisk|hrStorageNetworkDisk|hrFSBerkeleyFFS)$' List storage: 'Serial Number 5a987053' [size = 63720910848B] [id = 1] Skipping storage 'D:\\\\ Label:SSS_X64FRE_FR-FR_DV9 Serial Number cf70e675': no type or no matching filter type Skipping storage 'Virtual Memory': no type or no matching filter type Skipping storage 'Physical Memory': no type or no matching filter type
35 changes: 35 additions & 0 deletions tests/os/windows/snmp/memory.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
*** Settings ***
Documentation Linux Local Systemd-sc-status

Resource ${CURDIR}${/}..${/}..${/}..${/}resources/import.resource

Test Timeout 120s


*** Variables ***
${CMD} ${CENTREON_PLUGINS}

*** Test Cases ***
memory ${tc}
[Tags] os linux
${command} Catenate
... ${CMD}
... --plugin=os::windows::snmp::plugin
... --mode=memory
... --hostname=${HOSTNAME}
... --snmp-version=${SNMPVERSION}
... --snmp-port=${SNMPPORT}
... --snmp-community=os/windows/snmp/windows_anon
... --snmp-timeout=1
... ${extra_options}

Ctn Run Command And Check Result As Strings ${command} ${expected_result}

Examples: tc extra_options expected_result --
... 1 --verbose OK: Ram Total: 4.00GB Used: 557.94MB (13.62%) Free: 3.45GB (86.38%) | 'used'=585039872B;;;0;4294377472
... 2 --warning-memory='80' OK: Ram Total: 4.00GB Used: 557.94MB (13.62%) Free: 3.45GB (86.38%) | 'used'=585039872B;0:3435501977;;0;4294377472
... 3 --units OK: Ram Total: 4.00GB Used: 557.94MB (13.62%) Free: 3.45GB (86.38%) | 'used'=585039872B;;;0;4294377472
... 4 --free OK: Ram Total: 4.00GB Used: 557.94MB (13.62%) Free: 3.45GB (86.38%) | 'memory.free.bytes'=3709337600B;;;0;4294377472
... 5 --critical-memory='90' --warning-memory='80' OK: Ram Total: 4.00GB Used: 557.94MB (13.62%) Free: 3.45GB (86.38%) | 'used'=585039872B;0:3435501977;0:3864939724;0;4294377472
... 6 --critical-memory='0' CRITICAL: Ram Total: 4.00GB Used: 557.94MB (13.62%) Free: 3.45GB (86.38%) | 'used'=585039872B;;0:0;0;4294377472
... 7 --warning-memory='0' WARNING: Ram Total: 4.00GB Used: 557.94MB (13.62%) Free: 3.45GB (86.38%) | 'used'=585039872B;0:0;;0;4294377472
32 changes: 32 additions & 0 deletions tests/os/windows/snmp/processcount.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
*** Settings ***
Documentation Linux Local Systemd-sc-status

Resource ${CURDIR}${/}..${/}..${/}..${/}resources/import.resource

Test Timeout 120s


*** Variables ***
${CMD} ${CENTREON_PLUGINS}

*** Test Cases ***
processcount ${tc}
[Tags] os linux
${command} Catenate
... ${CMD}
... --plugin=os::windows::snmp::plugin
... --mode=processcount
... --hostname=${HOSTNAME}
... --snmp-version=${SNMPVERSION}
... --snmp-port=${SNMPPORT}
... --snmp-community=os/windows/snmp/windows_anon
... --snmp-timeout=1
... ${extra_options}

Ctn Run Command And Check Result As Strings ${command} ${expected_result}

Examples: tc extra_options expected_result --
... 1 --critical-cpu-total OK: Number of current processes running: 0 | 'nbproc'=0;;;0;
... 2 --top OK: Number of current processes running: 0 | 'nbproc'=0;;;0;
... 3 --top-num OK: Number of current processes running: 0 | 'nbproc'=0;;;0;
... 4 --top-size OK: Number of current processes running: 0 | 'nbproc'=0;;;0;
Comment on lines +30 to +32
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests are not conclusive. Maybe the snmpwalk is incomplete, but having zero process is theoretically and practically impossible without filters

34 changes: 34 additions & 0 deletions tests/os/windows/snmp/services-en.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
*** Settings ***
Documentation Linux Local Systemd-sc-status

Resource ${CURDIR}${/}..${/}..${/}..${/}resources/import.resource

Test Timeout 120s


*** Variables ***
${CMD} ${CENTREON_PLUGINS}
... --plugin=os::windows::snmp::plugin
... --mode=service
... --hostname=${HOSTNAME}
... --snmp-port=${SNMPPORT}


*** Test Cases ***
Windows Services EN ${tc}
[Documentation] Full ASCII
[Tags] os linux local
${command} Catenate
... ${CMD}
... --snmp-community=os/windows/snmp/services-en
... --filter-name='${filter}'
... ${extra_option}

Ctn Run Command And Check Result As Strings ${command} ${expected_result}

Examples: tc filter extra_option expected_result --
... 1 ${EMPTY} ${EMPTY} OK: All services are ok | 'services.total.count'=168;;;0; 'services.active.count'=168;;;0; 'services.continue.pending.count'=0;;;0; 'services.pause.pending.count'=0;;;0; 'services.paused.count'=0;;;0;
... 2 toto ${EMPTY} OK: ${SPACE}| 'services.total.count'=0;;;0; 'services.active.count'=0;;;0; 'services.continue.pending.count'=0;;;0; 'services.pause.pending.count'=0;;;0; 'services.paused.count'=0;;;0;
... 3 toto --critical-active=1: CRITICAL: Number of services active: 0 | 'services.total.count'=0;;;0; 'services.active.count'=0;;1:;0; 'services.continue.pending.count'=0;;;0; 'services.pause.pending.count'=0;;;0; 'services.paused.count'=0;;;0;
... 4 ${EMPTY} --critical-active=1: OK: All services are ok | 'services.total.count'=168;;;0; 'services.active.count'=168;;1:;0; 'services.continue.pending.count'=0;;;0; 'services.pause.pending.count'=0;;;0; 'services.paused.count'=0;;;0;
... 5 ${EMPTY} --critical-active=1:1 CRITICAL: Number of services active: 168 | 'services.total.count'=168;;;0; 'services.active.count'=168;;1:1;0; 'services.continue.pending.count'=0;;;0; 'services.pause.pending.count'=0;;;0; 'services.paused.count'=0;;;0;
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,7 @@ ${CMD} ${CENTREON_PLUGINS}


*** Test Cases ***
Windows Services EN ${tc}
[Documentation] Full ASCII
[Tags] os linux local
${command} Catenate
... ${CMD}
... --snmp-community=os/windows/snmp/services-en
... --filter-name='${filter}'
... ${extra_option}

Ctn Run Command And Check Result As Strings ${command} ${expected_result}

Examples: tc filter extra_option expected_result --
... 1 ${EMPTY} ${EMPTY} OK: All services are ok | 'services.total.count'=168;;;0; 'services.active.count'=168;;;0; 'services.continue.pending.count'=0;;;0; 'services.pause.pending.count'=0;;;0; 'services.paused.count'=0;;;0;
... 2 toto ${EMPTY} OK: ${SPACE}| 'services.total.count'=0;;;0; 'services.active.count'=0;;;0; 'services.continue.pending.count'=0;;;0; 'services.pause.pending.count'=0;;;0; 'services.paused.count'=0;;;0;
... 3 toto --critical-active=1: CRITICAL: Number of services active: 0 | 'services.total.count'=0;;;0; 'services.active.count'=0;;1:;0; 'services.continue.pending.count'=0;;;0; 'services.pause.pending.count'=0;;;0; 'services.paused.count'=0;;;0;
... 4 ${EMPTY} --critical-active=1: OK: All services are ok | 'services.total.count'=168;;;0; 'services.active.count'=168;;1:;0; 'services.continue.pending.count'=0;;;0; 'services.pause.pending.count'=0;;;0; 'services.paused.count'=0;;;0;
... 5 ${EMPTY} --critical-active=1:1 CRITICAL: Number of services active: 168 | 'services.total.count'=168;;;0; 'services.active.count'=168;;1:1;0; 'services.continue.pending.count'=0;;;0; 'services.pause.pending.count'=0;;;0; 'services.paused.count'=0;;;0;

Windows Services FR ${tc}/x
Windows Services FR ${tc}
[Documentation] Systemd version < 248
[Tags] os linux local
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Windows, not Linux ;-)

${command} Catenate
Expand All @@ -49,7 +31,7 @@ Windows Services FR ${tc}/x
... ${expected_result}
... \nWrong output result for command:\n${command}\n\nExpected:\n${expected_result}\nCommand output:\n${output}\n\n

Examples: tc filter extra_option expected_result --
Examples: tc filter extra_option expected_result --
... 1 ${EMPTY} ${EMPTY} OK: All services are ok | 'services.total.count'=80;;;0; 'services.active.count'=80;;;0; 'services.continue.pending.count'=0;;;0; 'services.pause.pending.count'=0;;;0; 'services.paused.count'=0;;;0;
... 2 toto ${EMPTY} OK: ${SPACE}| 'services.total.count'=0;;;0; 'services.active.count'=0;;;0; 'services.continue.pending.count'=0;;;0; 'services.pause.pending.count'=0;;;0; 'services.paused.count'=0;;;0;
... 3 toto --critical-active=1: CRITICAL: Number of services active: 0 | 'services.total.count'=0;;;0; 'services.active.count'=0;;1:;0; 'services.continue.pending.count'=0;;;0; 'services.pause.pending.count'=0;;;0; 'services.paused.count'=0;;;0;
Expand Down
30 changes: 30 additions & 0 deletions tests/os/windows/snmp/storage.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
*** Settings ***
Documentation Linux Local Systemd-sc-status

Resource ${CURDIR}${/}..${/}..${/}..${/}resources/import.resource

Test Timeout 120s


*** Variables ***
${CMD} ${CENTREON_PLUGINS}

*** Test Cases ***
storage ${tc}
[Tags] os linux
${command} Catenate
... ${CMD}
... --plugin=os::windows::snmp::plugin
... --mode=storage
... --hostname=${HOSTNAME}
... --snmp-version=${SNMPVERSION}
... --snmp-port=${SNMPPORT}
... --snmp-community=os/windows/snmp/windows_anon
... --snmp-timeout=1
... ${extra_options}

Ctn Run Command And Check Result As Strings ${command} ${expected_result}

Examples: tc extra_options expected_result --
... 1 --filter-storage-type OK: All storages are ok | 'count'=4;;;0; 'used_Serial Number 5a987053'=31299354624B;;;0;63720910848 'used_D:\\\\ Label:SSS_X64FRE_FR-FR_DV9 Serial Number cf70e675'=5566558208B;;;0;5566558208 'used_Virtual Memory'=493027328B;;;0;5099683840 'used_Physical Memory'=585039872B;;;0;4294377472
... 2 --filter-duplicate OK: Storage 'Serial Number 5a987053' Usage Total: 59.34 GB Used: 29.15 GB (49.12%) Free: 30.19 GB (50.88%) | 'count'=1;;;0; 'used'=31299354624B;;;0;63720910848
Loading