2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-22 09:57:41 +00:00

[#3025] address review comments

This commit is contained in:
Andrei Pavel 2024-02-21 00:25:22 +02:00
parent af063a3c02
commit 29510c9762
No known key found for this signature in database
GPG Key ID: D4E804481939CB21
18 changed files with 31 additions and 41 deletions

View File

@ -952,7 +952,7 @@ Currently Kea's statistics management has the following limitations:
.. note:: .. note::
Hook libraries, such as the the ISC subscriber-only GSS-TSIG library, Hook libraries, such as the ISC subscriber-only GSS-TSIG library,
make new statistics available in Kea. make new statistics available in Kea.
More information about Kea statistics can be found at :ref:`stats`. More information about Kea statistics can be found at :ref:`stats`.

View File

@ -42,13 +42,13 @@ dump_file=""
dump_qry="" dump_qry=""
# Detect if this is installed or in sources. Check for sources first, so that # Detect if this is installed or in sources. Check for sources first, so that
# the the unexpected situations with weird paths fall on the default case of # the unexpected situations with weird paths fall on the default case of
# installed. # installed.
script_path=$(cd "$(dirname "${0}")" && pwd) script_path=$(cd "$(dirname "${0}")" && pwd)
if test "${script_path}" = "@abs_top_builddir@/src/bin/admin"; then if test "${script_path}" = "@abs_top_builddir@/src/bin/admin"; then
admin_utils="@abs_top_builddir@/src/bin/admin/admin-utils.sh" admin_utils="@abs_top_builddir@/src/bin/admin/admin-utils.sh"
KEA_LFC="@abs_top_builddir@/src/bin/lfc/kea-lfc" KEA_LFC="@abs_top_builddir@/src/bin/lfc/kea-lfc"
SCRIPTS_DIR="@abs_top_builddir@/src/share/database/scripts" SCRIPTS_DIR="@abs_top_srcdir@/src/share/database/scripts"
else else
admin_utils="@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh" admin_utils="@datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh"
KEA_LFC="@sbindir@/kea-lfc" KEA_LFC="@sbindir@/kea-lfc"

View File

@ -302,11 +302,6 @@ TEST_F(ProcessSpawnTest, invalidExecutable) {
// This test verifies that the full command line for the process is // This test verifies that the full command line for the process is
// returned. // returned.
TEST_F(ProcessSpawnTest, getCommandLine) { TEST_F(ProcessSpawnTest, getCommandLine) {
// Note that cases below are enclosed in separate scopes to make
// sure that the ProcessSpawn object is destroyed before a new
// object is created. Current implementation doesn't allow for
// having two ProcessSpawn objects simultaneously as they will
// both try to allocate a signal handler for SIGCHLD.
{ {
// Case 1: arguments present. // Case 1: arguments present.
ProcessArgs args; ProcessArgs args;

View File

@ -1,7 +1,7 @@
SUBDIRS = . SUBDIRS = .
AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
TEST_CA_DIR = $(abs_srcdir)/../../asiolink/testutils/ca TEST_CA_DIR = $(realpath $(abs_srcdir)/../../asiolink/testutils/ca)
AM_CPPFLAGS += -DTEST_CA_DIR=\"$(TEST_CA_DIR)\" AM_CPPFLAGS += -DTEST_CA_DIR=\"$(TEST_CA_DIR)\"
AM_CXXFLAGS = $(KEA_CXXFLAGS) AM_CXXFLAGS = $(KEA_CXXFLAGS)

View File

@ -391,7 +391,7 @@ no lease6 should be assigned. The server will not put that lease in its
database and the client will get a NoAddrsAvail for that IA_NA option. database and the client will get a NoAddrsAvail for that IA_NA option.
% DHCPSRV_HOST_MGR_DB_OPEN_CONNECTION_WITH_RETRY_FAILED Failed to connect to database: %1 with error: %2 % DHCPSRV_HOST_MGR_DB_OPEN_CONNECTION_WITH_RETRY_FAILED Failed to connect to database: %1 with error: %2
This is an informational message issued when the the server failed to connect to This is an informational message issued when the server failed to connect to
the host database. The operation started a retry to connect procedure. the host database. The operation started a retry to connect procedure.
The database access string with password redacted is logged, along with the The database access string with password redacted is logged, along with the
error and details for the reconnect procedure. error and details for the reconnect procedure.
@ -438,7 +438,7 @@ This log message variant contains no error text because it is triggered
by an unknown exception. by an unknown exception.
% DHCPSRV_LEASE_MGR_DB_OPEN_CONNECTION_WITH_RETRY_FAILED Failed to connect to database: %1 with error: %2 % DHCPSRV_LEASE_MGR_DB_OPEN_CONNECTION_WITH_RETRY_FAILED Failed to connect to database: %1 with error: %2
This is an informational message issued when the the server failed to connect to This is an informational message issued when the server failed to connect to
the lease database. The operation started a retry to connect procedure. the lease database. The operation started a retry to connect procedure.
The database access string with password redacted is logged, along with the The database access string with password redacted is logged, along with the
error and details for the reconnect procedure. error and details for the reconnect procedure.

View File

@ -875,7 +875,7 @@ configuration derived from the root logger.
@subsection hooksdgBuild Building the Library @subsection hooksdgBuild Building the Library
Building the code requires building a sharable library. This requires Building the code requires building a sharable library. This requires
the the code be compiled as position-independent code (using the the code be compiled as position-independent code (using the
compiler's "-fpic" switch) and linked as a shared library (with the compiler's "-fpic" switch) and linked as a shared library (with the
linker's "-shared" switch). The build command also needs to point to linker's "-shared" switch). The build command also needs to point to
the Kea include directory and link in the appropriate libraries. the Kea include directory and link in the appropriate libraries.

View File

@ -827,6 +827,8 @@ public:
/// @brief TLS flag (true when TLS was required, false otherwise). /// @brief TLS flag (true when TLS was required, false otherwise).
bool tls_; bool tls_;
/// @brief Holds location to kea-admin. By default, it points to kea-admin
/// from installation. In tests, it points to kea-admin from sources.
static std::string KEA_ADMIN_; static std::string KEA_ADMIN_;
}; };

View File

@ -1,7 +1,7 @@
SUBDIRS = . SUBDIRS = .
AM_CPPFLAGS = AM_CPPFLAGS =
AM_CPPFLAGS += -DABS_TOP_BUILDDIR="\"$(abs_top_builddir)\"" AM_CPPFLAGS += -DABS_SRCDIR="\"$(abs_top_builddir)\""
AM_CPPFLAGS += -DKEA_ADMIN=\"${abs_top_builddir}/src/bin/admin/kea-admin\" AM_CPPFLAGS += -DKEA_ADMIN=\"${abs_top_builddir}/src/bin/admin/kea-admin\"
AM_CPPFLAGS += -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib AM_CPPFLAGS += -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
AM_CPPFLAGS += $(BOOST_INCLUDES) $(MYSQL_CPPFLAGS) AM_CPPFLAGS += $(BOOST_INCLUDES) $(MYSQL_CPPFLAGS)

View File

@ -1000,18 +1000,16 @@ TEST_F(MySqlConnectionTest, toKeaAdminParameters) {
parameters = DatabaseConnection::parse(full_mysql_connection_string); parameters = DatabaseConnection::parse(full_mysql_connection_string);
kea_admin_parameters = MySqlConnection::toKeaAdminParameters(parameters); kea_admin_parameters = MySqlConnection::toKeaAdminParameters(parameters);
EXPECT_EQ(kea_admin_parameters, EXPECT_EQ(kea_admin_parameters,
vector<string>( vector<string>({"mysql", "--extra",
{"mysql", "--extra", "--ssl-cert " ABS_SRCDIR "/src/lib/asiolink/testutils/ca/"
"--ssl-cert " ABS_TOP_BUILDDIR "/src/lib/database/testutils/../../asiolink/" "kea-client.crt",
"testutils/ca/kea-client.crt", "--extra", "--ssl-cipher AES", "--extra", "--connect_timeout 10",
"--extra", "--ssl-cipher AES", "--extra", "--connect_timeout 10", "--host", "--host", "127.0.0.1", "--extra",
"127.0.0.1", "--extra", "--ssl-key " ABS_SRCDIR "/src/lib/asiolink/testutils/ca/"
"--ssl-key " ABS_TOP_BUILDDIR "/src/lib/database/testutils/../../asiolink/" "kea-client.key",
"testutils/ca/kea-client.key", "--name", "keatest", "--password", "keatest", "--extra",
"--name", "keatest", "--password", "keatest", "--extra", "--ssl-ca " ABS_SRCDIR "/src/lib/asiolink/testutils/ca/kea-ca.crt",
"--ssl-ca " ABS_TOP_BUILDDIR "/src/lib/database/testutils/../../asiolink/" "--user", "keatest_secure"}));
"testutils/ca/kea-ca.crt",
"--user", "keatest_secure"}));
} }
} // namespace } // namespace

View File

@ -184,9 +184,6 @@ PgSqlConnection::ensureSchemaVersion(const ParameterMap& parameters,
IOServiceAccessorPtr ac(new IOServiceAccessor(&DatabaseConnection::getIOService)); IOServiceAccessorPtr ac(new IOServiceAccessor(&DatabaseConnection::getIOService));
pair<uint32_t, uint32_t> schema_version; pair<uint32_t, uint32_t> schema_version;
try { try {
// Attempt to get version without retrying or other sophistries. This
// provides the most accurate view of the status of the database and the
// most flexibility to reacting to errors.
schema_version = getVersion(parameters, ac, cb, retry ? timer_name : string()); schema_version = getVersion(parameters, ac, cb, retry ? timer_name : string());
} catch (DbOpenError const& exception) { } catch (DbOpenError const& exception) {
throw; throw;

View File

@ -626,6 +626,8 @@ public:
/// is already in progress. /// is already in progress.
int transaction_ref_count_; int transaction_ref_count_;
/// @brief Holds location to kea-admin. By default, it points to kea-admin
/// from installation. In tests, it points to kea-admin from sources.
static std::string KEA_ADMIN_; static std::string KEA_ADMIN_;
}; };

View File

@ -197,7 +197,7 @@ public:
TestRowSet fetched_rows; TestRowSet fetched_rows;
// Run the select. The row consumption lambda should populate // Run the select. The row consumption lambda should populate
// fetched_rows based on the the result set returned by the select. // fetched_rows based on the result set returned by the select.
conn_->selectQuery(tagged_statements[GET_BY_INT_RANGE], in_bindings, conn_->selectQuery(tagged_statements[GET_BY_INT_RANGE], in_bindings,
[&](PgSqlResult& r, size_t row) { [&](PgSqlResult& r, size_t row) {
TestRow fetched_row; TestRow fetched_row;
@ -236,7 +236,7 @@ public:
/// In this test, the input data is a set of rows that describe /// In this test, the input data is a set of rows that describe
/// which rows in the database to update and how. For each row /// which rows in the database to update and how. For each row
/// in the set we find the record in the database with matching /// in the set we find the record in the database with matching
/// int_col value and replace its text_col value with the the /// int_col value and replace its text_col value with the
/// text value from the input the row. /// text value from the input the row.
/// ///
/// @param update_rows Collection of rows of data to update. /// @param update_rows Collection of rows of data to update.

View File

@ -76,7 +76,7 @@ A debug message indicating that the controller has received an
updated configuration from the Kea configuration system. updated configuration from the Kea configuration system.
% DCTL_DB_OPEN_CONNECTION_WITH_RETRY_FAILED Failed to connect to database: %1 with error: %2 % DCTL_DB_OPEN_CONNECTION_WITH_RETRY_FAILED Failed to connect to database: %1 with error: %2
This is an informational message issued when the the server failed to connect to This is an informational message issued when the server failed to connect to
the configuration database. The operation started a retry to connect procedure. the configuration database. The operation started a retry to connect procedure.
The database access string with password redacted is logged, along with the The database access string with password redacted is logged, along with the
error and details for the reconnect procedure. error and details for the reconnect procedure.

View File

@ -73,7 +73,6 @@ isFile(const string& name) {
return ((stats.st_mode & S_IFMT) == S_IFREG); return ((stats.st_mode & S_IFMT) == S_IFREG);
} }
} // namespace file } // namespace file
} // namespace log } // namespace log
} // namespace isc } // namespace isc

View File

@ -2,6 +2,7 @@ SUBDIRS = .
AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
AM_CPPFLAGS += $(BOOST_INCLUDES) AM_CPPFLAGS += $(BOOST_INCLUDES)
AM_CPPFLAGS += -DABS_SRCDIR=\"$(abs_srcdir)\"
AM_CPPFLAGS += -DTEST_DATA_BUILDDIR=\"$(abs_builddir)\" AM_CPPFLAGS += -DTEST_DATA_BUILDDIR=\"$(abs_builddir)\"
AM_CXXFLAGS = $(KEA_CXXFLAGS) AM_CXXFLAGS = $(KEA_CXXFLAGS)

View File

@ -28,7 +28,7 @@ public:
}; };
FileUtilTest::~FileUtilTest() { FileUtilTest::~FileUtilTest() {
string test_file_name = string(TEST_DATA_BUILDDIR) + "/fu.test"; string test_file_name(TEST_DATA_BUILDDIR "/fu.test");
static_cast<void>(remove(test_file_name.c_str())); static_cast<void>(remove(test_file_name.c_str()));
} }
@ -65,7 +65,7 @@ TEST_F(FileUtilTest, notRegular) {
/// @brief Check getContent works. /// @brief Check getContent works.
TEST_F(FileUtilTest, basic) { TEST_F(FileUtilTest, basic) {
string file_name = string(TEST_DATA_BUILDDIR) + "/fu.test"; string file_name(TEST_DATA_BUILDDIR "/fu.test");
ofstream fs(file_name.c_str(), ofstream::out | ofstream::trunc); ofstream fs(file_name.c_str(), ofstream::out | ofstream::trunc);
ASSERT_TRUE(fs.is_open()); ASSERT_TRUE(fs.is_open());
fs << "abdc"; fs << "abdc";
@ -79,13 +79,13 @@ TEST_F(FileUtilTest, basic) {
TEST_F(FileUtilTest, isDir) { TEST_F(FileUtilTest, isDir) {
EXPECT_TRUE(isDir("/dev")); EXPECT_TRUE(isDir("/dev"));
EXPECT_FALSE(isDir("/dev/null")); EXPECT_FALSE(isDir("/dev/null"));
EXPECT_FALSE(isDir("/this/does/not/exists")); EXPECT_FALSE(isDir("/this/does/not/exist"));
EXPECT_FALSE(isDir("/etc/hosts")); EXPECT_FALSE(isDir("/etc/hosts"));
} }
/// @brief Check isFile. /// @brief Check isFile.
TEST_F(FileUtilTest, isFile) { TEST_F(FileUtilTest, isFile) {
EXPECT_TRUE(isFile("file_utilities_unittest.cc")); EXPECT_TRUE(isFile(ABS_SRCDIR "/file_utilities_unittest.cc"));
EXPECT_FALSE(isFile(TEST_DATA_BUILDDIR)); EXPECT_FALSE(isFile(TEST_DATA_BUILDDIR));
} }

View File

@ -205,7 +205,7 @@ public:
/// in the sysrepo datastore by calling Session::getData(). It should be /// in the sysrepo datastore by calling Session::getData(). It should be
/// used sparingly in production code. It is primarily meant for unit tests. /// used sparingly in production code. It is primarily meant for unit tests.
/// ///
/// @param xpath the xpath of the root node belonging to the the tree being traversed /// @param xpath the xpath of the root node belonging to the tree being traversed
/// @param f the function to be called on the node itself and each descendant /// @param f the function to be called on the node itself and each descendant
template <typename functor_t> template <typename functor_t>
void forAll(std::string const& xpath, functor_t f) const { void forAll(std::string const& xpath, functor_t f) const {

View File

@ -8,7 +8,3 @@ endif
CLEANFILES = *.gcno *.gcda CLEANFILES = *.gcno *.gcda
DISTCLEANFILES = path_replacer.sh DISTCLEANFILES = path_replacer.sh
if GENERATE_DOCS
endif