[svn] commit: r3526 - /branches/trac408/src/lib/nsas/tests/nameserver_address_store_unittest.cc
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon Nov 15 19:39:21 UTC 2010
Author: vorner
Date: Mon Nov 15 19:39:18 2010
New Revision: 3526
Log:
Another test
Zone with unreachable nameserver
Modified:
branches/trac408/src/lib/nsas/tests/nameserver_address_store_unittest.cc
Modified: branches/trac408/src/lib/nsas/tests/nameserver_address_store_unittest.cc
==============================================================================
--- branches/trac408/src/lib/nsas/tests/nameserver_address_store_unittest.cc (original)
+++ branches/trac408/src/lib/nsas/tests/nameserver_address_store_unittest.cc Mon Nov 15 19:39:18 2010
@@ -296,6 +296,48 @@
EXPECT_FALSE(NSASCallback::results[0].first);
}
+/**
+ * \short Try looking up a zone that has only an unreachable nameserver.
+ *
+ * It should be unreachable. Furthermore, subsequent questions for that zone
+ * or other zone with the same nameserver should be unreachable right away,
+ * without further asking.
+ */
+TEST_F(NameserverAddressStoreTest, unreachableNS) {
+ DerivedNsas nsas(defaultTestResolver, 10, 10);
+ // Ask it a question
+ nsas.lookup("example.net.", RRClass::IN().getCode(), *authority_,
+ vector<AbstractRRset>(), getCallback());
+ // It should ask for IP addresses for example.com.
+ ASSERT_EQ(2, defaultTestResolver.requests.size());
+ asksIPs(Name("example.com."), 0, 1);
+
+ // Ask another question with different zone but the same nameserver
+ authority_->setName(Name("example.com."));
+ nsas.lookup("example.com.", RRClass::IN().getCode(), *authority_,
+ vector<AbstractRRset>(), getCallback());
+ // It should ask nothing more now
+ EXPECT_EQ(2, defaultTestResolver.requests.size());
+
+ // We say there are no addresses
+ defaultTestResolver.requests[0].second->failure();
+ defaultTestResolver.requests[1].second->failure();
+
+ // We should have 2 answers now
+ EXPECT_EQ(2, NSASCallback::results.size());
+ // When we ask one same and one other zone with the same nameserver,
+ // it should generate no questions and answer right away
+ nsas.lookup("example.net.", RRClass::IN().getCode(), *authority_,
+ vector<AbstractRRset>(), getCallback());
+ nsas.lookup("example.org.", RRClass::IN().getCode(), *authority_,
+ vector<AbstractRRset>(), getCallback());
+ // There should be 4 negative answers now
+ EXPECT_EQ(4, NSASCallback::results.size());
+ BOOST_FOREACH(const NSASCallback::Result& result, NSASCallback::results) {
+ EXPECT_FALSE(result.first);
+ }
+}
+
/// \short Test invalid authority section.
TEST_F(NameserverAddressStoreTest, invalidAuthority) {
DerivedNsas nsas(defaultTestResolver, 2, 2);
More information about the bind10-changes
mailing list