[svn] commit: r3945 - /branches/trac439/src/bin/auth/tests/auth_srv_unittest.cc

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Dec 22 05:20:00 UTC 2010


Author: chenzhengzhang
Date: Wed Dec 22 05:19:59 2010
New Revision: 3945

Log:
fix a unittest issue

Modified:
    branches/trac439/src/bin/auth/tests/auth_srv_unittest.cc

Modified: branches/trac439/src/bin/auth/tests/auth_srv_unittest.cc
==============================================================================
--- branches/trac439/src/bin/auth/tests/auth_srv_unittest.cc (original)
+++ branches/trac439/src/bin/auth/tests/auth_srv_unittest.cc Wed Dec 22 05:19:59 2010
@@ -47,11 +47,14 @@
 
 namespace {
 const char* const CONFIG_TESTDB =
-    "{\"database_file\": \"" TEST_DATA_DIR "/example.sqlite3\"}";
+    "{\"database_file\": \"" TEST_DATA_DIR "/example.sqlite3\", \"use_memory_datasrc\": false}";
+
+const char* const MEMORY_CONFIG_TESTDB =
+    "{\"database_file\": \"" TEST_DATA_DIR "/example.sqlite3\", \"use_memory_datasrc\": true}";
 // The following file must be non existent and must be non"creatable" (see
 // the sqlite3 test).
 const char* const BADCONFIG_TESTDB =
-    "{ \"database_file\": \"" TEST_DATA_DIR "/nodir/notexist\"}";
+    "{ \"database_file\": \"" TEST_DATA_DIR "/nodir/notexist\", \"use_memory_datasrc\": false}";
 const char* const DEFAULT_REMOTE_ADDRESS = "192.0.2.1";
 
 class AuthSrvTest : public ::testing::Test {
@@ -758,6 +761,18 @@
                 QR_FLAG | AA_FLAG, 1, 1, 1, 0);
 }
 
+TEST_F(AuthSrvTest, useMemoryDataSrc) {
+    // First, load a memory data source.
+    updateConfig(&server, MEMORY_CONFIG_TESTDB, true);
+
+    // The memory data source is empty, should return SERVFAIL rcode.
+    createDataFromFile("examplequery_fromWire.wire");
+    EXPECT_TRUE(server.processMessage(*io_message, parse_message,
+                                      response_renderer));
+    headerCheck(parse_message, default_qid, Rcode::SERVFAIL(), opcode.getCode(),
+                QR_FLAG | AA_FLAG, 1, 0, 0, 0);
+}
+
 TEST_F(AuthSrvTest, cacheSlots) {
     // simple check for the get/set operations
     server.setCacheSlots(10);    // 10 = arbitrary choice




More information about the bind10-changes mailing list