]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#92,!13] Applied a couple of fixes in headers inclusion and linking.
authorMarcin Siodelski <marcin@isc.org>
Fri, 31 Aug 2018 15:34:14 +0000 (17:34 +0200)
committerMarcin Siodelski <marcin@isc.org>
Mon, 3 Sep 2018 07:31:34 +0000 (03:31 -0400)
src/lib/cql/testutils/cql_schema.cc
src/lib/database/tests/Makefile.am
src/lib/dhcpsrv/tests/cql_host_data_source_unittest.cc
src/lib/dhcpsrv/tests/cql_lease_mgr_unittest.cc
src/lib/dhcpsrv/tests/host_mgr_unittest.cc
src/lib/dhcpsrv/testutils/cql_schema.cc [deleted file]
src/lib/dhcpsrv/testutils/cql_schema.h [deleted file]
src/lib/pgsql/tests/Makefile.am

index 0f004d1c53c6315adbcffed3a80dd35e331a2fce..26586b0b15f3b552b7ad71a67fcc4c89c96ed422 100644 (file)
@@ -9,7 +9,7 @@
 #include <cassandra.h>
 
 #include <cql/cql_connection.h>
-#include <dhcpsrv/testutils/cql_schema.h>
+#include <cql/testutils/cql_schema.h>
 
 #include <stdlib.h>
 
index 7214be511fd526f81f1a1ef13c704c071d17d81a..7a0b74d984f40f0c9a8aeae41152d0ca64aba423 100644 (file)
@@ -27,6 +27,7 @@ libdatabase_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
 libdatabase_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS)
 
 libdatabase_unittests_LDADD  = $(top_builddir)/src/lib/database/libkea-database.la
+libdatabase_unittests_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
 libdatabase_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
 libdatabase_unittests_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
 libdatabase_unittests_LDADD += $(top_builddir)/src/lib/util/threads/libkea-threads.la
index 1dbbd4473fe9752a12ce72b7d28863b1cc7420c2..5900136d48db2b269c85e2cca4b7d06ebbf208e3 100644 (file)
 #include <asiolink/io_address.h>
 #include <exceptions/exceptions.h>
 #include <cql/cql_connection.h>
+#include <cql/testutils/cql_schema.h>
 #include <dhcpsrv/host.h>
 #include <dhcpsrv/host_mgr.h>
 #include <dhcpsrv/host_data_source_factory.h>
 #include <dhcpsrv/cql_lease_mgr.h>
 #include <dhcpsrv/cql_host_data_source.h>
-#include <dhcpsrv/testutils/cql_schema.h>
 #include <dhcpsrv/testutils/generic_host_data_source_unittest.h>
 #include <dhcpsrv/testutils/host_data_source_utils.h>
 #include <dhcpsrv/tests/test_utils.h>
@@ -41,6 +41,7 @@
 using namespace isc;
 using namespace isc::asiolink;
 using namespace isc::db;
+using namespace isc::db::test;
 using namespace isc::dhcp;
 using namespace isc::dhcp::test;
 using namespace isc::data;
index 676116dac8a4e0cb816af3bbcdfa1028875484e8..21441fd4f28a2a4c36d58241faa19c52b025a4be 100644 (file)
 
 #include <asiolink/io_address.h>
 #include <cql/cql_connection.h>
+#include <cql/testutils/cql_schema.h>
 #include <dhcpsrv/lease_mgr_factory.h>
 #include <dhcpsrv/cql_lease_mgr.h>
 #include <dhcpsrv/tests/test_utils.h>
 #include <dhcpsrv/tests/generic_lease_mgr_unittest.h>
-#include <dhcpsrv/testutils/cql_schema.h>
 #include <exceptions/exceptions.h>
 
 #include <gtest/gtest.h>
@@ -38,6 +38,7 @@
 using namespace isc;
 using namespace isc::asiolink;
 using namespace isc::db;
