]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Unit test for empty lookup/list result
authorAki Tuomi <cmouse@desteem.org>
Sat, 26 Oct 2013 19:21:07 +0000 (22:21 +0300)
committerPeter van Dijk <peter.van.dijk@netherlabs.nl>
Fri, 22 Nov 2013 12:47:21 +0000 (13:47 +0100)
modules/remotebackend/test-remotebackend.cc
modules/remotebackend/unittest.rb

index 28427c8a6ff8e8d78498247bc42cc55ddeb6a883..061cd4632be1f3f9ec1109bfe5257668284788e1 100644 (file)
@@ -39,6 +39,14 @@ BOOST_AUTO_TEST_CASE(test_method_lookup) {
    BOOST_CHECK_EQUAL(rr.ttl, 300);
 }
 
+BOOST_AUTO_TEST_CASE(test_method_lookup_empty) {
+   BOOST_TEST_MESSAGE("Testing lookup method with empty result");
+   DNSResourceRecord rr;
+   be->lookup(QType(QType::SOA), "empty.unit.test");
+   // then try to get()
+   BOOST_CHECK(!be->get(rr)); // and this should be FALSE
+}
+
 BOOST_AUTO_TEST_CASE(test_method_list) {
    int record_count = 0;
    DNSResourceRecord rr;
index 69ae27fe83f6a78591cbb2d9b5ea95a08d51914c..ed38146af5a2b801a2ef16bb74c2fccfc938f515 100644 (file)
@@ -16,7 +16,8 @@ $domain = {
   },
   "ns2.unit.test" => {
        "A" => ["10.0.0.2"]
-  }
+  }, 
+  "empty.unit.test" => {}
 }
 
 $meta = {}
@@ -50,7 +51,7 @@ class Handler
          end
        end
      end
-     [false] unless ret.size>0
+     [false] unless ret.size>0 and args["qname"] != "empty.unit.test"
      [ret]
    end