tests(plugins): Run all tests on arm64 architecture (#5049)

Co-authored-by: Sophie Depassio <sdepassio@centreon.com>
This commit is contained in:
Evan-Adam 2024-08-07 10:00:14 +02:00 committed by GitHub
parent f7deeba3c5
commit 5fd1df4c39
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 41 additions and 33 deletions

View File

@ -248,8 +248,9 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
distrib: [el8, el9, jammy, bullseye, bookworm] image: [testing-plugins-alma8, testing-plugins-alma9, testing-plugins-jammy, testing-plugins-bullseye, testing-plugins-bookworm]
include: include:
- runner_name: ubuntu-22.04
- package_extension: rpm - package_extension: rpm
image: testing-plugins-alma8 image: testing-plugins-alma8
distrib: el8 distrib: el8
@ -265,8 +266,13 @@ jobs:
- package_extension: deb - package_extension: deb
image: testing-plugins-jammy image: testing-plugins-jammy
distrib: jammy distrib: jammy
- package_extension: deb
image: testing-plugins-bullseye-arm64
distrib: bullseye
arch: arm64
runner_name: ["self-hosted", "collect-arm64"]
runs-on: ubuntu-22.04 runs-on: ${{ matrix.runner_name }}
container: container:
image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }} image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}
credentials: credentials:

View File