+using namespace isc::db::test;
 using namespace isc::dhcp;
 using namespace isc::dhcp::test;
 using namespace std;
index 46240eed856823273c2c4e26386c66b83b241802..ac2afc3f14dfdbd350f04c2226afa6fadad80ac0 100644 (file)
@@ -22,7 +22,7 @@
 #endif
 
 #if defined HAVE_CQL
-#include <dhcpsrv/testutils/cql_schema.h>
+#include <cql/testutils/cql_schema.h>
 #endif
 
 #include <gtest/gtest.h>
diff --git a/src/lib/dhcpsrv/testutils/cql_schema.cc b/src/lib/dhcpsrv/testutils/cql_schema.cc
deleted file mode 100644 (file)
index 2df5324..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright (C) 2015-2018 Internet Systems Consortium, Inc. ("ISC")
-//
-// This Source Code Form is subject to the terms of the Mozilla Public
-// License, v. 2.0. If a copy of the MPL was not distributed with this
-// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-#include <config.h>
-
-#include <cassandra.h>
-
-#include <cql/cql_connection.h>
-#include <dhcpsrv/testutils/cql_schema.h>
-
-#include <stdlib.h>
-
-#include <fstream>
-#include <iostream>
-#include <sstream>
-#include <string>
-
-namespace isc {
-namespace dhcp {
-namespace test {
-
-const char* CQL_VALID_TYPE = "type=cql";
-
-std::string
-validCqlConnectionString() {
-    return (connectionString(CQL_VALID_TYPE, VALID_NAME, VALID_HOST, VALID_USER,
-                             VALID_PASSWORD));
-}
-
-bool
-softWipeEnabled() {
-    const char* const env = getenv("KEA_TEST_CASSANDRA_WIPE");
-    if (env && (std::string(env) == std::string("soft"))) {
-        return (true);
-    }
-
-    return (false);
-}
-
-void
-destroyCqlSchema(bool force_wipe, bool show_err) {
-    if (force_wipe || !softWipeEnabled()) {
-        // Do full wipe
-        runCqlScript(DATABASE_SCRIPTS_DIR, "cql/dhcpdb_drop.cql", show_err);
-    } else {
-        // do soft wipe (just remove the data, not the structures)
-        runCqlScript(DATABASE_SCRIPTS_DIR, "cql/soft_wipe.cql", show_err);
-    }
-}
-
-void
-createCqlSchema(bool force_wipe, bool show_err) {
-    if (force_wipe || !softWipeEnabled()) {
-        runCqlScript(DATABASE_SCRIPTS_DIR, "cql/dhcpdb_create.cql", show_err);
-    }
-}
-
-void
-runCqlScript(const std::string& path,
-             const std::string& script_name,
-             bool show_err) {
-    std::ostringstream cmd;
-    cmd << "cqlsh -u keatest -p keatest -k keatest";
-    if (!show_err) {
-        cmd << " 2>/dev/null ";
-    }
-
-    cmd << " -f";
-
-    if (!path.empty()) {
-        cmd << path << "/";
-    }
-
-    cmd << script_name;
-
-    int32_t retval = ::system(cmd.str().c_str());
-    if (retval) {
-        std::cerr << "runCqlSchema failed:" << cmd.str() << std::endl;
-    }
-}
-
-}  // namespace test
-}  // namespace dhcp
-}  // namespace isc
diff --git a/src/lib/dhcpsrv/testutils/cql_schema.h b/src/lib/dhcpsrv/testutils/cql_schema.h
deleted file mode 100644 (file)
index d47a3d2..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright (C) 2015-2018 Internet Systems Consortium, Inc. ("ISC")
-//
-// This Source Code Form is subject to the terms of the Mozilla Public
-// License, v. 2.0. If a copy of the MPL was not distributed with this
-// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-#ifndef TEST_CQL_SCHEMA_H
-#define TEST_CQL_SCHEMA_H
-
-#include <config.h>
-#include <database/testutils/schema.h>
-#include <string>
-
-namespace isc {
-namespace dhcp {
-namespace test {
-
-extern const char* CQL_VALID_TYPE;
-
-/// Return valid connection string
-///
-/// @return valid CQL connection string.
-std::string validCqlConnectionString();
-
-/// @brief Clear everything from the database
-///
-/// Submits the current schema drop script:
-///
-///  <TEST_ADMIN_SCRIPTS_DIR>/cql/dhcpdb_drop.cql
-///
-/// to the unit test CQL database. If the script fails, the invoking test
-/// will fail. The output of stderr is suppressed unless the parameter,
-/// show_err is true.
-///
-/// @param force_wipe forces wipe of the database, even if
-/// KEA_TEST_CASSANDRA_WIPE is set.
-/// @param show_err flag which governs whether or not stderr is suppressed.
-void destroyCqlSchema(bool force_wipe, bool show_err = false);
-
-/// @brief Create the CQL Schema
-///
-/// Submits the current schema creation script:
-///
-///  <TEST_ADMIN_SCRIPTS_DIR>/cql/dhcpdb_create.cql
-///
-/// to the unit test CQL database. If the script fails, the invoking test
-/// will fail. The output of stderr is suppressed unless the parameter,
-/// show_err is true.
-///
-/// @param force_wipe forces wipe of the database, even if
-/// KEA_TEST_CASSANDRA_WIPE is set.
-/// @param show_err flag which governs whether or not stderr is suppressed.
-void createCqlSchema(bool force_wipe, bool show_err = false);
-
-/// @brief Run a CQL script against the CQL unit test database
-///
-/// Submits the given CQL script to CQL via cqlsh CLI. The output of
-/// stderr is suppressed unless the parameter, show_err is true. The is done
-/// to suppress warnings that might otherwise make test output needlessly
-/// noisy. A gtest assertion occurs if the script fails to execute.
-///
-/// @param path - path (if not blank) of the script to execute
-/// @param script_name - file name of the path to execute
-/// @param show_err flag which governs whether or not stderr is suppressed.
-void runCqlScript(const std::string& path, const std::string& script_name,
-                    bool show_err);
-
-/// @brief Returns status if the soft-wipe is enabled or not.
-///
-/// In some deployments (In case of Tomek's dev system) Cassandra tests take
-/// a very long time to execute. This was traced back to slow table/indexes
-/// creation/deletion. With full wipe and recreation of all structures, it
-/// took over 60 seconds for each test to execute. To avoid this problem, a
-/// feature called soft-wipe has been implemented. If enabled, it does not
-/// remove the structures, just the data from essential tables. To enable
-/// it set KEA_TEST_CASSANDRA_WIPE environment variable to 'soft'. Make sure
-/// that the database schema is set up properly before running in soft-wipe
-/// mode.
-///
-/// For example to use soft-wipe mode, you can:
-///
-/// $ cqlsh -u keatest -p keatest -k keatest
-///         -f src/share/database/scripts/cql/dhcpdb_create.cql
-/// $ export KEA_TEST_CASSANDRA_WIPE=soft
-/// $ cd src/lib/dhcpsrv
-/// $ make -j9
-/// $ tests/libdhcpsrv_unittests --gtest_filter=CqlLeaseMgrTest.*
-///
-/// @return true if soft-wipe is enabled, false otherwise
-bool softWipeEnabled();
-};
-};
-};
-
-#endif
index 6dfe25ce98157b00acdd09c191b079e639016899..f266ad2d39c1e218fd5dfc9856dfdae1e5e16104 100644 (file)
@@ -1,7 +1,7 @@
 SUBDIRS = .
 
 AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
-AM_CPPFLAGS += $(BOOST_INCLUDES)
+AM_CPPFLAGS += $(BOOST_INCLUDES) $(PGSQL_CPPFLAGS)
 
 AM_CXXFLAGS = $(KEA_CXXFLAGS)