Commit 68e816a1 authored by Michal Vaner's avatar Michal Vaner

More ideas for tests ‒ zone without nameservers

That one is unreachable for sure.

git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac408@3525 e5f2f494-b856-4b98-b285-d166d9295462
parent ae929263
......@@ -88,7 +88,9 @@ protected:
NameserverAddressStoreTest() :
authority_(new RRset(Name("example.net."), RRClass::IN(), RRType::NS(),
RRTTL(128)))
RRTTL(128))),
empty_authority_(new RRset(Name("example.net."), RRClass::IN(),
RRType::NS(), RRTTL(128)))
{
// Constructor - initialize a set of nameserver and zone objects. For convenience,
// these are stored in vectors.
......@@ -113,7 +115,7 @@ protected:
std::vector<boost::shared_ptr<NameserverEntry> > nameservers_;
std::vector<boost::shared_ptr<ZoneEntry> > zones_;
RRsetPtr authority_;
RRsetPtr authority_, empty_authority_;
class TestResolver : public ResolverInterface {
public:
......@@ -277,6 +279,23 @@ TEST_F(NameserverAddressStoreTest, emptyLookup) {
}
}
/**
* \short Try looking up a zone that does not have any nameservers.
*
* It should not ask anything and say it is unreachable right away.
*/
TEST_F(NameserverAddressStoreTest, zoneWithoutNameservers) {
DerivedNsas nsas(defaultTestResolver, 10, 10);
// Ask it a question
nsas.lookup("example.net.", RRClass::IN().getCode(), *empty_authority_,
vector<AbstractRRset>(), getCallback());
// There should be no questions, because there's nothing to ask
EXPECT_EQ(0, defaultTestResolver.requests.size());
// And there should be one „unreachable“ answer for the query
ASSERT_EQ(1, NSASCallback::results.size());
EXPECT_FALSE(NSASCallback::results[0].first);
}
/// \short Test invalid authority section.
TEST_F(NameserverAddressStoreTest, invalidAuthority) {
DerivedNsas nsas(defaultTestResolver, 2, 2);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment