Browse Source

[5029] Implemented test for multi stage boot for Cassandra.

Marcin Siodelski 8 years ago
parent
commit
44ccccc97f
1 changed files with 55 additions and 3 deletions
  1. 55 3
      src/bin/dhcp4/tests/dora_unittest.cc

+ 55 - 3
src/bin/dhcp4/tests/dora_unittest.cc

@@ -13,6 +13,7 @@
 #include <dhcpsrv/host.h>
 #include <dhcpsrv/host.h>
 #include <dhcpsrv/host_mgr.h>
 #include <dhcpsrv/host_mgr.h>
 #include <dhcpsrv/subnet_id.h>
 #include <dhcpsrv/subnet_id.h>
+#include <dhcpsrv/testutils/cql_schema.h>
 #include <dhcpsrv/testutils/mysql_schema.h>
 #include <dhcpsrv/testutils/mysql_schema.h>
 #include <dhcpsrv/testutils/pgsql_schema.h>
 #include <dhcpsrv/testutils/pgsql_schema.h>
 #include <dhcp4/tests/dhcp4_test_utils.h>
 #include <dhcp4/tests/dhcp4_test_utils.h>
@@ -91,6 +92,9 @@ namespace {
 ///   - Simple configuration with a single subnet and single pool
 ///   - Simple configuration with a single subnet and single pool
 ///   - Using PostgreSQL lease database backend to store leases
 ///   - 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[] = {
 const char* DORA_CONFIGS[] = {
 // Configuration 0
 // Configuration 0
     "{ \"interfaces-config\": {"
     "{ \"interfaces-config\": {"
@@ -309,6 +313,24 @@ const char* DORA_CONFIGS[] = {
         "    \"id\": 1,"
         "    \"id\": 1,"
         "    \"pools\": [ { \"pool\": \"10.0.0.10-10.0.0.100\" } ]"
         "    \"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.
 // --with-dhcp-pgsql.
 #ifdef HAVE_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 {
 class DORAPgSQLTest : public DORATest {
 public:
 public:
     /// @brief Constructor.
     /// @brief Constructor.
     ///
     ///
-    /// Recreats MySQL schema for a test.
+    /// Recreates PgSQL schema for a test.
     DORAPgSQLTest() : DORATest() {
     DORAPgSQLTest() : DORATest() {
         destroyPgSQLSchema();
         destroyPgSQLSchema();
         createPgSQLSchema();
         createPgSQLSchema();
@@ -1570,7 +1592,7 @@ public:
 
 
     /// @brief Destructor.
     /// @brief Destructor.
     ///
     ///
-    /// Destroys MySQL schema.
+    /// Destroys PgSQL schema.
     virtual ~DORAPgSQLTest() {
     virtual ~DORAPgSQLTest() {
         destroyPgSQLSchema();
         destroyPgSQLSchema();
     }
     }
@@ -1585,4 +1607,34 @@ TEST_F(DORAPgSQLTest, multiStageBoot) {
 
 
 #endif
 #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
 } // end of anonymous namespace