From c957162f97f5f3991811e323d21a70feeec4f6b6 Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Thu, 3 Oct 2024 09:28:13 +0200 Subject: [PATCH 1/2] Update variables names + add API_PROTOCOL variable Run tests not related to a new or updated plugin in the CI --- .github/workflows/plugins-test.yml | 125 ++++++++++++++++++ .../pkg.json | 2 +- .../pkg.json | 2 +- src/storage/synology/snmp/mode/ups.pm | 46 +++---- src/storage/wd/nas/snmp/plugin.pm | 2 +- .../apps/automation/ansible/tower/hosts.robot | 2 +- .../apps/automation/ansible/tower/jobs.robot | 2 +- tests/apps/ipfabric/discovery.robot | 2 +- .../http/collection-centreon-web.robot | 4 +- .../protocols/snmp/collection-sputnik.robot | 4 +- .../snmp/hashicorp-password-manager.robot | 8 +- .../aws/cloudtrail/checktrailstatus.robot | 2 +- tests/cloud/aws/cloudtrail/countevents.robot | 2 +- ...ud-azure-policyinsights-policystates.robot | 2 +- .../vmware/velocloud/restapi/edgestatus.robot | 6 +- .../vmware/velocloud/restapi/listedges.robot | 6 +- .../devices/camera/avigilon/snmp/memory.robot | 2 +- .../camera/avigilon/snmp/storage.robot | 2 +- .../camera/avigilon/snmp/temperature.robot | 2 +- .../8000/hardware-kvm-avocent-acs-8000.robot | 4 +- tests/hardware/pdu/cyberpower/snmp/load.robot | 2 +- .../pdu/cyberpower/snmp/outlets.robot | 2 +- .../apc/snmp/hardware-sensors-apc-snmp.robot | 2 +- .../snmp/hardware-ups-sputnik-snmp.robot | 4 +- .../hardware-ups-socomec-netvision-snmp.robot | 4 +- .../snmp/hardware-ups-standard-snmp.robot | 4 +- .../instant/snmp/aruba-instant-ap-usage.robot | 2 +- tests/network/backbox/restapi/backup.robot | 4 +- .../backbox/restapi/configstatus.robot | 4 +- .../backbox/restapi/intellicheck.robot | 4 +- .../cloudcontroller/restapi/vpntunnels.robot | 2 +- .../mode/components/netscaler-health.robot | 2 +- .../fortigate/snmp/link-monitor.robot | 4 +- .../fortigate/snmp/list-link-monitor.robot | 4 +- tests/network/stormshield/snmp/hardware.robot | 4 +- tests/os/linux/snmp/arp.robot | 4 +- tests/os/linux/snmp/cpu-detailed.robot | 4 +- tests/os/linux/snmp/cpu.robot | 4 +- tests/os/linux/snmp/disk-usage.robot | 4 +- tests/os/linux/snmp/diskio.robot | 4 +- tests/os/linux/snmp/inodes.robot | 4 +- tests/os/linux/snmp/list-diskio.robot | 4 +- tests/os/linux/snmp/list-diskspath.robot | 4 +- tests/os/linux/snmp/list-interfaces.robot | 4 +- tests/os/linux/snmp/list-processes.robot | 4 +- tests/os/linux/snmp/list-storages.robot | 4 +- tests/os/linux/snmp/load.robot | 4 +- tests/os/linux/snmp/memory.robot | 4 +- tests/os/linux/snmp/network-interfaces.robot | 2 +- tests/os/linux/snmp/processcount.robot | 4 +- tests/os/linux/snmp/storage.robot | 4 +- tests/os/linux/snmp/swap.robot | 4 +- tests/os/linux/snmp/tcpcon.robot | 4 +- tests/os/linux/snmp/time.robot | 4 +- tests/os/linux/snmp/udpcon.robot | 4 +- tests/os/linux/snmp/uptime.robot | 4 +- tests/os/windows/snmp/services.robot | 2 +- tests/resources/resources.resource | 7 +- .../restapi/storage-datacore-restapi.robot | 2 +- .../storage/hp/primera/restapi/capacity.robot | 6 +- .../hp/primera/restapi/diskstatus.robot | 6 +- .../hp/primera/restapi/diskusage.robot | 6 +- .../storage/hp/primera/restapi/licenses.robot | 6 +- .../hp/primera/restapi/listdisks.robot | 6 +- .../hp/primera/restapi/listvolumes.robot | 6 +- tests/storage/hp/primera/restapi/nodes.robot | 6 +- .../hp/primera/restapi/volumeusage.robot | 6 +- .../synology/snmp/storage-synology-snmp.robot | 8 +- tests/storage/wd/nas/snmp/hardware.robot | 4 +- tests/storage/wd/nas/snmp/listvolumes.robot | 4 +- tests/storage/wd/nas/snmp/volumes.robot | 4 +- 71 files changed, 281 insertions(+), 155 deletions(-) create mode 100644 .github/workflows/plugins-test.yml diff --git a/.github/workflows/plugins-test.yml b/.github/workflows/plugins-test.yml new file mode 100644 index 0000000000..af7b36988f --- /dev/null +++ b/.github/workflows/plugins-test.yml @@ -0,0 +1,125 @@ +name: plugins-tests + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +on: + workflow_dispatch: + pull_request: + paths: + - '.github/workflows/plugins.yml' + - '.github/scripts/plugins-source.container.pl' + - '.github/packaging/centreon-plugin.yaml.template' + - 'src/**' + - 'packaging/**' + - 'tests/**' + push: + branches: + - develop + - master + paths: + - '.github/workflows/plugins.yml' + - '.github/scripts/plugins-source.container.pl' + - '.github/packaging/centreon-plugin.yaml.template' + - 'src/**' + - 'packaging/**' + +jobs: + get-environment-tests: + uses: ./.github/workflows/get-environment.yml + + get-plugins-tests: + runs-on: ubuntu-22.04 + outputs: + plugins: ${{ steps.get_plugins.outputs.plugins }} + robot_tests: ${{ steps.list_tests.outputs.robot_tests }} + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + fetch-depth: 0 + + - uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1 + with: + python-version: '3.9' + + - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 + id: filter + with: + base: ${{ github.ref }} + list-files: shell + filters: | + common: + - added|deleted|modified: src/centreon/** + - modified: .github/packaging/centreon-plugin.yaml.template + packages: + - added|modified: packaging/** + plugins: + - added|modified: src/** + robot_tests: + - added|modified: tests/**/*.robot + - added|modified: tests/**/*.json + - added|modified: tests/**/*.snmpwalk + + - name: Transform plugins to directories + run: | + folders=() + for f in ${{ steps.filter.outputs.packages_files }}; do + echo "Adding $(dirname $f) to folders" + folders+=($(dirname $f)) + done + unique_folders=($(printf "%s\n" "${folders[@]}" | sort -u | tr '\n' ' ')) + jq --compact-output --null-input '$ARGS.positional' --args -- ${unique_folders[@]} > package_directories.txt + + files=() + for f in ${{ steps.filter.outputs.plugins_files }}; do + echo "Adding $f to files" + files+=($f) + done + unique_files=($(printf "%s\n" "${files[@]}" | sort -u | tr '\n' ' ')) + jq --compact-output --null-input '$ARGS.positional' --args -- ${unique_files[@]} > plugins.txt + shell: bash + + - name: Get plugins for build + id: get_plugins + if: ${{ steps.filter.outputs.common == 'true' || steps.filter.outputs.packages == 'true' || steps.filter.outputs.plugins == 'true' }} + run: | + PLUGINS="$(python3 .github/scripts/process-plugins.py '${{ steps.filter.outputs.common == 'true' }}')" + echo "plugins=$(echo $PLUGINS)" >> $GITHUB_OUTPUT + if [ "$PLUGINS" == '' ]; then + echo "::notice::There are no modifications to the plugins packages" + fi + shell: bash + + - name: List tests not related to a new or updated plugin + id: list_tests + run: | + # Get the unique directories of the robot tests + robot_tests_folders=() + for robot_test_file in ${{ steps.filter.outputs.robot_tests_files }}; do + robot_tests_folders+=($(dirname $robot_test_file)) + done + unique_robot_tests_folders=($(printf "%s\n" "${robot_tests_folders[@]}" | sort -u)) + robot_tests_folders=("${unique_robot_tests_folders[@]}") + + packages=$(> $GITHUB_OUTPUT + shell: bash diff --git a/packaging/centreon-plugin-Applications-Ansible-Tower/pkg.json b/packaging/centreon-plugin-Applications-Ansible-Tower/pkg.json index e8cf74834d..ed16c11de1 100644 --- a/packaging/centreon-plugin-Applications-Ansible-Tower/pkg.json +++ b/packaging/centreon-plugin-Applications-Ansible-Tower/pkg.json @@ -6,4 +6,4 @@ "centreon/plugins/script_custom.pm", "apps/automation/ansible/tower/" ] -} +} \ No newline at end of file diff --git a/packaging/centreon-plugin-Applications-Ipfabric-Api/pkg.json b/packaging/centreon-plugin-Applications-Ipfabric-Api/pkg.json index 77afdb2dc9..2b19fde617 100644 --- a/packaging/centreon-plugin-Applications-Ipfabric-Api/pkg.json +++ b/packaging/centreon-plugin-Applications-Ipfabric-Api/pkg.json @@ -6,4 +6,4 @@ "centreon/plugins/script_custom.pm", "apps/ipfabric/" ] -} +} \ No newline at end of file diff --git a/src/storage/synology/snmp/mode/ups.pm b/src/storage/synology/snmp/mode/ups.pm index b231a3e12d..fc0771e294 100644 --- a/src/storage/synology/snmp/mode/ups.pm +++ b/src/storage/synology/snmp/mode/ups.pm @@ -34,28 +34,28 @@ sub set_counters { $self->{maps_counters}->{global} = [ { label => 'load', nlabel => 'ups.load.percent', set => { - key_values => [ { name => 'ups_load' } ], - output_template => 'ups load: %s%%', - perfdatas => [ - { template => '%s', min => 0, max => 100, unit => '%' } - ] - } + key_values => [ { name => 'ups_load' } ], + output_template => 'ups load: %s%%', + perfdatas => [ + { template => '%s', min => 0, max => 100, unit => '%' } + ] + } }, { label => 'charge-remaining', nlabel => 'battery.charge.remaining.percent', set => { - key_values => [ { name => 'charge_remain' } ], - output_template => 'battery charge remaining: %s%%', - perfdatas => [ - { template => '%s', min => 0, max => 100, unit => '%' } - ] - } + key_values => [ { name => 'charge_remain' } ], + output_template => 'battery charge remaining: %s%%', + perfdatas => [ + { template => '%s', min => 0, max => 100, unit => '%' } + ] + } }, { label => 'lifetime-remaining', nlabel => 'battery.lifetime.remaining.seconds', set => { - key_values => [ { name => 'lifetime_remain' } ], - output_template => 'battery estimated lifetime: %s seconds', - perfdatas => [ - { template => '%s', min => 0, unit => 's' } - ] - } + key_values => [ { name => 'lifetime_remain' } ], + output_template => 'battery estimated lifetime: %s seconds', + perfdatas => [ + { template => '%s', min => 0, unit => 's' } + ] + } } ]; } @@ -75,19 +75,19 @@ sub manage_selection { my ($self, %options) = @_; my $oid_upsBatteryRuntimeValue = '.1.3.6.1.4.1.6574.4.3.6.1.0'; # in seconds - my $oid_upsBatteryChargeValue = '.1.3.6.1.4.1.6574.4.3.1.1.0'; # in % - my $oid_upsInfoLoadValue = '.1.3.6.1.4.1.6574.4.2.12.1.0'; # in % + my $oid_upsBatteryChargeValue = '.1.3.6.1.4.1.6574.4.3.1.1.0'; # in % + my $oid_upsInfoLoadValue = '.1.3.6.1.4.1.6574.4.2.12.1.0'; # in % my $snmp_result = $options{snmp}->get_leef( - oids => [ + oids => [ $oid_upsBatteryRuntimeValue, $oid_upsBatteryChargeValue, $oid_upsInfoLoadValue ], nothing_quit => 1 ); $self->{global} = { - ups_load => $snmp_result->{$oid_upsInfoLoadValue}, - charge_remain => $snmp_result->{$oid_upsBatteryChargeValue}, + ups_load => $snmp_result->{$oid_upsInfoLoadValue}, + charge_remain => $snmp_result->{$oid_upsBatteryChargeValue}, lifetime_remain => $snmp_result->{$oid_upsBatteryRuntimeValue}, }; } diff --git a/src/storage/wd/nas/snmp/plugin.pm b/src/storage/wd/nas/snmp/plugin.pm index 3e938556cd..bec9846570 100644 --- a/src/storage/wd/nas/snmp/plugin.pm +++ b/src/storage/wd/nas/snmp/plugin.pm @@ -32,7 +32,7 @@ sub new { $self->{modes} = { 'hardware' => 'storage::wd::nas::snmp::mode::hardware', 'list-volumes' => 'storage::wd::nas::snmp::mode::listvolumes', - 'volumes' => 'storage::wd::nas::snmp::mode::volumes' + 'volumes' => 'storage::wd::nas::snmp::mode::volumes' }; return $self; diff --git a/tests/apps/automation/ansible/tower/hosts.robot b/tests/apps/automation/ansible/tower/hosts.robot index cbd1275fc5..7a6f817afd 100644 --- a/tests/apps/automation/ansible/tower/hosts.robot +++ b/tests/apps/automation/ansible/tower/hosts.robot @@ -17,7 +17,7 @@ ${CMD} ${CENTREON_PLUGINS} ... --hostname=${HOSTNAME} ... --username=username ... --password=password -... --port=${APIPORT} +... --port=${API_PORT} *** Test Cases *** diff --git a/tests/apps/automation/ansible/tower/jobs.robot b/tests/apps/automation/ansible/tower/jobs.robot index f99c2ab700..c58d9e4ab0 100644 --- a/tests/apps/automation/ansible/tower/jobs.robot +++ b/tests/apps/automation/ansible/tower/jobs.robot @@ -17,7 +17,7 @@ ${cmd} ${CENTREON_PLUGINS} ... --hostname=${HOSTNAME} ... --username=username ... --password=password -... --port=${APIPORT} +... --port=${API_PORT} *** Test Cases *** diff --git a/tests/apps/ipfabric/discovery.robot b/tests/apps/ipfabric/discovery.robot index 33d50fe79b..369236979c 100644 --- a/tests/apps/ipfabric/discovery.robot +++ b/tests/apps/ipfabric/discovery.robot @@ -15,7 +15,7 @@ ${CMD} ${CENTREON_PLUGINS} --plugin=apps::ipfabric::plugin ... --api-key=EEECGFCGFCGF ... --mode=discovery ... --http-peer-addr=127.0.0.1 -... --proto=http +... --proto=${API_PROTOCOL} ... --port=3000 ... --prettify diff --git a/tests/apps/protocols/http/collection-centreon-web.robot b/tests/apps/protocols/http/collection-centreon-web.robot index 90678d4348..ca95a4e9f5 100644 --- a/tests/apps/protocols/http/collection-centreon-web.robot +++ b/tests/apps/protocols/http/collection-centreon-web.robot @@ -14,8 +14,8 @@ ${MOCKOON_JSON} ${CURDIR}${/}collection-centreon-web.mockoon.json ${CMD} ${CENTREON_PLUGINS} --plugin=apps::protocols::http::plugin ... --mode collection ... --constant='hostname=${HOSTNAME}' -... --constant='protocol=http' -... --constant='port=${APIPORT}' +... --constant='protocol=${API_PROTOCOL}' +... --constant='port=${API_PORT}' ... --constant='username=admin' ... --constant='password=myPassword' diff --git a/tests/apps/protocols/snmp/collection-sputnik.robot b/tests/apps/protocols/snmp/collection-sputnik.robot index 0ec9b73db6..a05650e05c 100644 --- a/tests/apps/protocols/snmp/collection-sputnik.robot +++ b/tests/apps/protocols/snmp/collection-sputnik.robot @@ -17,8 +17,8 @@ SNMP Collection - Sputnik Environment ${tc}/3 ... ${CMD} ... --mode=collection ... --hostname=${HOSTNAME} - ... --snmp-version=${SNMPVERSION} - ... --snmp-port=${SNMPPORT} + ... --snmp-version=${SNMP_VERSION} + ... --snmp-port=${SNMP_PORT} ... --snmp-community=apps/protocols/snmp/collection-sputnik ... --config=${CURDIR}${/}..${/}..${/}..${/}..${/}src/contrib/collection/snmp/sputnik-environment.json diff --git a/tests/apps/protocols/snmp/hashicorp-password-manager.robot b/tests/apps/protocols/snmp/hashicorp-password-manager.robot index bc288f5d9e..ad81391d09 100644 --- a/tests/apps/protocols/snmp/hashicorp-password-manager.robot +++ b/tests/apps/protocols/snmp/hashicorp-password-manager.robot @@ -20,15 +20,15 @@ check hashicorp vault manager${Name} ... ${CMD} ... --pass-manager=hashicorpvault ... --vault-address=${HOSTNAME} - ... --vault-port=${APIPORT} - ... --vault-protocol=http + ... --vault-port=${API_PORT} + ... --vault-protocol=${API_PROTOCOL} ... --auth-method=userpass ... --auth-settings="username=hcvaultuser" ... --secret-path="path/of/the/secret" - ... --snmp-port=${SNMPPORT} + ... --snmp-port=${SNMP_PORT} ... --map-option="snmp_community=\\%{value_path/of/the/secret}" ... --mode=string-value - ... --snmp-version=${SNMPVERSION} + ... --snmp-version=${SNMP_VERSION} ... --snmp-community=apps/protocols/snmp/snmp-single-oid ... --oid='.1.3.6.1.2.1.1.1.0' ${path-param} ... --format-ok='current value is: \\%{details_ok}' diff --git a/tests/cloud/aws/cloudtrail/checktrailstatus.robot b/tests/cloud/aws/cloudtrail/checktrailstatus.robot index 4c785abf2a..580dfb409f 100644 --- a/tests/cloud/aws/cloudtrail/checktrailstatus.robot +++ b/tests/cloud/aws/cloudtrail/checktrailstatus.robot @@ -22,7 +22,7 @@ AWS CloudTrail check trail status ${command} Catenate ... ${CMD} ... --mode=checktrailstatus - ... --endpoint=http://${HOSTNAME}:${APIPORT}/cloudtrail/gettrailstatus/${trailstatus} + ... --endpoint=${API_PROTOCOL}://${HOSTNAME}:${API_PORT}/cloudtrail/gettrailstatus/${trailstatus} ... --trail-name=trailname Ctn Run Command And Check Result As Strings ${command} ${expected_result} diff --git a/tests/cloud/aws/cloudtrail/countevents.robot b/tests/cloud/aws/cloudtrail/countevents.robot index e47a2ddc12..0798d10d25 100644 --- a/tests/cloud/aws/cloudtrail/countevents.robot +++ b/tests/cloud/aws/cloudtrail/countevents.robot @@ -22,7 +22,7 @@ AWS CloudTrail count events ${command} Catenate ... ${CMD} ... --mode=countevents - ... --endpoint=http://localhost:3000/cloudtrail/events/AwsApiCall/${AwsApiCall}/AwsServiceEvent/${AwsServiceEvent}/AwsConsoleAction/${AwsConsoleAction}/AwsConsoleSignIn/${AwsConsoleSignIn}/NextToken/${NextToken} + ... --endpoint=${API_PROTOCOL}://localhost:3000/cloudtrail/events/AwsApiCall/${AwsApiCall}/AwsServiceEvent/${AwsServiceEvent}/AwsConsoleAction/${AwsConsoleAction}/AwsConsoleSignIn/${AwsConsoleSignIn}/NextToken/${NextToken} ... ${extraoptions} Ctn Run Command And Check Result As Strings ${command} ${expected_result} diff --git a/tests/cloud/azure/policyinsights/policystates/cloud-azure-policyinsights-policystates.robot b/tests/cloud/azure/policyinsights/policystates/cloud-azure-policyinsights-policystates.robot index 8b7c3d58d1..508ec04995 100644 --- a/tests/cloud/azure/policyinsights/policystates/cloud-azure-policyinsights-policystates.robot +++ b/tests/cloud/azure/policyinsights/policystates/cloud-azure-policyinsights-policystates.robot @@ -11,7 +11,7 @@ Test Timeout 120s *** Variables *** ${MOCKOON_JSON} ${CURDIR}${/}cloud-azure-policyinsights-policystates.json -${BASE_URL} http://${HOSTNAME}:${APIPORT} +${BASE_URL} ${API_PROTOCOL}://${HOSTNAME}:${API_PORT} ${LOGIN_ENDPOINT} ${BASE_URL}/login ${CMD} ${CENTREON_PLUGINS} --plugin=cloud::azure::policyinsights::policystates::plugin --subscription=subscription --tenant=tenant --client-id=client_id --client-secret=secret --statefile-dir=/dev/shm/ --login-endpoint=${LOGIN_ENDPOINT} diff --git a/tests/cloud/vmware/velocloud/restapi/edgestatus.robot b/tests/cloud/vmware/velocloud/restapi/edgestatus.robot index 5855369f9f..1f333d609b 100644 --- a/tests/cloud/vmware/velocloud/restapi/edgestatus.robot +++ b/tests/cloud/vmware/velocloud/restapi/edgestatus.robot @@ -11,15 +11,15 @@ Test Timeout 120s *** Variables *** ${MOCKOON_JSON} ${CURDIR}${/}velocloud.mockoon.json ${HOSTNAME} 127.0.0.1 -${APIPORT} 3000 +${API_PORT} 3000 ${CMD} ${CENTREON_PLUGINS} ... --plugin=cloud::vmware::velocloud::restapi::plugin ... --mode edge-status ... --hostname=${HOSTNAME} ... --username=XloginX ... --password=XpasswordX -... --proto=http -... --port=${APIPORT} +... --proto=${API_PROTOCOL} +... --port=${API_PORT} ... --custommode=api ... --statefile-dir=/dev/shm/ diff --git a/tests/cloud/vmware/velocloud/restapi/listedges.robot b/tests/cloud/vmware/velocloud/restapi/listedges.robot index 32ac04c176..76885327c1 100644 --- a/tests/cloud/vmware/velocloud/restapi/listedges.robot +++ b/tests/cloud/vmware/velocloud/restapi/listedges.robot @@ -11,15 +11,15 @@ Test Timeout 120s *** Variables *** ${MOCKOON_JSON} ${CURDIR}${/}velocloud.mockoon.json ${HOSTNAME} 127.0.0.1 -${APIPORT} 3000 +${API_PORT} 3000 ${CMD} ${CENTREON_PLUGINS} ... --plugin=cloud::vmware::velocloud::restapi::plugin ... --mode list-edges ... --hostname=${HOSTNAME} ... --username=XloginX ... --password=XpasswordX -... --proto=http -... --port=${APIPORT} +... --proto=${API_PROTOCOL} +... --port=${API_PORT} ... --custommode=api ... --statefile-dir=/dev/shm/ diff --git a/tests/hardware/devices/camera/avigilon/snmp/memory.robot b/tests/hardware/devices/camera/avigilon/snmp/memory.robot index 1dae28e0df..bab6faff22 100644 --- a/tests/hardware/devices/camera/avigilon/snmp/memory.robot +++ b/tests/hardware/devices/camera/avigilon/snmp/memory.robot @@ -11,7 +11,7 @@ ${CMD} ${CENTREON_PLUGINS} ... --plugin=hardware::devices::camera::avigilon::snmp::plugin ... --mode=memory ... --hostname=${HOSTNAME} -... --snmp-port=${SNMPPORT} +... --snmp-port=${SNMP_PORT} *** Test Cases *** diff --git a/tests/hardware/devices/camera/avigilon/snmp/storage.robot b/tests/hardware/devices/camera/avigilon/snmp/storage.robot index 980379563c..5f972729d3 100644 --- a/tests/hardware/devices/camera/avigilon/snmp/storage.robot +++ b/tests/hardware/devices/camera/avigilon/snmp/storage.robot @@ -11,7 +11,7 @@ ${CMD} ${CENTREON_PLUGINS} ... --plugin=hardware::devices::camera::avigilon::snmp::plugin ... --mode=storage ... --hostname=${HOSTNAME} -... --snmp-port=${SNMPPORT} +... --snmp-port=${SNMP_PORT} *** Test Cases *** diff --git a/tests/hardware/devices/camera/avigilon/snmp/temperature.robot b/tests/hardware/devices/camera/avigilon/snmp/temperature.robot index ab3be9ab99..96100f15b8 100644 --- a/tests/hardware/devices/camera/avigilon/snmp/temperature.robot +++ b/tests/hardware/devices/camera/avigilon/snmp/temperature.robot @@ -11,7 +11,7 @@ ${CMD} ${CENTREON_PLUGINS} ... --plugin=hardware::devices::camera::avigilon::snmp::plugin ... --mode=temperature ... --hostname=${HOSTNAME} -... --snmp-port=${SNMPPORT} +... --snmp-port=${SNMP_PORT} *** Test Cases *** diff --git a/tests/hardware/kvm/avocent/acs/8000/hardware-kvm-avocent-acs-8000.robot b/tests/hardware/kvm/avocent/acs/8000/hardware-kvm-avocent-acs-8000.robot index 1eb1c73c13..e7d6c1f4e7 100644 --- a/tests/hardware/kvm/avocent/acs/8000/hardware-kvm-avocent-acs-8000.robot +++ b/tests/hardware/kvm/avocent/acs/8000/hardware-kvm-avocent-acs-8000.robot @@ -91,8 +91,8 @@ Run Avocent 8000 Plugin ... --plugin=hardware::kvm::avocent::acs::8000::snmp::plugin ... --mode=${mode} ... --hostname=${HOSTNAME} - ... --snmp-version=${SNMPVERSION} - ... --snmp-port=${SNMPPORT} + ... --snmp-version=${SNMP_VERSION} + ... --snmp-port=${SNMP_PORT} ... --snmp-community=${SNMPCOMMUNITY} ... ${extraoptions} diff --git a/tests/hardware/pdu/cyberpower/snmp/load.robot b/tests/hardware/pdu/cyberpower/snmp/load.robot index 6f5a1eec67..5613099dd1 100644 --- a/tests/hardware/pdu/cyberpower/snmp/load.robot +++ b/tests/hardware/pdu/cyberpower/snmp/load.robot @@ -18,7 +18,7 @@ load ${tc} ... ${CMD} ... --mode=load ... --hostname=${HOSTNAME} - ... --snmp-port=${SNMPPORT} + ... --snmp-port=${SNMP_PORT} ... --snmp-community=hardware/pdu/cyberpower/snmp/CyberPower ... ${extraoptions} diff --git a/tests/hardware/pdu/cyberpower/snmp/outlets.robot b/tests/hardware/pdu/cyberpower/snmp/outlets.robot index 2f872bd1d4..83d88ee43c 100644 --- a/tests/hardware/pdu/cyberpower/snmp/outlets.robot +++ b/tests/hardware/pdu/cyberpower/snmp/outlets.robot @@ -18,7 +18,7 @@ outlets ${tc} ... ${CMD} ... --mode=outlets ... --hostname=${HOSTNAME} - ... --snmp-port=${SNMPPORT} + ... --snmp-port=${SNMP_PORT} ... --snmp-community=hardware/pdu/cyberpower/snmp/CyberPower ... ${extraoptions} diff --git a/tests/hardware/sensors/apc/snmp/hardware-sensors-apc-snmp.robot b/tests/hardware/sensors/apc/snmp/hardware-sensors-apc-snmp.robot index e35e7b09be..5b91e61579 100644 --- a/tests/hardware/sensors/apc/snmp/hardware-sensors-apc-snmp.robot +++ b/tests/hardware/sensors/apc/snmp/hardware-sensors-apc-snmp.robot @@ -7,7 +7,7 @@ Test Timeout 120s *** Variables *** -${CMD} ${CENTREON_PLUGINS} --plugin=hardware::sensors::apc::snmp::plugin --mode=sensors --hostname=${HOSTNAME} --snmp-version=${SNMPVERSION} --snmp-port=${SNMPPORT} +${CMD} ${CENTREON_PLUGINS} --plugin=hardware::sensors::apc::snmp::plugin --mode=sensors --hostname=${HOSTNAME} --snmp-version=${SNMP_VERSION} --snmp-port=${SNMP_PORT} *** Test Cases *** diff --git a/tests/hardware/ups/inmatics/sputnik/snmp/hardware-ups-sputnik-snmp.robot b/tests/hardware/ups/inmatics/sputnik/snmp/hardware-ups-sputnik-snmp.robot index 2109ce5374..7af771b072 100644 --- a/tests/hardware/ups/inmatics/sputnik/snmp/hardware-ups-sputnik-snmp.robot +++ b/tests/hardware/ups/inmatics/sputnik/snmp/hardware-ups-sputnik-snmp.robot @@ -17,8 +17,8 @@ Sputnik UPS - Environment ${tc}/9 ... ${CMD} ... --mode=environment ... --hostname=${HOSTNAME} - ... --snmp-version=${SNMPVERSION} - ... --snmp-port=${SNMPPORT} + ... --snmp-version=${SNMP_VERSION} + ... --snmp-port=${SNMP_PORT} ... --snmp-community=hardware/ups/inmatics/sputnik/snmp/hardware-ups-sputnik # Append options to command diff --git a/tests/hardware/ups/socomec/netvision/snmp/hardware-ups-socomec-netvision-snmp.robot b/tests/hardware/ups/socomec/netvision/snmp/hardware-ups-socomec-netvision-snmp.robot index 8b6d33156a..dc0983f36a 100644 --- a/tests/hardware/ups/socomec/netvision/snmp/hardware-ups-socomec-netvision-snmp.robot +++ b/tests/hardware/ups/socomec/netvision/snmp/hardware-ups-socomec-netvision-snmp.robot @@ -17,8 +17,8 @@ Battery ${tc}/4 ... ${CMD} ... --mode=battery ... --hostname=${HOSTNAME} - ... --snmp-version=${SNMPVERSION} - ... --snmp-port=${SNMPPORT} + ... --snmp-version=${SNMP_VERSION} + ... --snmp-port=${SNMP_PORT} ... --snmp-community=hardware/ups/socomec/netvision/snmp/battery # Append options to command diff --git a/tests/hardware/ups/standard/snmp/hardware-ups-standard-snmp.robot b/tests/hardware/ups/standard/snmp/hardware-ups-standard-snmp.robot index 90647bf964..ca04b85fb4 100644 --- a/tests/hardware/ups/standard/snmp/hardware-ups-standard-snmp.robot +++ b/tests/hardware/ups/standard/snmp/hardware-ups-standard-snmp.robot @@ -16,8 +16,8 @@ Hardware UPS Standard SNMP input lines ${tc} ... ${CMD} ... --mode=input-lines ... --hostname=${HOSTNAME} - ... --snmp-version=${SNMPVERSION} - ... --snmp-port=${SNMPPORT} + ... --snmp-version=${SNMP_VERSION} + ... --snmp-port=${SNMP_PORT} ... --snmp-community=${snmpcommunity} ... --warning-power=${warningpower} ... --critical-current=${criticalcurrent} diff --git a/tests/network/aruba/instant/snmp/aruba-instant-ap-usage.robot b/tests/network/aruba/instant/snmp/aruba-instant-ap-usage.robot index 80bb70e4dd..5d86e46924 100644 --- a/tests/network/aruba/instant/snmp/aruba-instant-ap-usage.robot +++ b/tests/network/aruba/instant/snmp/aruba-instant-ap-usage.robot @@ -7,7 +7,7 @@ Test Timeout 120s *** Variables *** -${CMD} ${CENTREON_PLUGINS} --plugin=network::aruba::instant::snmp::plugin --mode=ap-usage --hostname=${HOSTNAME} --snmp-version=${SNMPVERSION} --snmp-port=${SNMPPORT} +${CMD} ${CENTREON_PLUGINS} --plugin=network::aruba::instant::snmp::plugin --mode=ap-usage --hostname=${HOSTNAME} --snmp-version=${SNMP_VERSION} --snmp-port=${SNMP_PORT} *** Test Cases *** Test AP usage ${documentation} ${tc} diff --git a/tests/network/backbox/restapi/backup.robot b/tests/network/backbox/restapi/backup.robot index 0ae7ab5efb..d975f3ded2 100644 --- a/tests/network/backbox/restapi/backup.robot +++ b/tests/network/backbox/restapi/backup.robot @@ -15,8 +15,8 @@ ${cmd} ${CENTREON_PLUGINS} ... --plugin=network::backbox::restapi::plugin ... --custommode=api ... --hostname=${HOSTNAME} -... --port=${APIPORT} -... --proto=http +... --port=${API_PORT} +... --proto=${API_PROTOCOL} ... --api-token=token diff --git a/tests/network/backbox/restapi/configstatus.robot b/tests/network/backbox/restapi/configstatus.robot index 756ea45c8b..7d774abe6a 100644 --- a/tests/network/backbox/restapi/configstatus.robot +++ b/tests/network/backbox/restapi/configstatus.robot @@ -15,8 +15,8 @@ ${cmd} ${CENTREON_PLUGINS} ... --plugin=network::backbox::restapi::plugin ... --custommode=api ... --hostname=${HOSTNAME} -... --port=${APIPORT} -... --proto=http +... --port=${API_PORT} +... --proto=${API_PROTOCOL} ... --api-token=token ... --mode=configstatus diff --git a/tests/network/backbox/restapi/intellicheck.robot b/tests/network/backbox/restapi/intellicheck.robot index c441e039ba..ee370fdc09 100644 --- a/tests/network/backbox/restapi/intellicheck.robot +++ b/tests/network/backbox/restapi/intellicheck.robot @@ -15,8 +15,8 @@ ${cmd} ${CENTREON_PLUGINS} ... --plugin=network::backbox::restapi::plugin ... --custommode=api ... --hostname=${HOSTNAME} -... --port=${APIPORT} -... --proto=http +... --port=${API_PORT} +... --proto=${API_PROTOCOL} ... --api-token=token ... --mode=intellicheck diff --git a/tests/network/cisco/meraki/cloudcontroller/restapi/vpntunnels.robot b/tests/network/cisco/meraki/cloudcontroller/restapi/vpntunnels.robot index 2940efea50..14a0443757 100644 --- a/tests/network/cisco/meraki/cloudcontroller/restapi/vpntunnels.robot +++ b/tests/network/cisco/meraki/cloudcontroller/restapi/vpntunnels.robot @@ -19,7 +19,7 @@ ${CMD} ${CENTREON_PLUGINS} --plugin=network::cisco::meraki::cloudco Create cache from API [Tags] meraki api vpn network cache ${output} Run - ... ${CMD} --mode=cache --proto=http --port=${APIPORT} --hostname=${HOSTNAME} + ... ${CMD} --mode=cache --proto=${API_PROTOCOL} --port=${API_PORT} --hostname=${HOSTNAME} ${output} Strip String ${output} Should Be Equal As Strings diff --git a/tests/network/citrix/netscaler/snmp/mode/components/netscaler-health.robot b/tests/network/citrix/netscaler/snmp/mode/components/netscaler-health.robot index d9976e006c..9709d4974d 100644 --- a/tests/network/citrix/netscaler/snmp/mode/components/netscaler-health.robot +++ b/tests/network/citrix/netscaler/snmp/mode/components/netscaler-health.robot @@ -18,7 +18,7 @@ check psu components ${tc}/2 ... ${CMD} ... --mode=health ... --hostname=${HOSTNAME} - ... --snmp-port=${SNMPPORT} + ... --snmp-port=${SNMP_PORT} ... --snmp-community='network/citrix/netscaler/snmp/mode/components/${community}' ... --component=psu ... --alternative-status-mapping='${alternative_status_mapping}' diff --git a/tests/network/fortinet/fortigate/snmp/link-monitor.robot b/tests/network/fortinet/fortigate/snmp/link-monitor.robot index 854474e2ff..616e451829 100644 --- a/tests/network/fortinet/fortigate/snmp/link-monitor.robot +++ b/tests/network/fortinet/fortigate/snmp/link-monitor.robot @@ -17,8 +17,8 @@ Network Fortinet Fortigate SNMP link monitor ${tc} ... ${CMD} ... --mode=link-monitor ... --hostname=${HOSTNAME} - ... --snmp-version=${SNMPVERSION} - ... --snmp-port=${SNMPPORT} + ... --snmp-version=${SNMP_VERSION} + ... --snmp-port=${SNMP_PORT} ... --snmp-community=network/fortinet/fortigate/snmp/linkmonitor ... --filter-id=${filterid} ... --filter-name=${filtername} diff --git a/tests/network/fortinet/fortigate/snmp/list-link-monitor.robot b/tests/network/fortinet/fortigate/snmp/list-link-monitor.robot index 53ddfd3618..5cc45ec3f7 100644 --- a/tests/network/fortinet/fortigate/snmp/list-link-monitor.robot +++ b/tests/network/fortinet/fortigate/snmp/list-link-monitor.robot @@ -17,8 +17,8 @@ Network Fortinet Fortigate SNMP list link monitor ${tc} ... ${CMD} ... --mode=list-link-monitors ... --hostname=${HOSTNAME} - ... --snmp-version=${SNMPVERSION} - ... --snmp-port=${SNMPPORT} + ... --snmp-version=${SNMP_VERSION} + ... --snmp-port=${SNMP_PORT} ... --snmp-community=network/fortinet/fortigate/snmp/linkmonitor ... --filter-state=${filterstate} ... --filter-name=${filtername} diff --git a/tests/network/stormshield/snmp/hardware.robot b/tests/network/stormshield/snmp/hardware.robot index 93ded48bea..6f7eed74f3 100644 --- a/tests/network/stormshield/snmp/hardware.robot +++ b/tests/network/stormshield/snmp/hardware.robot @@ -17,8 +17,8 @@ hardware ${tc} ... ${CMD} ... --mode=hardware ... --hostname=${HOSTNAME} - ... --snmp-version=${SNMPVERSION} - ... --snmp-port=${SNMPPORT} + ... --snmp-version=${SNMP_VERSION} + ... --snmp-port=${SNMP_PORT} ... --snmp-community=network/stormshield/snmp/stormshield-fake ... --snmp-timeout=1 ... ${extra_options} diff --git a/tests/os/linux/snmp/arp.robot b/tests/os/linux/snmp/arp.robot index 5edbcb9f97..7de255476c 100644 --- a/tests/os/linux/snmp/arp.robot +++ b/tests/os/linux/snmp/arp.robot @@ -17,8 +17,8 @@ arp ${tc} ... ${CMD} ... --mode=arp ... --hostname=${HOSTNAME} - ... --snmp-version=${SNMPVERSION} - ... --snmp-port=${SNMPPORT} + ... --snmp-version=${SNMP_VERSION} + ... --snmp-port=${SNMP_PORT} ... --snmp-community=os/linux/snmp/network-interfaces ... --snmp-timeout=1 ... ${extra_options} diff --git a/tests/os/linux/snmp/cpu-detailed.robot b/tests/os/linux/snmp/cpu-detailed.robot index 48de1b626f..9e1a798232 100644 --- a/tests/os/linux/snmp/cpu-detailed.robot +++ b/tests/os/linux/snmp/cpu-detailed.robot @@ -17,8 +17,8 @@ cpu-detailed ${tc} ... ${CMD} ... --mode=cpu-detailed ... --hostname=${HOSTNAME} - ... --snmp-version=${SNMPVERSION} - ... --snmp-port=${SNMPPORT} + ... --snmp-version=${SNMP_VERSION} + ... --snmp-port=${SNMP_PORT} ... --snmp-community=os/linux/snmp/linux ... --snmp-timeout=1 ... ${extra_options} diff --git a/tests/os/linux/snmp/cpu.robot b/tests/os/linux/snmp/cpu.robot index f07ef7ea90..3254d8c22d 100644 --- a/tests/os/linux/snmp/cpu.robot +++ b/tests/os/linux/snmp/cpu.robot @@ -17,8 +17,8 @@ cpu ${tc} ... ${CMD} ... --mode=cpu ... --hostname=${HOSTNAME} - ... --snmp-version=${SNMPVERSION} - ... --snmp-port=${SNMPPORT} + ... --snmp-version=${SNMP_VERSION} + ... --snmp-port=${SNMP_PORT} ... --snmp-community=os/linux/snmp/network-interfaces ... --snmp-timeout=1 ... ${extra_options} diff --git a/tests/os/linux/snmp/disk-usage.robot b/tests/os/linux/snmp/disk-usage.robot index ab28685ebf..f57f06a8d8 100644 --- a/tests/os/linux/snmp/disk-usage.robot +++ b/tests/os/linux/snmp/disk-usage.robot @@ -17,8 +17,8 @@ disk-usage ${tc} ... ${CMD} ... --mode=disk-usage ... --hostname=${HOSTNAME} - ... --snmp-version=${SNMPVERSION} - ... --snmp-port=${SNMPPORT} + ... --snmp-version=${SNMP_VERSION} + ... --snmp-port=${SNMP_PORT} ... --snmp-community=os/linux/snmp/linux ... --snmp-timeout=1 ... ${extra_options} diff --git a/tests/os/linux/snmp/diskio.robot b/tests/os/linux/snmp/diskio.robot index 7e61b4f00d..41d6956f46 100644 --- a/tests/os/linux/snmp/diskio.robot +++ b/tests/os/linux/snmp/diskio.robot @@ -17,8 +17,8 @@ diskio ${tc} ... ${CMD} ... --mode=diskio ... --hostname=${HOSTNAME} - ... --snmp-version=${SNMPVERSION} - ... --snmp-port=${SNMPPORT} + ... --snmp-version=${SNMP_VERSION} + ... --snmp-port=${SNMP_PORT} ... --snmp-community=os/linux/snmp/linux ... --snmp-timeout=1 ... ${extra_options} diff --git a/tests/os/linux/snmp/inodes.robot b/tests/os/linux/snmp/inodes.robot index 0ed7d6ac10..94ca3ea355 100644 --- a/tests/os/linux/snmp/inodes.robot +++ b/tests/os/linux/snmp/inodes.robot @@ -17,8 +17,8 @@ inodes ${tc} ... ${CMD} ... --mode=inodes ... --hostname=${HOSTNAME} - ... --snmp-version=${SNMPVERSION} - ... --snmp-port=${SNMPPORT} + ... --snmp-version=${SNMP_VERSION} + ... --snmp-port=${SNMP_PORT} ... --snmp-community=os/linux/snmp/linux ... --snmp-timeout=1 ... ${extra_options} diff --git a/tests/os/linux/snmp/list-diskio.robot b/tests/os/linux/snmp/list-diskio.robot index b2e9bfc8c7..ad967306a3 100644 --- a/tests/os/linux/snmp/list-diskio.robot +++ b/tests/os/linux/snmp/list-diskio.robot @@ -18,8 +18,8 @@ List diskio ${tc} ... ${CMD} ... --mode=list-diskio ... --hostname=${HOSTNAME} - ... --snmp-version=${SNMPVERSION} - ... --snmp-port=${SNMPPORT} + ... --snmp-version=${SNMP_VERSION} + ... --snmp-port=${SNMP_PORT} ... --disco-show ... --snmp-community=${snmpcommunity} ${output} Run ${command} diff --git a/tests/os/linux/snmp/list-diskspath.robot b/tests/os/linux/snmp/list-diskspath.robot index 995f987089..8f2a715fe8 100644 --- a/tests/os/linux/snmp/list-diskspath.robot +++ b/tests/os/linux/snmp/list-diskspath.robot @@ -17,8 +17,8 @@ list-diskspath ${tc} ... ${CMD} ... --mode=list-diskspath ... --hostname=${HOSTNAME} - ... --snmp-version=${SNMPVERSION} - ... --snmp-port=${SNMPPORT} + ... --snmp-version=${SNMP_VERSION} + ... --snmp-port=${SNMP_PORT} ... --snmp-community=os/linux/snmp/linux ... --snmp-timeout=1 ... ${extra_options} diff --git a/tests/os/linux/snmp/list-interfaces.robot b/tests/os/linux/snmp/list-interfaces.robot index 8ddcc11948..046a46a964 100644 --- a/tests/os/linux/snmp/list-interfaces.robot +++ b/tests/os/linux/snmp/list-interfaces.robot @@ -17,8 +17,8 @@ list-interfaces ${tc} ... ${CMD} ... --mode=list-interfaces ... --hostname=${HOSTNAME} - ... --snmp-version=${SNMPVERSION} - ... --snmp-port=${SNMPPORT} + ... --snmp-version=${SNMP_VERSION} + ... --snmp-port=${SNMP_PORT} ... --snmp-community=os/linux/snmp/linux ... --snmp-timeout=1 ... ${extra_options} diff --git a/tests/os/linux/snmp/list-processes.robot b/tests/os/linux/snmp/list-processes.robot index 8dcc9e2773..68d5e540c4 100644 --- a/tests/os/linux/snmp/list-processes.robot +++ b/tests/os/linux/snmp/list-processes.robot @@ -17,8 +17,8 @@ list-processes ${tc} ... ${CMD} ... --mode=list-processes ... --hostname=${HOSTNAME} - ... --snmp-version=${SNMPVERSION} - ... --snmp-port=${SNMPPORT} + ... --snmp-version=${SNMP_VERSION} + ... --snmp-port=${SNMP_PORT} ... --snmp-community=os/linux/snmp/linux ... --snmp-timeout=1 ... ${extra_options} diff --git a/tests/os/linux/snmp/list-storages.robot b/tests/os/linux/snmp/list-storages.robot index c8610f87c4..d6b7e098dd 100644 --- a/tests/os/linux/snmp/list-storages.robot +++ b/tests/os/linux/snmp/list-storages.robot @@ -17,8 +17,8 @@ list-storages ${tc} ... ${CMD} ... --mode=list-storages ... --hostname=${HOSTNAME} - ... --snmp-version=${SNMPVERSION} - ... --snmp-port=${SNMPPORT} + ... --snmp-version=${SNMP_VERSION} + ... --snmp-port=${SNMP_PORT} ... --snmp-community=os/linux/snmp/linux ... --snmp-timeout=1 ... ${extra_options} diff --git a/tests/os/linux/snmp/load.robot b/tests/os/linux/snmp/load.robot index d5ff077cab..a90c085a9c 100644 --- a/tests/os/linux/snmp/load.robot +++ b/tests/os/linux/snmp/load.robot @@ -17,8 +17,8 @@ load ${tc} ... ${CMD} ... --mode=load ... --hostname=${HOSTNAME} - ... --snmp-version=${SNMPVERSION} - ... --snmp-port=${SNMPPORT} + ... --snmp-version=${SNMP_VERSION} + ... --snmp-port=${SNMP_PORT} ... --snmp-community=os/linux/snmp/linux ... --snmp-timeout=1 ... --critical=${critical} diff --git a/tests/os/linux/snmp/memory.robot b/tests/os/linux/snmp/memory.robot index 0131cf61c5..f07a7a9816 100644 --- a/tests/os/linux/snmp/memory.robot +++ b/tests/os/linux/snmp/memory.robot @@ -17,8 +17,8 @@ memory ${tc} ... ${CMD} ... --mode=memory ... --hostname=${HOSTNAME} - ... --snmp-version=${SNMPVERSION} - ... --snmp-port=${SNMPPORT} + ... --snmp-version=${SNMP_VERSION} + ... --snmp-port=${SNMP_PORT} ... --snmp-community=os/linux/snmp/linux ... --snmp-timeout=1 ... --snmp-version=${snmpver} diff --git a/tests/os/linux/snmp/network-interfaces.robot b/tests/os/linux/snmp/network-interfaces.robot index b9f3f4e469..263cd55138 100644 --- a/tests/os/linux/snmp/network-interfaces.robot +++ b/tests/os/linux/snmp/network-interfaces.robot @@ -11,7 +11,7 @@ ${CMD} ${CENTREON_PLUGINS} ... --plugin=os::linux::snmp::plugin ... --mode=interfaces ... --hostname=${HOSTNAME} -... --snmp-port=${SNMPPORT} +... --snmp-port=${SNMP_PORT} ... --snmp-community=os/linux/snmp/network-interfaces ... --statefile-dir=/dev/shm/ diff --git a/tests/os/linux/snmp/processcount.robot b/tests/os/linux/snmp/processcount.robot index 4a2f06f2ba..9589707065 100644 --- a/tests/os/linux/snmp/processcount.robot +++ b/tests/os/linux/snmp/processcount.robot @@ -17,8 +17,8 @@ processcount ${tc} ... ${CMD} ... --mode=processcount ... --hostname=${HOSTNAME} - ... --snmp-version=${SNMPVERSION} - ... --snmp-port=${SNMPPORT} + ... --snmp-version=${SNMP_VERSION} + ... --snmp-port=${SNMP_PORT} ... --snmp-community=os/linux/snmp/linux ... --snmp-timeout=1 ... ${extra_options} diff --git a/tests/os/linux/snmp/storage.robot b/tests/os/linux/snmp/storage.robot index ba195f11a0..961d0447eb 100644 --- a/tests/os/linux/snmp/storage.robot +++ b/tests/os/linux/snmp/storage.robot @@ -17,8 +17,8 @@ storage ${tc} ... ${CMD} ... --mode=storage ... --hostname=${HOSTNAME} - ... --snmp-version=${SNMPVERSION} - ... --snmp-port=${SNMPPORT} + ... --snmp-version=${SNMP_VERSION} + ... --snmp-port=${SNMP_PORT} ... --snmp-community=os/linux/snmp/linux ... --snmp-timeout=1 ... ${extra_options} diff --git a/tests/os/linux/snmp/swap.robot b/tests/os/linux/snmp/swap.robot index af3c5b5646..c87dc8a426 100644 --- a/tests/os/linux/snmp/swap.robot +++ b/tests/os/linux/snmp/swap.robot @@ -17,8 +17,8 @@ swap ${tc} ... ${CMD} ... --mode=swap ... --hostname=${HOSTNAME} - ... --snmp-version=${SNMPVERSION} - ... --snmp-port=${SNMPPORT} + ... --snmp-version=${SNMP_VERSION} + ... --snmp-port=${SNMP_PORT} ... --snmp-community=os/linux/snmp/swap ... --snmp-timeout=1 ... --no-swap=${no-swap} diff --git a/tests/os/linux/snmp/tcpcon.robot b/tests/os/linux/snmp/tcpcon.robot index f9f1f091a1..7b1c15436f 100644 --- a/tests/os/linux/snmp/tcpcon.robot +++ b/tests/os/linux/snmp/tcpcon.robot @@ -17,8 +17,8 @@ tcpcon ${tc} ... ${CMD} ... --mode=tcpcon ... --hostname=${HOSTNAME} - ... --snmp-version=${SNMPVERSION} - ... --snmp-port=${SNMPPORT} + ... --snmp-version=${SNMP_VERSION} + ... --snmp-port=${SNMP_PORT} ... --snmp-community=os/linux/snmp/linux ... --snmp-timeout=1 ... ${extra_options} diff --git a/tests/os/linux/snmp/time.robot b/tests/os/linux/snmp/time.robot index a507368ad0..59f991c8da 100644 --- a/tests/os/linux/snmp/time.robot +++ b/tests/os/linux/snmp/time.robot @@ -16,8 +16,8 @@ time ${tc} ... ${CMD} ... --mode=time ... --hostname=${HOSTNAME} - ... --snmp-version=${SNMPVERSION} - ... --snmp-port=${SNMPPORT} + ... --snmp-version=${SNMP_VERSION} + ... --snmp-port=${SNMP_PORT} ... --snmp-community=os/linux/snmp/linux ... --snmp-timeout=1 ... ${extra_options} diff --git a/tests/os/linux/snmp/udpcon.robot b/tests/os/linux/snmp/udpcon.robot index 37149ea7f5..d3425e1f0a 100644 --- a/tests/os/linux/snmp/udpcon.robot +++ b/tests/os/linux/snmp/udpcon.robot @@ -17,8 +17,8 @@ udpcon ${tc} ... ${CMD} ... --mode=udpcon ... --hostname=${HOSTNAME} - ... --snmp-version=${SNMPVERSION} - ... --snmp-port=${SNMPPORT} + ... --snmp-version=${SNMP_VERSION} + ... --snmp-port=${SNMP_PORT} ... --snmp-community=os/linux/snmp/linux ... --snmp-timeout=1 ... ${extra_options} diff --git a/tests/os/linux/snmp/uptime.robot b/tests/os/linux/snmp/uptime.robot index 453daae2c9..58cc5200a3 100644 --- a/tests/os/linux/snmp/uptime.robot +++ b/tests/os/linux/snmp/uptime.robot @@ -17,8 +17,8 @@ uptime ${tc} ... ${CMD} ... --mode=uptime ... --hostname=${HOSTNAME} - ... --snmp-version=${SNMPVERSION} - ... --snmp-port=${SNMPPORT} + ... --snmp-version=${SNMP_VERSION} + ... --snmp-port=${SNMP_PORT} ... --snmp-community=os/linux/snmp/linux ... --snmp-timeout=1 ... ${extra_options} diff --git a/tests/os/windows/snmp/services.robot b/tests/os/windows/snmp/services.robot index 4dcea9a658..73957460fd 100644 --- a/tests/os/windows/snmp/services.robot +++ b/tests/os/windows/snmp/services.robot @@ -11,7 +11,7 @@ ${CMD} ${CENTREON_PLUGINS} ... --plugin=os::windows::snmp::plugin ... --mode=service ... --hostname=${HOSTNAME} -... --snmp-port=${SNMPPORT} +... --snmp-port=${SNMP_PORT} *** Test Cases *** diff --git a/tests/resources/resources.resource b/tests/resources/resources.resource index aa5d4191b9..0fb16699bf 100644 --- a/tests/resources/resources.resource +++ b/tests/resources/resources.resource @@ -9,9 +9,10 @@ ${CENTREON_PLUGINS} perl ${CURDIR}${/}..${/}..${/}src${/}centreon_plugins.pl # 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 -${APIPORT} 3000 -${SNMPPORT} 2024 -${SNMPVERSION} 2c +${API_PROTOCOL} http +${API_PORT} 3000 +${SNMP_PORT} 2024 +${SNMP_VERSION} 2c ${PERCENT} % diff --git a/tests/storage/datacore/restapi/storage-datacore-restapi.robot b/tests/storage/datacore/restapi/storage-datacore-restapi.robot index 025b50824a..ba625e3010 100644 --- a/tests/storage/datacore/restapi/storage-datacore-restapi.robot +++ b/tests/storage/datacore/restapi/storage-datacore-restapi.robot @@ -11,7 +11,7 @@ Test Timeout 120s *** Variables *** ${MOCKOON_JSON} ${CURDIR}${/}storage-datacore-api.json -${CMD} ${CENTREON_PLUGINS} --plugin=storage::datacore::restapi::plugin --password=pass --username=user --port=${APIPORT} --hostname=${HOSTNAME} --proto=http +${CMD} ${CENTREON_PLUGINS} --plugin=storage::datacore::restapi::plugin --password=pass --username=user --port=${API_PORT} --hostname=${HOSTNAME} --proto=${API_PROTOCOL} *** Test Cases *** diff --git a/tests/storage/hp/primera/restapi/capacity.robot b/tests/storage/hp/primera/restapi/capacity.robot index 50d2f8c491..a769dea007 100644 --- a/tests/storage/hp/primera/restapi/capacity.robot +++ b/tests/storage/hp/primera/restapi/capacity.robot @@ -11,15 +11,15 @@ Test Timeout 120s *** Variables *** ${MOCKOON_JSON} ${CURDIR}${/}hpe-primera.mockoon.json ${HOSTNAME} 127.0.0.1 -${APIPORT} 3000 +${API_PORT} 3000 ${CMD} ${CENTREON_PLUGINS} ... --plugin=storage::hp::primera::restapi::plugin ... --mode=capacity ... --hostname=${HOSTNAME} ... --api-username=toto ... --api-password=toto -... --proto=http -... --port=${APIPORT} +... --proto=${API_PROTOCOL} +... --port=${API_PORT} ... --custommode=api ... --statefile-dir=/dev/shm/ diff --git a/tests/storage/hp/primera/restapi/diskstatus.robot b/tests/storage/hp/primera/restapi/diskstatus.robot index bfe4c02a59..944ce0ab32 100644 --- a/tests/storage/hp/primera/restapi/diskstatus.robot +++ b/tests/storage/hp/primera/restapi/diskstatus.robot @@ -11,15 +11,15 @@ Test Timeout 120s *** Variables *** ${MOCKOON_JSON} ${CURDIR}${/}hpe-primera.mockoon.json ${HOSTNAME} 127.0.0.1 -${APIPORT} 3000 +${API_PORT} 3000 ${CMD} ${CENTREON_PLUGINS} ... --plugin=storage::hp::primera::restapi::plugin ... --mode disk-status ... --hostname=${HOSTNAME} ... --api-username=toto ... --api-password=toto -... --proto=http -... --port=${APIPORT} +... --proto=${API_PROTOCOL} +... --port=${API_PORT} ... --custommode=api ... --statefile-dir=/dev/shm/ diff --git a/tests/storage/hp/primera/restapi/diskusage.robot b/tests/storage/hp/primera/restapi/diskusage.robot index f83af7f967..b1e1b282db 100644 --- a/tests/storage/hp/primera/restapi/diskusage.robot +++ b/tests/storage/hp/primera/restapi/diskusage.robot @@ -10,15 +10,15 @@ Test Timeout 120s *** Variables *** ${MOCKOON_JSON} ${CURDIR}${/}hpe-primera.mockoon.json ${HOSTNAME} 127.0.0.1 -${APIPORT} 3000 +${API_PORT} 3000 ${CMD} ${CENTREON_PLUGINS} ... --plugin=storage::hp::primera::restapi::plugin ... --mode=disk-usage ... --hostname=${HOSTNAME} ... --api-username=toto ... --api-password=toto -... --proto=http -... --port=${APIPORT} +... --proto=${API_PROTOCOL} +... --port=${API_PORT} ... --custommode=api ... --statefile-dir=/dev/shm/ diff --git a/tests/storage/hp/primera/restapi/licenses.robot b/tests/storage/hp/primera/restapi/licenses.robot index af638aacc0..ee48b663eb 100644 --- a/tests/storage/hp/primera/restapi/licenses.robot +++ b/tests/storage/hp/primera/restapi/licenses.robot @@ -10,15 +10,15 @@ Test Timeout 120s *** Variables *** ${MOCKOON_JSON} ${CURDIR}${/}hpe-primera.mockoon.json ${HOSTNAME} 127.0.0.1 -${APIPORT} 3000 +${API_PORT} 3000 ${CMD} ${CENTREON_PLUGINS} ... --plugin=storage::hp::primera::restapi::plugin ... --mode=licenses ... --hostname=${HOSTNAME} ... --api-username=toto ... --api-password=toto -... --proto=http -... --port=${APIPORT} +... --proto=${API_PROTOCOL} +... --port=${API_PORT} ... --custommode=api ... --statefile-dir=/dev/shm/ diff --git a/tests/storage/hp/primera/restapi/listdisks.robot b/tests/storage/hp/primera/restapi/listdisks.robot index 51b65c393e..764ba34108 100644 --- a/tests/storage/hp/primera/restapi/listdisks.robot +++ b/tests/storage/hp/primera/restapi/listdisks.robot @@ -11,15 +11,15 @@ Test Timeout 120s *** Variables *** ${MOCKOON_JSON} ${CURDIR}${/}hpe-primera.mockoon.json ${HOSTNAME} 127.0.0.1 -${APIPORT} 3000 +${API_PORT} 3000 ${CMD} ${CENTREON_PLUGINS} ... --plugin=storage::hp::primera::restapi::plugin ... --mode=list-disks ... --hostname=${HOSTNAME} ... --api-username=toto ... --api-password=toto -... --proto=http -... --port=${APIPORT} +... --proto=${API_PROTOCOL} +... --port=${API_PORT} ... --custommode=api ... --statefile-dir=/dev/shm/ ... diff --git a/tests/storage/hp/primera/restapi/listvolumes.robot b/tests/storage/hp/primera/restapi/listvolumes.robot index 9546fbe4dc..dadfa6098a 100644 --- a/tests/storage/hp/primera/restapi/listvolumes.robot +++ b/tests/storage/hp/primera/restapi/listvolumes.robot @@ -11,15 +11,15 @@ Test Timeout 120s *** Variables *** ${MOCKOON_JSON} ${CURDIR}${/}hpe-primera.mockoon.json ${HOSTNAME} 127.0.0.1 -${APIPORT} 3000 +${API_PORT} 3000 ${CMD} ${CENTREON_PLUGINS} ... --plugin=storage::hp::primera::restapi::plugin ... --mode=list-volumes ... --hostname=${HOSTNAME} ... --api-username=toto ... --api-password=toto -... --proto=http -... --port=${APIPORT} +... --proto=${API_PROTOCOL} +... --port=${API_PORT} ... --custommode=api ... --statefile-dir=/dev/shm/ ... diff --git a/tests/storage/hp/primera/restapi/nodes.robot b/tests/storage/hp/primera/restapi/nodes.robot index efad134c4c..870e069e3d 100644 --- a/tests/storage/hp/primera/restapi/nodes.robot +++ b/tests/storage/hp/primera/restapi/nodes.robot @@ -10,15 +10,15 @@ Test Timeout 120s *** Variables *** ${MOCKOON_JSON} ${CURDIR}${/}hpe-primera.mockoon.json ${HOSTNAME} 127.0.0.1 -${APIPORT} 3000 +${API_PORT} 3000 ${CMD} ${CENTREON_PLUGINS} ... --plugin=storage::hp::primera::restapi::plugin ... --mode=nodes ... --hostname=${HOSTNAME} ... --api-username=toto ... --api-password=toto -... --proto=http -... --port=${APIPORT} +... --proto=${API_PROTOCOL} +... --port=${API_PORT} ... --custommode=api ... --statefile-dir=/dev/shm/ diff --git a/tests/storage/hp/primera/restapi/volumeusage.robot b/tests/storage/hp/primera/restapi/volumeusage.robot index bf866dcd6f..03f38d6ea0 100644 --- a/tests/storage/hp/primera/restapi/volumeusage.robot +++ b/tests/storage/hp/primera/restapi/volumeusage.robot @@ -10,15 +10,15 @@ Test Timeout 120s *** Variables *** ${MOCKOON_JSON} ${CURDIR}${/}hpe-primera.mockoon.json ${HOSTNAME} 127.0.0.1 -${APIPORT} 3000 +${API_PORT} 3000 ${CMD} ${CENTREON_PLUGINS} ... --plugin=storage::hp::primera::restapi::plugin ... --mode=volume-usage ... --hostname=${HOSTNAME} ... --api-username=toto ... --api-password=toto -... --proto=http -... --port=${APIPORT} +... --proto=${API_PROTOCOL} +... --port=${API_PORT} ... --custommode=api ... --statefile-dir=/dev/shm/ diff --git a/tests/storage/synology/snmp/storage-synology-snmp.robot b/tests/storage/synology/snmp/storage-synology-snmp.robot index 40fa65f909..5a54e53aba 100644 --- a/tests/storage/synology/snmp/storage-synology-snmp.robot +++ b/tests/storage/synology/snmp/storage-synology-snmp.robot @@ -64,8 +64,8 @@ Components ... ${CMD} ... --mode=components ... --hostname=${HOSTNAME} - ... --snmp-version=${SNMPVERSION} - ... --snmp-port=${SNMPPORT} + ... --snmp-version=${SNMP_VERSION} + ... --snmp-port=${SNMP_PORT} ... --snmp-community=${check_components_test.snmpcommunity} Ctn Run Command And Check Result As Strings ${command} ${check_components_test.expected_output} @@ -78,8 +78,8 @@ Uptime ... ${CMD} ... --mode=uptime ... --hostname=${HOSTNAME} - ... --snmp-version=${SNMPVERSION} - ... --snmp-port=${SNMPPORT} + ... --snmp-version=${SNMP_VERSION} + ... --snmp-port=${SNMP_PORT} ... --snmp-community=${test_item.snmpcommunity} ... --warning-uptime=${test_item.warning} ... --critical-uptime=${test_item.critical} diff --git a/tests/storage/wd/nas/snmp/hardware.robot b/tests/storage/wd/nas/snmp/hardware.robot index 85e5c8fbbf..375d573632 100644 --- a/tests/storage/wd/nas/snmp/hardware.robot +++ b/tests/storage/wd/nas/snmp/hardware.robot @@ -16,8 +16,8 @@ Hardware${tc} ... ${CMD} ... --mode=hardware ... --hostname=${HOSTNAME} - ... --snmp-version=${SNMPVERSION} - ... --snmp-port=${SNMPPORT} + ... --snmp-version=${SNMP_VERSION} + ... --snmp-port=${SNMP_PORT} ... --snmp-community=storage/wd/nas/snmp/nas-wd ... ${extra_option} diff --git a/tests/storage/wd/nas/snmp/listvolumes.robot b/tests/storage/wd/nas/snmp/listvolumes.robot index 9dab15d8fc..ed107905c1 100644 --- a/tests/storage/wd/nas/snmp/listvolumes.robot +++ b/tests/storage/wd/nas/snmp/listvolumes.robot @@ -16,8 +16,8 @@ listvolumes${tc} ... ${CMD} ... --mode=list-volumes ... --hostname=${HOSTNAME} - ... --snmp-version=${SNMPVERSION} - ... --snmp-port=${SNMPPORT} + ... --snmp-version=${SNMP_VERSION} + ... --snmp-port=${SNMP_PORT} ... --snmp-community=storage/wd/nas/snmp/nas-wd ... ${extra_option} diff --git a/tests/storage/wd/nas/snmp/volumes.robot b/tests/storage/wd/nas/snmp/volumes.robot index e28a8bddff..4d165dce8d 100644 --- a/tests/storage/wd/nas/snmp/volumes.robot +++ b/tests/storage/wd/nas/snmp/volumes.robot @@ -16,8 +16,8 @@ Volumes${tc} ... ${CMD} ... --mode=volumes ... --hostname=${HOSTNAME} - ... --snmp-version=${SNMPVERSION} - ... --snmp-port=${SNMPPORT} + ... --snmp-version=${SNMP_VERSION} + ... --snmp-port=${SNMP_PORT} ... --snmp-community=storage/wd/nas/snmp/nas-wd ... ${extra_option} From 6a4220551f792142a242dad4f492a2df542408f3 Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Wed, 6 Nov 2024 09:27:06 +0100 Subject: [PATCH 2/2] save --- .github/scripts/process-plugins.py | 66 +++++++++++------------------- .github/workflows/plugins-test.yml | 31 +++++++++++--- .github/workflows/plugins.yml | 65 +++++++++++++++++++++++++---- 3 files changed, 107 insertions(+), 55 deletions(-) diff --git a/.github/scripts/process-plugins.py b/.github/scripts/process-plugins.py index 336ccd4353..27f9645d46 100644 --- a/.github/scripts/process-plugins.py +++ b/.github/scripts/process-plugins.py @@ -1,60 +1,42 @@ #!/usr/bin/env python3 -from sys import argv import re import os import json +from sys import argv common = argv[1] == 'true' -with open('package_directories.txt') as f: - line_packages = f.readline().strip('\n') -n = len(line_packages) -a = line_packages[1:n-1] -input_packages = a.split(',') -packages = set() -for package in input_packages: - packages.add(package.strip('"/').removeprefix('src/')) - -with open('plugins.txt') as f: - line_plugins = f.readline().strip('\n') -n = len(line_plugins) -a = line_plugins[1:n-1] -input_plugins = a.split(',') -plugins = set() -for plugin in input_plugins: - plugins.add(plugin.strip('"/').removeprefix('src/')) +def read_file(file_path): + with open(file_path) as f: + return f.readline().strip('\n')[1:-1].split(',') -list_plugins = set() -list_packages = set() +def process_items(items): + return {item.strip('"/').removeprefix('src/') for item in items} + +packages = process_items(read_file('package_directories.txt')) +plugins = process_items(read_file('plugins.txt')) +list_plugins = set() for plugin in plugins: list_plugins.add(plugin) - try: - found = re.search('(.*)\/(?:plugin\.pm|(?:lib|mode|custom)\/.+)', plugin).group(1) - list_plugins.add(found) - except AttributeError: - pass + match = re.search(r'(.*)/(?:plugin\.pm|(?:lib|mode|custom)/.+)', plugin) + if match: + list_plugins.add(match.group(1)) -for filepath in os.popen('find packaging -type f -name pkg.json').read().split('\n')[0:-1]: - packaging_file = open(filepath) - packaging = json.load(packaging_file) - packaging_file.close() - packaging_path = re.search('.*\/(centreon-plugin-.*)\/pkg.json', filepath).group(1) - - if not packaging_path == packaging["pkg_name"]: - packaging_path = packaging["pkg_name"] - - directory_path = re.search('^(.+)\/pkg.json', filepath).group(1) - - if common: - list_packages.add(packaging_path) - elif directory_path in packages: +list_packages = set() +for filepath in os.popen('find packaging -type f -name pkg.json').read().splitlines(): + with open(filepath) as packaging_file: + packaging = json.load(packaging_file) + packaging_path = re.search(r'.*/(centreon-plugin-.*)/pkg.json', filepath).group(1) + packaging_path = packaging_path if packaging_path == packaging["pkg_name"] else packaging["pkg_name"] + directory_path = re.search(r'^(.+)/pkg.json', filepath).group(1) + + if common or directory_path in packages: list_packages.add(packaging_path) else: for pkg_file in packaging["files"]: - pkg_file_dir = pkg_file.strip('/').removeprefix('src/') - if pkg_file_dir in list_plugins: + if pkg_file.strip('/').removeprefix('src/') in list_plugins: list_packages.add(packaging_path) -print(*list_packages) +print(*list_packages) \ No newline at end of file diff --git a/.github/workflows/plugins-test.yml b/.github/workflows/plugins-test.yml index af7b36988f..f64c619074 100644 --- a/.github/workflows/plugins-test.yml +++ b/.github/workflows/plugins-test.yml @@ -24,6 +24,7 @@ on: - '.github/packaging/centreon-plugin.yaml.template' - 'src/**' - 'packaging/**' + - 'tests/**' jobs: get-environment-tests: @@ -64,20 +65,38 @@ jobs: - name: Transform plugins to directories run: | folders=() - for f in ${{ steps.filter.outputs.packages_files }}; do - echo "Adding $(dirname $f) to folders" - folders+=($(dirname $f)) + for package_folder in ${{ steps.filter.outputs.packages_files }}; do + echo "Adding $(dirname $package_folder) to folders" + folders+=($(dirname $package_folder)) done unique_folders=($(printf "%s\n" "${folders[@]}" | sort -u | tr '\n' ' ')) jq --compact-output --null-input '$ARGS.positional' --args -- ${unique_folders[@]} > package_directories.txt + + echo "PACKAGES: $( plugins.txt + + echo "PLUGINS: $( tests_directories.txt + + echo "ROBOT_TESTS: $( package_directories.txt files=() - for f in ${{ steps.filter.outputs.plugins_files }}; do - echo "Adding $f to files" - files+=($f) + for plugin_file in ${{ steps.filter.outputs.plugins_files }}; do + echo "Adding $plugin_file to files" + files+=($plugin_file) done unique_files=($(printf "%s\n" "${files[@]}" | sort -u | tr '\n' ' ')) jq --compact-output --null-input '$ARGS.positional' --args -- ${unique_files[@]} > plugins.txt + + tests_folders=() + for test_file in ${{ steps.filter.outputs.robot_tests_files }}; do + test_folder=$(dirname $test_file) + if [[ ! $unique_files =~ ${test_folder/tests/src} ]]; then + echo "Adding $test_folder to tests_folders" + tests_folders+=($test_folder) + fi + done + unique_tests_folders=($(printf "%s\n" "${tests_folders[@]}" | sort -u | tr '\n' ' ')) + jq --compact-output --null-input '$ARGS.positional' --args -- ${unique_tests_folders[@]} > tests_directories.txt shell: bash - name: Get plugins for build @@ -84,7 +102,39 @@ jobs: if [ "$PLUGINS" == '' ]; then echo "::notice::There are no modifications to the plugins packages" fi + shell: bash + - name: List tests not related to a new or updated plugin + id: list_tests + run: | + # Get the unique directories of the robot tests + robot_tests_folders=() + for robot_test_file in ${{ steps.filter.outputs.robot_tests_files }}; do + robot_tests_folders+=($(dirname $robot_test_file)) + done + unique_robot_tests_folders=($(printf "%s\n" "${robot_tests_folders[@]}" | sort -u)) + robot_tests_folders=("${unique_robot_tests_folders[@]}") + + packages=$(> $GITHUB_OUTPUT shell: bash unit-tests: @@ -334,6 +384,7 @@ jobs: cache-key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }} package-extension: ${{ matrix.package_extension }} plugin-list: ${{ needs.get-plugins.outputs.plugins }} + tests-list: ${{ needs.get-plugins.outputs.robot_tests }} - name: Upload apt/dnf logs as artifacts if tests failed if: failure()