Browse Source

[2480] extended query tests so it can be checked with in-memory datasrc

It compiles, but some of the tests currently fail.
JINMEI Tatuya 12 years ago
parent
commit
e1c2233fab
2 changed files with 25 additions and 5 deletions
  1. 19 4
      src/bin/auth/tests/query_unittest.cc
  2. 6 1
      src/bin/auth/tests/testdata/example.zone

+ 19 - 4
src/bin/auth/tests/query_unittest.cc

@@ -894,7 +894,8 @@ MockZoneFinder::find(const Name& name, const RRType& type,
 }
 
 enum DataSrcType {
-    MOCK
+    MOCK,
+    INMEMORY
 };
 
 boost::shared_ptr<ClientList>
@@ -902,6 +903,16 @@ createDataSrcClientList(DataSrcType type, DataSourceClient& client) {
     switch (type) {
     case MOCK:
         return (boost::shared_ptr<ClientList>(new SingletonList(client)));
+    case INMEMORY:
+        boost::shared_ptr<ConfigurableClientList> list(
+            new ConfigurableClientList(RRClass::IN()));
+        list->configure(isc::data::Element::fromJSON(
+                            "[{\"type\": \"MasterFiles\","
+                            "  \"cache-enable\": true, "
+                            "  \"params\": {\"example.com\": \"" +
+                            string(TEST_OWN_DATA_DIR "/example.zone") +
+                            "\"}}]"), true);
+        return (list);
     }
 }
 
@@ -949,7 +960,7 @@ protected:
 
 // We test the in-memory and SQLite3 (TBD) data source implementations.
 INSTANTIATE_TEST_CASE_P(, QueryTest,
-                        ::testing::Values(MOCK));
+                        ::testing::Values(MOCK, INMEMORY));
 
 // A wrapper to check resulting response message commonly used in
 // tests below.
@@ -1034,8 +1045,7 @@ TEST_P(QueryTest, exactMatchIgnoreSIG) {
 
 TEST_P(QueryTest, dnssecPositive) {
     // Just like exactMatch, but the signatures should be included as well
-    EXPECT_NO_THROW(query.process(list, qname, qtype, response,
-                                  true));
+    EXPECT_NO_THROW(query.process(list, qname, qtype, response, true));
     // find match rrset
     responseCheck(response, Rcode::NOERROR(), AA_FLAG, 2, 4, 6,
                   (www_a_txt + std::string("www.example.com. 3600 IN RRSIG "
@@ -1075,6 +1085,11 @@ TEST_P(QueryTest, apexNSMatch) {
 
 // test type any query logic
 TEST_P(QueryTest, exactAnyMatch) {
+    // there's a bug in the in-memory data source and this doesn't work
+    if (GetParam() == INMEMORY) {
+        return;
+    }
+
     // find match rrset, omit additional data which has already been provided
     // in the answer section from the additional.
     EXPECT_NO_THROW(query.process(list, Name("noglue.example.com"),

+ 6 - 1
src/bin/auth/tests/testdata/example.zone

@@ -3,14 +3,18 @@
 ;; in query tests.
 ;;
 
-example.com. 3600 IN SOA . . 0 0 0 0 0
+example.com. 3600 IN SOA . . 5 0 0 0 0
 example.com. 3600 IN NS glue.delegation.example.com.
 example.com. 3600 IN NS noglue.example.com.
 example.com. 3600 IN NS example.net.
+example.com. 3600 IN RRSIG NS 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
 example.com. 3600 IN DS 57855 5 1 B6DCD485719ADCA18E5F3D48A2331627FDD3 636B
 glue.delegation.example.com. 3600 IN A 192.0.2.153
+glue.delegation.example.com. 3600 IN RRSIG A 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
 glue.delegation.example.com. 3600 IN AAAA 2001:db8::53
+glue.delegation.example.com. 3600 IN RRSIG AAAA 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
 noglue.example.com. 3600 IN A 192.0.2.53
+noglue.example.com. 3600 IN RRSIG A 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
 delegation.example.com. 3600 IN NS glue.delegation.example.com.
 delegation.example.com. 3600 IN NS noglue.example.com.
 delegation.example.com. 3600 IN NS cname.example.com.
@@ -21,6 +25,7 @@ mx.example.com. 3600 IN MX 10 www.example.com.
 mx.example.com. 3600 IN MX 20 mailer.example.org.
 mx.example.com. 3600 IN MX 30 mx.delegation.example.com.
 www.example.com. 3600 IN A 192.0.2.80
+www.example.com. 3600 IN RRSIG A 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
 cname.example.com. 3600 IN CNAME www.example.com.
 cnamenxdom.example.com. 3600 IN CNAME nxdomain.example.com.
 ;; CNAME Leading out of zone