From 44ccccc97fc33f0182d9695c1531b055f467c2f8 Mon Sep 17 00:00:00 2001 From: Marcin Siodelski Date: Thu, 3 Nov 2016 09:17:53 +0100 Subject: [PATCH] [5029] Implemented test for multi stage boot for Cassandra. --- src/bin/dhcp4/tests/dora_unittest.cc | 58 ++++++++++++++++++++++++++-- 1 file changed, 55 insertions(+), 3 deletions(-) diff --git a/src/bin/dhcp4/tests/dora_unittest.cc b/src/bin/dhcp4/tests/dora_unittest.cc index 223a471ebc..4719629ceb 100644 --- a/src/bin/dhcp4/tests/dora_unittest.cc +++ b/src/bin/dhcp4/tests/dora_unittest.cc @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -91,6 +92,9 @@ namespace { /// - Simple configuration with a single subnet and single pool /// - Using PostgreSQL lease database backend to store leases /// +/// - Configuration 9: +/// - Simple configuration with a single subnet and single pool +/// - Using Cassandra lease database backend to store leases const char* DORA_CONFIGS[] = { // Configuration 0 "{ \"interfaces-config\": {" @@ -309,6 +313,24 @@ const char* DORA_CONFIGS[] = { " \"id\": 1," " \"pools\": [ { \"pool\": \"10.0.0.10-10.0.0.100\" } ]" " } ]" + "}", + +// Configuration 9 + "{ \"interfaces-config\": {" + " \"interfaces\": [ \"*\" ]" + "}," + "\"lease-database\": {" + " \"type\": \"cql\"," + " \"name\": \"keatest\"," + " \"user\": \"keatest\"," + " \"password\": \"keatest\"" + "}," + "\"valid-lifetime\": 600," + "\"subnet4\": [ { " + " \"subnet\": \"10.0.0.0/24\", " + " \"id\": 1," + " \"pools\": [ { \"pool\": \"10.0.0.10-10.0.0.100\" } ]" + " } ]" "}" }; @@ -1557,12 +1579,12 @@ TEST_F(DORAMySQLTest, multiStageBoot) { // --with-dhcp-pgsql. #ifdef HAVE_PGSQL -/// @brief Test fixture class for the test utilizing MySQL database backend. +/// @brief Test fixture class for the test utilizing PostgreSQL database backend. class DORAPgSQLTest : public DORATest { public: /// @brief Constructor. /// - /// Recreats MySQL schema for a test. + /// Recreates PgSQL schema for a test. DORAPgSQLTest() : DORATest() { destroyPgSQLSchema(); createPgSQLSchema(); @@ -1570,7 +1592,7 @@ public: /// @brief Destructor. /// - /// Destroys MySQL schema. + /// Destroys PgSQL schema. virtual ~DORAPgSQLTest() { destroyPgSQLSchema(); } @@ -1585,4 +1607,34 @@ TEST_F(DORAPgSQLTest, multiStageBoot) { #endif +#ifdef HAVE_CQL + +/// @brief Test fixture class for the test utilizing Cassandra database backend. +class DORACQLTest : public DORATest { +public: + /// @brief Constructor. + /// + /// Recreates CQL schema for a test. + DORACQLTest() : DORATest() { + destroyCqlSchema(false, true); + createCqlSchema(false, true); + } + + /// @brief Destructor. + /// + /// Destroys CQL schema. + virtual ~DORACQLTest() { + destroyCqlSchema(false, true); + } +}; + +// Test that the client using the same hardware address but multiple +// client identifiers will obtain multiple leases (CQL lease database). +TEST_F(DORACQLTest, multiStageBoot) { + // DORA_CONFIGS[9] to be used for server configuration. + testMultiStageBoot(9); +} + +#endif + } // end of anonymous namespace -- 2.47.3