Browse Source

[trac505] Catch a bug

Michal 'vorner' Vaner 14 years ago
parent
commit
cac61e9164
1 changed files with 21 additions and 3 deletions
  1. 21 3
      src/bin/auth/tests/query_unittest.cc

+ 21 - 3
src/bin/auth/tests/query_unittest.cc

@@ -79,6 +79,9 @@ const char* const dname_txt =
     "dname.example.com. 3600 IN DNAME dnametarget.example.com.\n";
     "dname.example.com. 3600 IN DNAME dnametarget.example.com.\n";
 const char* const dname_a_txt =
 const char* const dname_a_txt =
     "dname.example.com. 3600 IN A 192.0.2.5\n";
     "dname.example.com. 3600 IN A 192.0.2.5\n";
+// This is not inside the zone, this is created at runtime
+const char* const synthetized_cname_txt =
+    "www.dname.example.com. 3600 IN CNAME www.dnametarget.example.com.\n";
 // The rest of data won't be referenced from the test cases.
 // The rest of data won't be referenced from the test cases.
 const char* const other_zone_rrs =
 const char* const other_zone_rrs =
     "cnamemailer.example.com. 3600 IN CNAME www.example.com.\n"
     "cnamemailer.example.com. 3600 IN CNAME www.example.com.\n"
@@ -556,9 +559,24 @@ TEST_F(QueryTest, DNAME) {
         response).process();
         response).process();
 
 
     responseCheck(response, Rcode::NOERROR(), AA_FLAG, 2, 3, 3,
     responseCheck(response, Rcode::NOERROR(), AA_FLAG, 2, 3, 3,
-        (string(dname_txt) +
-        "www.dname.example.com. 3600 IN CNAME www.dnametarget.example.com.\n"
-        ).c_str(), zone_ns_txt, ns_addrs_txt);
+        (string(dname_txt) + synthetized_cname_txt).c_str(),
+        zone_ns_txt, ns_addrs_txt);
+}
+
+/*
+ * Ask an ANY query below a DNAME. Should return the DNAME and synthetized
+ * CNAME.
+ *
+ * This is added because the original version didn't include the CNAME at
+ * all.
+ */
+TEST_F(QueryTest, DNAME_ANY) {
+    Query(memory_datasrc, Name("www.dname.example.com"), RRType::ANY(),
+        response).process();
+
+    responseCheck(response, Rcode::NOERROR(), AA_FLAG, 2, 3, 3,
+        (string(dname_txt) + synthetized_cname_txt).c_str(),
+        zone_ns_txt, ns_addrs_txt);
 }
 }
 
 
 // Test when we ask for DNAME explicitly, it does no synthetizing.
 // Test when we ask for DNAME explicitly, it does no synthetizing.