From a10fb8848f4a5e445b2f5bcaf6e7fc48372e6768 Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Mon, 29 Jul 2024 10:26:48 +0200 Subject: [PATCH] reactivate installation test for all plugins --- .github/scripts/test-all-plugins.py | 14 +++++--------- src/centreon/plugins/mode.pm | 12 ++++++------ 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/.github/scripts/test-all-plugins.py b/.github/scripts/test-all-plugins.py index f19eaa725..caf27eb4f 100644 --- a/.github/scripts/test-all-plugins.py +++ b/.github/scripts/test-all-plugins.py @@ -67,7 +67,7 @@ def refresh_packet_manager(archi): return output_status def install_plugin(plugin, archi): - with open('/var/log/robot-plugins-installation-tests.log', "a") as outfile: + with open('/var/log/installation-' + plugin + '.log', "a") as outfile: if archi == "deb": outfile.write("apt-get install -o 'Binary::apt::APT::Keep-Downloaded-Packages=1;' -y ./" + plugin.lower() + "*.deb\n") output_status = (subprocess.run( @@ -84,7 +84,7 @@ def install_plugin(plugin, archi): def remove_plugin(plugin, archi): - with open('/var/log/robot-plugins-installation-tests.log', "a") as outfile: + with open('/var/log/uninstallation-' + plugin + '.log', "a") as outfile: if archi == "deb": outfile.write("apt-get -o 'Binary::apt::APT::Keep-Downloaded-Packages=1;' autoremove -y " + plugin.lower() + "\n") output_status = (subprocess.run( @@ -134,23 +134,19 @@ if __name__ == '__main__': for plugin in sys.argv: print("plugin : ", plugin) folders_list = get_tests_folders(plugin) - if len(folders_list) == 0: - print(f"we don't test {plugin} as it don't have any robots tests.") - continue - nb_plugins += 1 tmp = install_plugin(plugin, archi) if tmp > 0: list_plugin_error.append(plugin) - error_install += tmp + error_install += 1 tmp = test_plugin(plugin) if tmp > 0: list_plugin_error.append(plugin) - error_tests += tmp + error_tests += 1 tmp = remove_plugin(plugin, archi) if tmp > 0: list_plugin_error.append(plugin) - error_purge += tmp + error_purge += 1 print(f"{nb_plugins} plugins tested.\n there was {error_install} installation error, {error_tests} test " f"errors, and {error_purge} removal error list of error : {list_plugin_error}",) diff --git a/src/centreon/plugins/mode.pm b/src/centreon/plugins/mode.pm index 2970d7ef8..fefafd6d5 100644 --- a/src/centreon/plugins/mode.pm +++ b/src/centreon/plugins/mode.pm @@ -26,17 +26,17 @@ use centreon::plugins::perfdata; sub new { my ($class, %options) = @_; - my $self = {}; + my $self = {}; bless $self, $class; $self->{perfdata} = centreon::plugins::perfdata->new(output => $options{output}); - + %{$self->{option_results}} = (); - @{$self->{option_extras}} = @{$options{options}->{extra_arguments}}; - $self->{output} = $options{output}; + @{$self->{option_extras}} = @{$options{options}->{extra_arguments}}; + $self->{output} = $options{output}; $self->{output}->use_new_perfdata(value => 1) if (defined($options{force_new_perfdata}) && $options{force_new_perfdata} == 1); - $self->{mode} = $options{mode}; + $self->{mode} = $options{mode}; $self->{version} = '1.0'; return $self; @@ -62,7 +62,7 @@ sub init { sub version { my ($self, %options) = @_; - + $self->{output}->add_option_msg(short_msg => "Mode Version: " . $self->{version}); }