Browse Source

[trac626] added a similar test case: there's CNAME at zone apex.

The fixed (even pre-fixed) code alrady handles this case correctly.
JINMEI Tatuya 14 years ago
parent
commit
3487cf43d0
2 changed files with 23 additions and 1 deletions
  1. 9 0
      src/lib/datasrc/tests/datasrc_unittest.cc
  2. 14 1
      src/lib/datasrc/tests/test_datasrc.cc

+ 9 - 0
src/lib/datasrc/tests/datasrc_unittest.cc

@@ -1026,6 +1026,15 @@ TEST_F(DataSrcTest, noSOAZone) {
                  DataSourceError);
 }
 
+TEST_F(DataSrcTest, apexCNAMEZone) {
+    // The query name doesn't exist in the best matching zone,
+    // and there's a CNAME at the apex (which is bogus), so query handling
+    // will fail due to missing SOA.
+    EXPECT_THROW(createAndProcessQuery(Name("notexist.apexcname.example"),
+                                       RRClass::IN(), RRType::A()),
+                 DataSourceError);
+}
+
 // currently fails
 TEST_F(DataSrcTest, DISABLED_synthesizedCnameTooLong) {
     // qname has the possible max length (255 octets).  it matches a DNAME,

+ 14 - 1
src/lib/datasrc/tests/test_datasrc.cc

@@ -273,6 +273,18 @@ const struct RRData nosoa_example_records[] = {
 };
 
 //
+// zone data for apexcname.example.
+//
+const struct RRData apexcname_example_records[] = {
+    {"apexcname.example", "CNAME", "canonical.apexcname.example"},
+    {"canonical.apexcname.example", "SOA",
+     "master.apexcname.example "
+     "admin.apexcname.example. 1234 3600 1800 2419200 7200"},
+    {NULL, NULL, NULL}
+};
+
+
+//
 // empty data set, for convenience.
 //
 const struct RRData empty_records[] = {
@@ -288,7 +300,8 @@ const struct ZoneData zone_data[] = {
     { "loop.example", "IN", loop_example_records, empty_records },
     { "nons.example", "IN", nons_example_records, empty_records },
     { "nons-dname.example", "IN", nonsdname_example_records, empty_records },
-    { "nosoa.example", "IN", nosoa_example_records, empty_records }
+    { "nosoa.example", "IN", nosoa_example_records, empty_records },
+    { "apexcname.example", "IN", nosoa_example_records, empty_records }
 };
 const size_t NUM_ZONES = sizeof(zone_data) / sizeof(zone_data[0]);