[MON-22331] [Plugins] Mode sql-string not working anymore (#4746)
This commit is contained in:
parent
1fa45a6c69
commit
c5e5701321
|
@ -141,7 +141,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
if: ${{ matrix.distrib == 'el7' }}
|
if: ${{ matrix.distrib == 'el7' }}
|
||||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
uses: actions/checkout@v3 # el7 is not compatible with checkout v4 which uses node20
|
||||||
|
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
if: ${{ matrix.distrib != 'el7' }}
|
if: ${{ matrix.distrib != 'el7' }}
|
||||||
|
|
|
@ -48,6 +48,11 @@ jobs:
|
||||||
Net::SNMP
|
Net::SNMP
|
||||||
URI::Encode
|
URI::Encode
|
||||||
XML::LibXML
|
XML::LibXML
|
||||||
|
DBI
|
||||||
|
DBD::mysql
|
||||||
|
POSIX
|
||||||
|
Time::HiRes
|
||||||
|
JSON::XS
|
||||||
|
|
||||||
- name: Install Python
|
- name: Install Python
|
||||||
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
|
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
|
||||||
|
@ -71,3 +76,6 @@ jobs:
|
||||||
sudo cp -r tests/resources/snmp/* /usr/snmpsim/data/
|
sudo cp -r tests/resources/snmp/* /usr/snmpsim/data/
|
||||||
snmpsimd --agent-udpv4-endpoint=127.0.0.1:2024 --process-user=snmp --process-group=snmp &
|
snmpsimd --agent-udpv4-endpoint=127.0.0.1:2024 --process-user=snmp --process-group=snmp &
|
||||||
robot tests/functional/snmp
|
robot tests/functional/snmp
|
||||||
|
|
||||||
|
- name: Run Robot Framework Database tests
|
||||||
|
run: robot tests/functional/database
|
||||||
|
|
|
@ -96,12 +96,13 @@ sub check_options {
|
||||||
$self->{printf_value} = 'value_field';
|
$self->{printf_value} = 'value_field';
|
||||||
if (defined($self->{option_results}->{printf_value}) && $self->{option_results}->{printf_value} ne '') {
|
if (defined($self->{option_results}->{printf_value}) && $self->{option_results}->{printf_value} ne '') {
|
||||||
$self->{printf_value} = $1
|
$self->{printf_value} = $1
|
||||||
if ($self->{option_results}->{printf_value} =~ /\$self->{result_values}->{(value_field|key_field)}/);
|
if ($self->{option_results}->{printf_value} =~ /\$self->\{result_values}->\{(value_field|key_field)}/);
|
||||||
$self->{printf_value} = $1
|
$self->{printf_value} = $1
|
||||||
if ($self->{option_results}->{printf_value} =~ /\%{(value_field|key_field)}/);
|
if ($self->{option_results}->{printf_value} =~ /\%\{(value_field|key_field)}/);
|
||||||
$self->{printf_value} = $1
|
$self->{printf_value} = $1
|
||||||
if ($self->{option_results}->{printf_value} =~ /\%\((value_field|key_field)\)/);
|
if ($self->{option_results}->{printf_value} =~ /\%\((value_field|key_field)\)/);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub manage_selection {
|
sub manage_selection {
|
||||||
|
@ -170,8 +171,8 @@ Specify a custom output message relying on printf formatting. If this option is
|
||||||
|
|
||||||
=item B<--printf-value>
|
=item B<--printf-value>
|
||||||
|
|
||||||
Specify scalar used to replace in printf. If this option is set --printf-format is mandatory.
|
Specify variable used to replace in printf. If this option is set --printf-format is mandatory.
|
||||||
(can be: %{key_field}, %{value_field})
|
Can be: %{key_field} (default value) or %{value_field}
|
||||||
|
|
||||||
=item B<--warning-string>
|
=item B<--warning-string>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
*** Settings ***
|
||||||
|
Documentation Database Mysql plugin
|
||||||
|
|
||||||
|
Library OperatingSystem
|
||||||
|
Library Process
|
||||||
|
Library String
|
||||||
|
|
||||||
|
Test Timeout 120s
|
||||||
|
|
||||||
|
|
||||||
|
*** Variables ***
|
||||||
|
${CENTREON_PLUGINS} ${CURDIR}${/}..${/}..${/}..${/}src${/}centreon_plugins.pl
|
||||||
|
|
||||||
|
${CMD} perl ${CENTREON_PLUGINS} --plugin=database::mysql::plugin
|
||||||
|
|
||||||
|
&{sql_string_test1}
|
||||||
|
... result=UNKNOWN: Need to specify data_source arguments.
|
||||||
|
@{sql_string_tests}
|
||||||
|
... &{sql_string_test1}
|
||||||
|
|
||||||
|
|
||||||
|
*** Test Cases ***
|
||||||
|
Database Mysql sql string mode
|
||||||
|
[Documentation] Mode sql string (common protocol database)
|
||||||
|
[Tags] database mysql sql-string
|
||||||
|
FOR ${sql_string_test} IN @{sql_string_tests}
|
||||||
|
${command} Catenate
|
||||||
|
... ${CMD}
|
||||||
|
... --mode=sql-string
|
||||||
|
${output} Run ${command}
|
||||||
|
${output} Strip String ${output}
|
||||||
|
Should Be Equal As Strings
|
||||||
|
... ${output}
|
||||||
|
... ${sql_string_test.result}
|
||||||
|
... Wrong output result for compliance of ${sql_string_test.result}{\n}Command output:{\n}${output}{\n}{\n}{\n}
|
||||||
|
END
|
Loading…
Reference in New Issue