@ -26,11 +26,11 @@ use DBI;
use Digest::MD5 qw(md5_hex); use Digest::MD5 qw(md5_hex);
use POSIX qw(:signal_h); use POSIX qw(:signal_h);
my %handlers = ( ALRM => {} ); my %handlers = (ALRM => {});
sub new { sub new {
my ($class, %options) = @_; my ($class, %options) = @_;
my $self = {}; my $self = {};
bless $self, $class; bless $self, $class;
# $options{options} = options object # $options{options} = options object
# $options{output} = output object # $options{output} = output object
@ -60,16 +60,16 @@ sub new {
} }
$options{options}->add_help(package => __PACKAGE__, sections => 'DBI OPTIONS', once => 1); $options{options}->add_help(package => __PACKAGE__, sections => 'DBI OPTIONS', once => 1);
$self->{output} = $options{output}; $self->{output} = $options{output};
$self->{sqlmode_name} = $options{sqlmode_name}; $self->{sqlmode_name} = $options{sqlmode_name};
$self->{instance} = undef; $self->{instance} = undef;
$self->{statement_handle} = undef; $self->{statement_handle} = undef;
$self->{version} = undef; $self->{version} = undef;
$self->{data_source} = undef; $self->{data_source} = undef;
$self->{username} = undef; $self->{username} = undef;
$self->{password} = undef; $self->{password} = undef;
$self->{connect_options} = undef; $self->{connect_options} = undef;
$self->{connect_options_hash} = {}; $self->{connect_options_hash} = {};
# Sometimes, we need to set ENV # Sometimes, we need to set ENV
@ -87,7 +87,7 @@ sub prepare_destroy {
sub set_signal_handlers { sub set_signal_handlers {
my $self = shift; my $self = shift;
$SIG{ALRM} = \&class_handle_ALRM; $SIG{ALRM} = \&class_handle_ALRM;
$handlers{ALRM}->{$self} = sub { $self->handle_ALRM() }; $handlers{ALRM}->{$self} = sub { $self->handle_ALRM() };
} }
@ -103,7 +103,7 @@ sub handle_ALRM {
$self->prepare_destroy(); $self->prepare_destroy();
$self->disconnect(); $self->disconnect();
$self->{output}->output_add( $self->{output}->output_add(
severity => $self->{sql_errors_exit}, severity => $self->{sql_errors_exit},
short_msg => 'Timeout' short_msg => 'Timeout'
); );
$self->{output}->display(); $self->{output}->display();
@ -136,7 +136,7 @@ sub check_options {
my ($self, %options) = @_; my ($self, %options) = @_;
$self->{data_source} = (defined($self->{option_results}->{data_source})) ? shift(@{$self->{option_results}->{data_source}}) : undef; $self->{data_source} = (defined($self->{option_results}->{data_source})) ? shift(@{$self->{option_results}->{data_source}}) : undef;
$self->{username} = undef; $self->{username} = undef;
if (defined($self->{option_results}->{username})) { if (defined($self->{option_results}->{username})) {
$self->{username} = ref($self->{option_results}->{username}) eq 'ARRAY' ? shift(@{$self->{option_results}->{username}}) : $self->{option_results}->{username}; $self->{username} = ref($self->{option_results}->{username}) eq 'ARRAY' ? shift(@{$self->{option_results}->{username}}) : $self->{option_results}->{username};
} }
@ -146,8 +146,8 @@ sub check_options {
} }
$self->{connect_options} = (defined($self->{option_results}->{connect_options})) ? shift(@{$self->{option_results}->{connect_options}}) : undef; $self->{connect_options} = (defined($self->{option_results}->{connect_options})) ? shift(@{$self->{option_results}->{connect_options}}) : undef;
$self->{connect_query} = (defined($self->{option_results}->{connect_query})) ? shift(@{$self->{option_results}->{connect_query}}) : undef; $self->{connect_query} = (defined($self->{option_results}->{connect_query})) ? shift(@{$self->{option_results}->{connect_query}}) : undef;
$self->{env} = (defined($self->{option_results}->{env})) ? shift(@{$self->{option_results}->{env}}) : undef; $self->{env} = (defined($self->{option_results}->{env})) ? shift(@{$self->{option_results}->{env}}) : undef;
$self->{sql_errors_exit} = $self->{option_results}->{sql_errors_exit}; $self->{sql_errors_exit} = $self->{option_results}->{sql_errors_exit};
$self->{timeout} = 10; $self->{timeout} = 10;
@ -194,8 +194,8 @@ sub is_version_minimum {
# $options{version} = string version to check # $options{version} = string version to check
my @version_src = split /\./, $self->{version}; my @version_src = split /\./, $self->{version};
my @versions = split /\./, $options{version}; my @versions = split /\./, $options{version};
for (my $i = 0; $i < scalar(@versions); $i++) { for (my $i = 0; $i < scalar(@versions); $i++) {
return 1 if ($versions[$i] eq 'x'); return 1 if ($versions[$i] eq 'x');
return 1 if (!defined($version_src[$i])); return 1 if (!defined($version_src[$i]));
$version_src[$i] =~ /^([0-9]*)/; $version_src[$i] =~ /^([0-9]*)/;
@ -225,7 +225,7 @@ sub disconnect {
sub connect { sub connect {
my ($self, %options) = @_; my ($self, %options) = @_;
my $dontquit = (defined($options{dontquit}) && $options{dontquit} == 1) ? 1 : 0; my $dontquit = (defined($options{dontquit}) && $options{dontquit} == 1) ? 1 : 0;
return if (defined($self->{instance})); return if (defined($self->{instance}));
@ -241,7 +241,7 @@ sub connect {
eval { eval {
alarm($self->{timeout}) if (defined($self->{timeout})); alarm($self->{timeout}) if (defined($self->{timeout}));
$self->{instance} = DBI->connect( $self->{instance} = DBI->connect(
"DBI:". $self->{data_source}, "DBI:" . $self->{data_source},
$self->{username}, $self->{username},
$self->{password}, $self->{password},
{ RaiseError => 0, PrintError => 0, AutoCommit => 1, %{$self->{connect_options_hash}} } { RaiseError => 0, PrintError => 0, AutoCommit => 1, %{$self->{connect_options_hash}} }
@ -258,7 +258,7 @@ sub connect {
my $err_msg = sprintf( my $err_msg = sprintf(
'Cannot connect: %s', 'Cannot connect: %s',
defined($DBI::errstr) ? $DBI::errstr : defined($DBI::errstr) ? $DBI::errstr :
(defined($connect_error) ? $connect_error : '(no error string)') (defined($connect_error) ? $connect_error : '(no error string)')
); );
if ($dontquit == 0) { if ($dontquit == 0) {
$self->{output}->add_option_msg(short_msg => $err_msg); $self->{output}->add_option_msg(short_msg => $err_msg);
@ -306,7 +306,7 @@ sub fetchrow_hashref {
sub query { sub query {
my ($self, %options) = @_; my ($self, %options) = @_;
my $continue_error = defined($options{continue_error}) && $options{continue_error} == 1 ? 1 : 0; my $continue_error = defined($options{continue_error}) && $options{continue_error} == 1 ? 1 : 0;
$self->{statement_handle} = $self->{instance}->prepare($options{query}); $self->{statement_handle} = $self->{instance}->prepare($options{query});
if (!defined($self->{statement_handle})) { if (!defined($self->{statement_handle})) {
@ -318,7 +318,7 @@ sub query {
my $rv; my $rv;
if (defined($self->{exec_timeout})) { if (defined($self->{exec_timeout})) {
my $mask = POSIX::SigSet->new(SIGALRM); my $mask = POSIX::SigSet->new(SIGALRM);
my $action = POSIX::SigAction->new( my $action = POSIX::SigAction->new(
sub { $self->handle_ALRM() }, sub { $self->handle_ALRM() },
$mask, $mask,
@ -357,7 +357,7 @@ DBI global
=head1 SYNOPSIS =head1 SYNOPSIS
dbi class DBI class
=head1 DBI OPTIONS =head1 DBI OPTIONS
@ -402,6 +402,6 @@ Timeout in seconds for query execution
=head1 DESCRIPTION =head1 DESCRIPTION
B<snmp>. B<DBI>.
=cut =cut

View File

@ -38,6 +38,7 @@
--oid-display --oid-display
--oid-extra-display --oid-extra-display
--oid-filter --oid-filter
--sql-errors-exit
--urlpath --urlpath
--use-ucd --use-ucd
--warning-bytesallocatedpercentage --warning-bytesallocatedpercentage
@ -100,6 +101,7 @@ api.meraki.com
cardtemperature cardtemperature
connections-dhcp connections-dhcp
connections-dns connections-dns
datasource
deltaps deltaps
df df
eth eth