From 1ea67d2ea8ff4979520bb2565d0f5c91e96894e9 Mon Sep 17 00:00:00 2001 From: jean-christophe81 <98889244+jean-christophe81@users.noreply.github.com> Date: Fri, 14 Jun 2024 09:56:13 +0200 Subject: [PATCH] MON-103295 default mariadb plugins directory is configurable and set by default according to the os (#1421) * default mariadb plugins directory is configurable and set by default according to the os * fix previous rebase issue * no lib mariadb static link * fix test REFS:MON-103295 --- .../docker/Dockerfile.centreon-collect-alma9 | 1 + ...ockerfile.centreon-collect-debian-bookworm | 1 + ...ockerfile.centreon-collect-debian-bullseye | 1 + .../Dockerfile.centreon-collect-mysql-alma9 | 1 + ...ckerfile.centreon-collect-mysql-alma9-test | 5 +- .../Dockerfile.centreon-collect-ubuntu-jammy | 1 + .github/scripts/collect-prepare-test-robot.sh | 4 +- broker/CMakeLists.txt | 8 ++- .../centreon/broker/sql/database_config.hh | 8 +++ .../centreon/broker/sql/mysql_bind_base.hh | 2 +- .../com/centreon/broker/sql/mysql_column.hh | 3 +- .../centreon/broker/sql/mysql_connection.hh | 1 + broker/core/sql/src/database_config.cc | 18 ++++-- broker/core/sql/src/mysql_connection.cc | 9 ++- common/inc/com/centreon/common/perfdata.hh | 42 +++++++------- common/tests/perfdata_test.cc | 56 +++++++++---------- common/tests/process_test.cc | 18 +++++- packaging/centreon-broker-core.yaml | 2 + tests/mysql_docker_conf/centreon16.cnf | 1 - vcpkg.json | 1 - 20 files changed, 118 insertions(+), 65 deletions(-) diff --git a/.github/docker/Dockerfile.centreon-collect-alma9 b/.github/docker/Dockerfile.centreon-collect-alma9 index 7eb1fabb13e..d2ae761de8d 100644 --- a/.github/docker/Dockerfile.centreon-collect-alma9 +++ b/.github/docker/Dockerfile.centreon-collect-alma9 @@ -29,6 +29,7 @@ dnf --best install -y cmake \ openssh-server \ mariadb-server \ mariadb \ + mariadb-connector-c-devel \ gnutls-devel \ libgcrypt-devel \ lua-devel \ diff --git a/.github/docker/Dockerfile.centreon-collect-debian-bookworm b/.github/docker/Dockerfile.centreon-collect-debian-bookworm index 5bb95c9d0db..d395c7cba52 100644 --- a/.github/docker/Dockerfile.centreon-collect-debian-bookworm +++ b/.github/docker/Dockerfile.centreon-collect-debian-bookworm @@ -21,6 +21,7 @@ apt-get -y install git \ mariadb-server \ openssh-server \ libmariadb3 \ + libmariadb-dev \ librrd-dev \ libgnutls28-dev \ liblua5.3-dev \ diff --git a/.github/docker/Dockerfile.centreon-collect-debian-bullseye b/.github/docker/Dockerfile.centreon-collect-debian-bullseye index eb3b14950bc..9c019e53072 100644 --- a/.github/docker/Dockerfile.centreon-collect-debian-bullseye +++ b/.github/docker/Dockerfile.centreon-collect-debian-bullseye @@ -17,6 +17,7 @@ apt-get -y install git \ mariadb-server \ openssh-server \ libmariadb3 \ + libmariadb-dev \ librrd-dev \ libgnutls28-dev \ liblua5.3-dev \ diff --git a/.github/docker/Dockerfile.centreon-collect-mysql-alma9 b/.github/docker/Dockerfile.centreon-collect-mysql-alma9 index 5cd38f62a42..02661fdb023 100644 --- a/.github/docker/Dockerfile.centreon-collect-mysql-alma9 +++ b/.github/docker/Dockerfile.centreon-collect-mysql-alma9 @@ -25,6 +25,7 @@ dnf --best install -y cmake \ gdb \ gettext \ git \ + mariadb-connector-c-devel \ ninja-build \ openssh-server \ mysql-server \ diff --git a/.github/docker/Dockerfile.centreon-collect-mysql-alma9-test b/.github/docker/Dockerfile.centreon-collect-mysql-alma9-test index 8d5a10771f9..bd135b7dee9 100644 --- a/.github/docker/Dockerfile.centreon-collect-mysql-alma9-test +++ b/.github/docker/Dockerfile.centreon-collect-mysql-alma9-test @@ -20,6 +20,7 @@ dnf --best install -y gcc \ gdb \ git \ openssh-server \ + mariadb-connector-c \ mysql-server \ mysql \ gnutls \ @@ -42,8 +43,8 @@ dnf clean all echo "install robot and dependencies" -pip3 install -U robotframework robotframework-databaselibrary robotframework-httpctrl robotframework-examples pymysql python-dateutil psutil -pip3 install grpcio grpcio_tools py-cpuinfo cython unqlite gitpython boto3 robotframework-requests +pip3 install -U robotframework robotframework-databaselibrary robotframework-httpctrl robotframework-examples pymysql python-dateutil psutil +pip3 install grpcio grpcio_tools py-cpuinfo cython unqlite gitpython boto3 robotframework-requests cryptography cd /tmp/collect diff --git a/.github/docker/Dockerfile.centreon-collect-ubuntu-jammy b/.github/docker/Dockerfile.centreon-collect-ubuntu-jammy index e664fab6a1a..2d6650acb02 100644 --- a/.github/docker/Dockerfile.centreon-collect-ubuntu-jammy +++ b/.github/docker/Dockerfile.centreon-collect-ubuntu-jammy @@ -21,6 +21,7 @@ apt-get -y install cmake \ mariadb-server \ openssh-server \ libmariadb3 \ + libmariadb-dev \ librrd-dev \ libgnutls28-dev \ liblua5.3-dev \ diff --git a/.github/scripts/collect-prepare-test-robot.sh b/.github/scripts/collect-prepare-test-robot.sh index 71a070bb091..25e9f02e5b0 100755 --- a/.github/scripts/collect-prepare-test-robot.sh +++ b/.github/scripts/collect-prepare-test-robot.sh @@ -30,8 +30,8 @@ if [ $database_type == 'mysql' ]; then sleep 5 echo "########################### Init centreon database ############################" - mysql -e "CREATE USER IF NOT EXISTS 'centreon'@'localhost' IDENTIFIED WITH mysql_native_password BY 'centreon'" - mysql -e "CREATE USER IF NOT EXISTS 'root_centreon'@'localhost' IDENTIFIED WITH mysql_native_password BY 'centreon'" + mysql -e "CREATE USER IF NOT EXISTS 'centreon'@'localhost' IDENTIFIED BY 'centreon'" + mysql -e "CREATE USER IF NOT EXISTS 'root_centreon'@'localhost' IDENTIFIED BY 'centreon'" else echo "########################### Start MariaDB ######################################" if [ "$distrib" = "ALMALINUX" ]; then diff --git a/broker/CMakeLists.txt b/broker/CMakeLists.txt index e3f564ffa9e..ad2373471fe 100644 --- a/broker/CMakeLists.txt +++ b/broker/CMakeLists.txt @@ -66,12 +66,15 @@ endif() if(OS_DISTRIBUTOR STREQUAL "Debian" OR OS_DISTRIBUTOR STREQUAL "Ubuntu") message(STATUS "deb based os") add_definitions("-DMYSQL_SOCKET=\"/var/run/mysqld/mysqld.sock\"") + add_definitions("-DDEFAULT_MARIADB_EXTENSION_DIR=\"/usr/lib/x86_64-linux-gnu/libmariadb3/plugin\"") elseif(OS_DISTRIBUTOR STREQUAL "CentOS" OR OS_DISTRIBUTOR STREQUAL "RedHat") message(STATUS "rpm based os") add_definitions("-DMYSQL_SOCKET=\"/var/lib/mysql/mysql.sock\"") + add_definitions("-DDEFAULT_MARIADB_EXTENSION_DIR=\"/usr/lib64/mariadb/plugin\"") else() message(STATUS "other os: ${OS_DISTRIBUTOR}") - add_definitions("-DMYSQL_SOCKET=/tmp/mysql.sock") + add_definitions("-DMYSQL_SOCKET=\"/tmp/mysql.sock\"") + add_definitions("-DDEFAULT_MARIADB_EXTENSION_DIR=\"/usr/lib/x86_64-linux-gnu/libmariadb3/plugin\"") endif() include_directories( @@ -79,7 +82,8 @@ include_directories( "${PROJECT_SOURCE_DIR}/neb/inc" "${CMAKE_SOURCE_DIR}/engine/inc" "${PROJECT_SOURCE_DIR}/core/multiplexing/inc" - "${PROJECT_SOURCE_DIR}/core/sql/inc") + "${PROJECT_SOURCE_DIR}/core/sql/inc" + "${MARIADB_INCLUDE_DIRS}") set(INC_DIR "${PROJECT_SOURCE_DIR}/core/inc/com/centreon/broker") set(SRC_DIR "${PROJECT_SOURCE_DIR}/core/src") set(TEST_DIR "${PROJECT_SOURCE_DIR}/core/test") diff --git a/broker/core/sql/inc/com/centreon/broker/sql/database_config.hh b/broker/core/sql/inc/com/centreon/broker/sql/database_config.hh index 0636df9d79d..d68df108294 100644 --- a/broker/core/sql/inc/com/centreon/broker/sql/database_config.hh +++ b/broker/core/sql/inc/com/centreon/broker/sql/database_config.hh @@ -75,6 +75,9 @@ class database_config { int get_connections_count() const; unsigned get_max_commit_delay() const; unsigned get_category() const; + const std::string& get_extension_directory() const { + return _extension_directory; + } void set_type(std::string const& type); void set_host(std::string const& host); @@ -87,6 +90,9 @@ class database_config { void set_queries_per_transaction(int qpt); void set_check_replication(bool check_replication); void set_category(unsigned category); + void set_extension_directory(std::string const& extension_directory) { + _extension_directory = extension_directory; + } database_config auto_commit_conf() const; @@ -105,6 +111,8 @@ class database_config { int _connections_count; unsigned _max_commit_delay; unsigned _category; + // where mariadb will find extension such as caching_sha2_password.so + std::string _extension_directory; }; std::ostream& operator<<(std::ostream& s, const database_config cfg); diff --git a/broker/core/sql/inc/com/centreon/broker/sql/mysql_bind_base.hh b/broker/core/sql/inc/com/centreon/broker/sql/mysql_bind_base.hh index e4f6bdde00a..24373ada1b9 100644 --- a/broker/core/sql/inc/com/centreon/broker/sql/mysql_bind_base.hh +++ b/broker/core/sql/inc/com/centreon/broker/sql/mysql_bind_base.hh @@ -19,7 +19,7 @@ #ifndef CCB_MYSQL_BIND_BASE_HH #define CCB_MYSQL_BIND_BASE_HH -#include +#include namespace com::centreon::broker { diff --git a/broker/core/sql/inc/com/centreon/broker/sql/mysql_column.hh b/broker/core/sql/inc/com/centreon/broker/sql/mysql_column.hh index 7d411e8ee0c..beaa8200b7a 100644 --- a/broker/core/sql/inc/com/centreon/broker/sql/mysql_column.hh +++ b/broker/core/sql/inc/com/centreon/broker/sql/mysql_column.hh @@ -19,8 +19,9 @@ #ifndef CCB_DATABASE_MYSQL_COLUMN_HH #define CCB_DATABASE_MYSQL_COLUMN_HH +#include + #include -#include #include namespace com::centreon::broker { diff --git a/broker/core/sql/inc/com/centreon/broker/sql/mysql_connection.hh b/broker/core/sql/inc/com/centreon/broker/sql/mysql_connection.hh index d83aaa17697..efe6140ab21 100644 --- a/broker/core/sql/inc/com/centreon/broker/sql/mysql_connection.hh +++ b/broker/core/sql/inc/com/centreon/broker/sql/mysql_connection.hh @@ -85,6 +85,7 @@ class mysql_connection { const std::string _pwd; const std::string _name; const int _port; + const std::string _extension_directory; const unsigned _max_second_commit_delay; time_t _last_commit; std::atomic _state; diff --git a/broker/core/sql/src/database_config.cc b/broker/core/sql/src/database_config.cc index 855d56e0faa..6adf7ff3684 100644 --- a/broker/core/sql/src/database_config.cc +++ b/broker/core/sql/src/database_config.cc @@ -36,7 +36,8 @@ std::ostream& operator<<(std::ostream& s, const database_config cfg) { s << " queries per transaction:" << cfg.get_queries_per_transaction() << " check replication:" << cfg.get_check_replication() << " connection count:" << cfg.get_connections_count() - << " max commit delay:" << cfg.get_max_commit_delay() << 's'; + << " max commit delay:" << cfg.get_max_commit_delay() << 's' + << " extension_directory" << cfg.get_extension_directory(); return s; } @@ -49,7 +50,8 @@ database_config::database_config() : _queries_per_transaction(1), _check_replication(true), _connections_count(1), - _category(SHARED) {} + _category(SHARED), + _extension_directory(DEFAULT_MARIADB_EXTENSION_DIR) {} /** * Constructor. @@ -90,14 +92,16 @@ database_config::database_config(const std::string& type, _check_replication(check_replication), _connections_count(connections_count), _max_commit_delay(max_commit_delay), - _category(SHARED) {} + _category(SHARED), + _extension_directory(DEFAULT_MARIADB_EXTENSION_DIR) {} /** * Build a database configuration from a configuration set. * * @param[in] cfg Endpoint configuration. */ -database_config::database_config(config::endpoint const& cfg) { +database_config::database_config(config::endpoint const& cfg) + : _extension_directory(DEFAULT_MARIADB_EXTENSION_DIR) { std::map::const_iterator it, end; end = cfg.params.end(); @@ -212,6 +216,11 @@ database_config::database_config(config::endpoint const& cfg) { } } else _max_commit_delay = 5; + + it = cfg.params.find("extension_directory"); + if (it != end) { + _extension_directory = it->second; + } } /** @@ -557,6 +566,7 @@ void database_config::_internal_copy(database_config const& other) { _check_replication = other._check_replication; _connections_count = other._connections_count; _max_commit_delay = other._max_commit_delay; + _extension_directory = other._extension_directory; } /** diff --git a/broker/core/sql/src/mysql_connection.cc b/broker/core/sql/src/mysql_connection.cc index 61580982e5b..5c6d2548bba 100644 --- a/broker/core/sql/src/mysql_connection.cc +++ b/broker/core/sql/src/mysql_connection.cc @@ -15,7 +15,7 @@ * * For more information : contact@centreon.com */ -#include +#include #include "com/centreon/broker/config/applier/init.hh" #include "com/centreon/broker/misc/misc.hh" @@ -190,6 +190,9 @@ bool mysql_connection::_try_to_reconnect() { uint32_t timeout = 10; mysql_options(_conn, MYSQL_OPT_CONNECT_TIMEOUT, &timeout); + mysql_optionsv(_conn, MYSQL_PLUGIN_DIR, + (const void*)_extension_directory.c_str()); + if (!mysql_real_connect(_conn, _host.c_str(), _user.c_str(), _pwd.c_str(), _name.c_str(), _port, (_socket == "" ? nullptr : _socket.c_str()), @@ -830,6 +833,9 @@ void mysql_connection::_run() { uint32_t timeout = 10; mysql_options(_conn, MYSQL_OPT_CONNECT_TIMEOUT, &timeout); + mysql_optionsv(_conn, MYSQL_PLUGIN_DIR, + (const void*)_extension_directory.c_str()); + while (config::applier::mode != config::applier::finished && !mysql_real_connect(_conn, _host.c_str(), _user.c_str(), _pwd.c_str(), _name.c_str(), _port, @@ -1076,6 +1082,7 @@ mysql_connection::mysql_connection( _pwd(db_cfg.get_password()), _name(db_cfg.get_name()), _port(db_cfg.get_port()), + _extension_directory(db_cfg.get_extension_directory()), _max_second_commit_delay(db_cfg.get_max_commit_delay()), _last_commit(db_cfg.get_queries_per_transaction() > 1 ? 0 diff --git a/common/inc/com/centreon/common/perfdata.hh b/common/inc/com/centreon/common/perfdata.hh index beaef41610b..cc863df3d21 100644 --- a/common/inc/com/centreon/common/perfdata.hh +++ b/common/inc/com/centreon/common/perfdata.hh @@ -25,17 +25,17 @@ class perfdata { enum data_type { gauge = 0, counter, derive, absolute, automatic }; private: - double _critical; - double _critical_low; + float _critical; + float _critical_low; bool _critical_mode; - double _max; - double _min; + float _max; + float _min; std::string _name; std::string _unit; - double _value; + float _value; data_type _value_type; - double _warning; - double _warning_low; + float _warning; + float _warning_low; bool _warning_mode; public: @@ -48,30 +48,30 @@ class perfdata { perfdata(); ~perfdata() noexcept = default; - double critical() const { return _critical; } - void critical(double c) { _critical = c; } - double critical_low() const { return _critical_low; } - void critical_low(double c) { _critical_low = c; } + float critical() const { return _critical; } + void critical(float c) { _critical = c; } + float critical_low() const { return _critical_low; } + void critical_low(float c) { _critical_low = c; } bool critical_mode() const { return _critical_mode; } void critical_mode(bool val) { _critical_mode = val; } - double max() const { return _max; } - void max(double val) { _max = val; } - double min() const { return _min; } - void min(double val) { _min = val; } + float max() const { return _max; } + void max(float val) { _max = val; } + float min() const { return _min; } + void min(float val) { _min = val; } const std::string& name() const { return _name; } void name(const std::string&& val) { _name = val; } void resize_name(size_t new_size); const std::string& unit() const { return _unit; } void resize_unit(size_t new_size); void unit(const std::string&& val) { _unit = val; } - double value() const { return _value; } - void value(double val) { _value = val; } + float value() const { return _value; } + void value(float val) { _value = val; } data_type value_type() const { return _value_type; }; void value_type(data_type val) { _value_type = val; } - double warning() const { return _warning; } - void warning(double val) { _warning = val; } - double warning_low() const { return _warning_low; } - void warning_low(double val) { _warning_low = val; } + float warning() const { return _warning; } + void warning(float val) { _warning = val; } + float warning_low() const { return _warning_low; } + void warning_low(float val) { _warning_low = val; } bool warning_mode() const { return _warning_mode; } void warning_mode(bool val) { _warning_mode = val; } }; diff --git a/common/tests/perfdata_test.cc b/common/tests/perfdata_test.cc index 25ac9d30cff..487300251bd 100644 --- a/common/tests/perfdata_test.cc +++ b/common/tests/perfdata_test.cc @@ -78,29 +78,29 @@ TEST(PerfData, Assign) { p1.warning_mode(false); // Check objects properties values. - ASSERT_FALSE(fabs(p1.critical() - 9432.5) > 0.00001); - ASSERT_FALSE(fabs(p1.critical_low() - 1000.0001) > 0.00001); + ASSERT_FALSE(fabs(p1.critical() - 9432.5f) > 0.00001f); + ASSERT_TRUE(fabs(p1.critical_low() - 1000.0001f) < 0.0001f); ASSERT_FALSE(!p1.critical_mode()); - ASSERT_FALSE(fabs(p1.max() - 123.0) > 0.00001); - ASSERT_FALSE(fabs(p1.min() - 843.876) > 0.00001); + ASSERT_FALSE(fabs(p1.max() - 123.0f) > 0.00001f); + ASSERT_TRUE(fabs(p1.min() - 843.876f) < 0.0001f); ASSERT_FALSE(p1.name() != "baz"); ASSERT_FALSE(p1.unit() != "qux"); - ASSERT_FALSE(fabs(p1.value() - 3485.9) > 0.00001); + ASSERT_TRUE(fabs(p1.value() - 3485.9f) < 0.0001f); ASSERT_FALSE(p1.value_type() != perfdata::derive); - ASSERT_FALSE(fabs(p1.warning() - 3612.0) > 0.00001); - ASSERT_FALSE(fabs(p1.warning_low() + 987579.0) > 0.01); + ASSERT_FALSE(fabs(p1.warning() - 3612.0f) > 0.00001f); + ASSERT_FALSE(fabs(p1.warning_low() + 987579.0f) > 0.01f); ASSERT_FALSE(p1.warning_mode()); - ASSERT_FALSE(fabs(p2.critical() - 42.0) > 0.00001); - ASSERT_FALSE(fabs(p2.critical_low() + 456.032) > 0.00001); + ASSERT_FALSE(fabs(p2.critical() - 42.0f) > 0.00001f); + ASSERT_FALSE(fabs(p2.critical_low() + 456.032f) > 0.00001f); ASSERT_FALSE(p2.critical_mode()); - ASSERT_FALSE(fabs(p2.max() - 76.3) > 0.00001); - ASSERT_FALSE(fabs(p2.min() - 567.2) > 0.00001); + ASSERT_FALSE(fabs(p2.max() - 76.3f) > 0.00001f); + ASSERT_FALSE(fabs(p2.min() - 567.2f) > 0.00001f); ASSERT_FALSE(p2.name() != "foo"); ASSERT_FALSE(p2.unit() != "bar"); - ASSERT_FALSE(fabs(p2.value() - 52189.912) > 0.00001); + ASSERT_FALSE(fabs(p2.value() - 52189.912f) > 0.00001f); ASSERT_FALSE(p2.value_type() != perfdata::counter); - ASSERT_FALSE(fabs(p2.warning() - 4548.0) > 0.00001); - ASSERT_FALSE(fabs(p2.warning_low() - 42.42) > 0.00001); + ASSERT_FALSE(fabs(p2.warning() - 4548.0f) > 0.00001f); + ASSERT_FALSE(fabs(p2.warning_low() - 42.42f) > 0.00001f); ASSERT_FALSE(!p2.warning_mode()); } @@ -141,29 +141,29 @@ TEST(PerfData, CopyCtor) { p1.warning_mode(false); // Check objects properties values. - ASSERT_FALSE(fabs(p1.critical() - 9432.5) > 0.00001); - ASSERT_FALSE(fabs(p1.critical_low() - 1000.0001) > 0.00001); + ASSERT_FALSE(fabs(p1.critical() - 9432.5f) > 0.00001f); + ASSERT_FALSE(fabs(p1.critical_low() - 1000.0001f) > 0.00001f); ASSERT_FALSE(!p1.critical_mode()); - ASSERT_FALSE(fabs(p1.max() - 123.0) > 0.00001); - ASSERT_FALSE(fabs(p1.min() - 843.876) > 0.00001); + ASSERT_FALSE(fabs(p1.max() - 123.0f) > 0.00001f); + ASSERT_FALSE(fabs(p1.min() - 843.876f) > 0.00001f); ASSERT_FALSE(p1.name() != "baz"); ASSERT_FALSE(p1.unit() != "qux"); - ASSERT_FALSE(fabs(p1.value() - 3485.9) > 0.00001); + ASSERT_FALSE(fabs(p1.value() - 3485.9f) > 0.00001f); ASSERT_FALSE(p1.value_type() != perfdata::derive); - ASSERT_FALSE(fabs(p1.warning() - 3612.0) > 0.00001); - ASSERT_FALSE(fabs(p1.warning_low() + 987579.0) > 0.01); + ASSERT_FALSE(fabs(p1.warning() - 3612.0f) > 0.00001f); + ASSERT_FALSE(fabs(p1.warning_low() + 987579.0f) > 0.01f); ASSERT_FALSE(p1.warning_mode()); - ASSERT_FALSE(fabs(p2.critical() - 42.0) > 0.00001); - ASSERT_FALSE(fabs(p2.critical_low() + 456.032) > 0.00001); + ASSERT_FALSE(fabs(p2.critical() - 42.0f) > 0.00001f); + ASSERT_FALSE(fabs(p2.critical_low() + 456.032f) > 0.00001f); ASSERT_FALSE(p2.critical_mode()); - ASSERT_FALSE(fabs(p2.max() - 76.3) > 0.00001); - ASSERT_FALSE(fabs(p2.min() - 567.2) > 0.00001); + ASSERT_FALSE(fabs(p2.max() - 76.3f) > 0.00001f); + ASSERT_FALSE(fabs(p2.min() - 567.2f) > 0.00001f); ASSERT_FALSE(p2.name() != "foo"); ASSERT_FALSE(p2.unit() != "bar"); - ASSERT_FALSE(fabs(p2.value() - 52189.912) > 0.00001); + ASSERT_FALSE(fabs(p2.value() - 52189.912f) > 0.00001f); ASSERT_FALSE(p2.value_type() != perfdata::counter); - ASSERT_FALSE(fabs(p2.warning() - 4548.0) > 0.00001); - ASSERT_FALSE(fabs(p2.warning_low() - 42.42) > 0.00001); + ASSERT_FALSE(fabs(p2.warning() - 4548.0f) > 0.00001f); + ASSERT_FALSE(fabs(p2.warning_low() - 42.42f) > 0.00001f); ASSERT_FALSE(!p2.warning_mode()); } diff --git a/common/tests/process_test.cc b/common/tests/process_test.cc index 7537532c321..449e000d3bc 100644 --- a/common/tests/process_test.cc +++ b/common/tests/process_test.cc @@ -41,12 +41,24 @@ class process_wait : public process { std::condition_variable _cond; std::string _stdout; std::string _stderr; + bool _stdout_eof = false; + bool _stderr_eof = false; + bool _process_ended = false; + + void _notify() { + if (_stdout_eof && _stderr_eof && _process_ended) { + _cond.notify_one(); + } + } public: void on_stdout_read(const boost::system::error_code& err, size_t nb_read) override { if (!err) { _stdout += std::string_view(_stdout_read_buffer, nb_read); + } else if (err == asio::error::eof) { + _stdout_eof = true; + _notify(); } process::on_stdout_read(err, nb_read); } @@ -55,6 +67,9 @@ class process_wait : public process { size_t nb_read) override { if (!err) { _stderr += std::string_view(_stderr_read_buffer, nb_read); + } else if (err == asio::error::eof) { + _stderr_eof = true; + _notify(); } process::on_stderr_read(err, nb_read); } @@ -62,7 +77,8 @@ class process_wait : public process { void on_process_end(const boost::system::error_code& err, int raw_exit_status) override { process::on_process_end(err, raw_exit_status); - _cond.notify_one(); + _process_ended = true; + _notify(); } template diff --git a/packaging/centreon-broker-core.yaml b/packaging/centreon-broker-core.yaml index 143a9e4b259..61bf0228188 100644 --- a/packaging/centreon-broker-core.yaml +++ b/packaging/centreon-broker-core.yaml @@ -43,6 +43,7 @@ overrides: - centreon-clib = ${VERSION}-${RELEASE}${DIST} - centreon-broker = ${VERSION}-${RELEASE}${DIST} - gnutls >= 3.6.0 + - mariadb-connector-c >= 3.1.10 conflicts: - centreon-broker-storage - centreon-broker-core-devel @@ -59,6 +60,7 @@ overrides: - centreon-broker (= ${VERSION}-${RELEASE}${DIST}) - libgnutls30 - libssl1.1 | libssl3 + - libmariadb3 - zlib1g conflicts: - centreon-broker-storage diff --git a/tests/mysql_docker_conf/centreon16.cnf b/tests/mysql_docker_conf/centreon16.cnf index 3865e9bf923..692a1e39f6c 100644 --- a/tests/mysql_docker_conf/centreon16.cnf +++ b/tests/mysql_docker_conf/centreon16.cnf @@ -1,7 +1,6 @@ [mysqld] #mariadb conf optimized for a 16Gb ram machine port = 3306 -default-authentication-plugin=mysql_native_password max_heap_table_size=1G open_files_limit = 32000 diff --git a/vcpkg.json b/vcpkg.json index 5a4e2b5d1d7..8e2b18a4af3 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -6,7 +6,6 @@ "cxx17" ] }, - "libmariadb", "libssh2", "curl", "fmt",