BIND 10 master, updated. bc67fb7ccb6d655fd46272c1dfd89a0e58677035 [1779] update comment for increased sleep time
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Mar 14 16:51:54 UTC 2012
The branch, master has been updated
via bc67fb7ccb6d655fd46272c1dfd89a0e58677035 (commit)
via 113f736e002db510897feb1e6e55600d622f9d26 (commit)
from b35f3264ece9358619c3831aa6fe6bf74a14c8c9 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit bc67fb7ccb6d655fd46272c1dfd89a0e58677035
Author: Jelte Jansen <jelte at isc.org>
Date: Wed Mar 14 17:51:17 2012 +0100
[1779] update comment for increased sleep time
commit 113f736e002db510897feb1e6e55600d622f9d26
Author: Jelte Jansen <jelte at isc.org>
Date: Wed Mar 14 17:11:40 2012 +0100
[1779] improve TTL tests
take potential second boundary into account
also fixed a few long lines
-----------------------------------------------------------------------
Summary of changes:
src/lib/cache/tests/negative_cache_unittest.cc | 52 ++++++++++++++++-------
1 files changed, 36 insertions(+), 16 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/cache/tests/negative_cache_unittest.cc b/src/lib/cache/tests/negative_cache_unittest.cc
index 56d777d..4935e4a 100644
--- a/src/lib/cache/tests/negative_cache_unittest.cc
+++ b/src/lib/cache/tests/negative_cache_unittest.cc
@@ -52,14 +52,17 @@ TEST_F(NegativeCacheTest, testNXDOMAIN){
msg_nxdomain.makeResponse();
Name non_exist_qname("nonexist.example.com.");
- EXPECT_TRUE(cache->lookup(non_exist_qname, RRType::A(), RRClass::IN(), msg_nxdomain));
+ EXPECT_TRUE(cache->lookup(non_exist_qname, RRType::A(), RRClass::IN(),
+ msg_nxdomain));
RRsetIterator iter = msg_nxdomain.beginSection(Message::SECTION_AUTHORITY);
RRsetPtr rrset_ptr = *iter;
// The TTL should equal to the TTL of SOA record
const RRTTL& nxdomain_ttl1 = rrset_ptr->getTTL();
- EXPECT_EQ(nxdomain_ttl1.getValue(), 86400);
+ // May have already crossed seconds boundary
+ EXPECT_GE(nxdomain_ttl1.getValue(), 86399);
+ EXPECT_LE(nxdomain_ttl1.getValue(), 86400);
// SOA response for example.com
Message msg_example_com_soa(Message::PARSE);
@@ -68,16 +71,22 @@ TEST_F(NegativeCacheTest, testNXDOMAIN){
msg_example_com_soa.makeResponse();
Name soa_qname("example.com.");
- EXPECT_TRUE(cache->lookup(soa_qname, RRType::SOA(), RRClass::IN(), msg_example_com_soa));
+ EXPECT_TRUE(cache->lookup(soa_qname, RRType::SOA(), RRClass::IN(),
+ msg_example_com_soa));
iter = msg_example_com_soa.beginSection(Message::SECTION_ANSWER);
rrset_ptr = *iter;
// The TTL should equal to the TTL of SOA record in answer section
const RRTTL& soa_ttl = rrset_ptr->getTTL();
- EXPECT_EQ(soa_ttl.getValue(), 172800);
+ // May have already crossed seconds boundary
+ EXPECT_GE(soa_ttl.getValue(), 172799);
+ EXPECT_LE(soa_ttl.getValue(), 172800);
- sleep(1);
+ // Sleep for 2 seconds. 2 seconds to make sure the final range check
+ // does not overlap with the original ones (in which case this test
+ // would erroneously pass if the ttl value is not changed)
+ sleep(2);
// Query nonexist.example.com again
Message msg_nxdomain2(Message::PARSE);
@@ -90,7 +99,8 @@ TEST_F(NegativeCacheTest, testNXDOMAIN){
// The TTL should equal to the TTL of negative response SOA record
const RRTTL& nxdomain_ttl2 = rrset_ptr->getTTL();
- EXPECT_TRUE(86398 <= nxdomain_ttl2.getValue() && nxdomain_ttl2.getValue() <= 86399);
+ EXPECT_GE(nxdomain_ttl2.getValue(), 86397);
+ EXPECT_LE(nxdomain_ttl2.getValue(), 86398);
// No RRset in ANSWER section
EXPECT_TRUE(msg_nxdomain2.getRRCount(Message::SECTION_ANSWER) == 0);
// Check that only one SOA record exist in AUTHORITY section
@@ -103,13 +113,15 @@ TEST_F(NegativeCacheTest, testNXDOMAIN){
Message msg_example_com_soa2(Message::PARSE);
messageFromFile(msg_example_com_soa2, "message_example_com_soa.wire");
msg_example_com_soa2.makeResponse();
- EXPECT_TRUE(cache->lookup(soa_qname, RRType::SOA(), RRClass::IN(), msg_example_com_soa2));
+ EXPECT_TRUE(cache->lookup(soa_qname, RRType::SOA(), RRClass::IN(),
+ msg_example_com_soa2));
iter = msg_example_com_soa2.beginSection(Message::SECTION_ANSWER);
rrset_ptr = *iter;
const RRTTL& soa_ttl2 = rrset_ptr->getTTL();
// The TTL should equal to the TTL of SOA record in answer section
- EXPECT_TRUE(172798 <= soa_ttl2.getValue() && soa_ttl2.getValue() <= 172799);
+ EXPECT_GE(soa_ttl2.getValue(), 172797);
+ EXPECT_LE(soa_ttl2.getValue(), 172798);
}
TEST_F(NegativeCacheTest, testNXDOMAINWithoutSOA){
@@ -166,15 +178,16 @@ TEST_F(NegativeCacheTest, testNoerrorNodata){
msg_nodata.makeResponse();
Name example_dot_com("example.com.");
- EXPECT_TRUE(cache->lookup(example_dot_com, RRType::MX(), RRClass::IN(), msg_nodata));
+ EXPECT_TRUE(cache->lookup(example_dot_com, RRType::MX(), RRClass::IN(),
+ msg_nodata));
RRsetIterator iter = msg_nodata.beginSection(Message::SECTION_AUTHORITY);
RRsetPtr rrset_ptr = *iter;
// The TTL should equal to the TTL of SOA record
const RRTTL& nodata_ttl1 = rrset_ptr->getTTL();
- EXPECT_EQ(nodata_ttl1.getValue(), 86400);
-
+ EXPECT_GE(nodata_ttl1.getValue(), 86399);
+ EXPECT_LE(nodata_ttl1.getValue(), 86400);
// Normal SOA response for example.com
Message msg_example_com_soa(Message::PARSE);
@@ -183,21 +196,26 @@ TEST_F(NegativeCacheTest, testNoerrorNodata){
msg_example_com_soa.makeResponse();
Name soa_qname("example.com.");
- EXPECT_TRUE(cache->lookup(soa_qname, RRType::SOA(), RRClass::IN(), msg_example_com_soa));
+ EXPECT_TRUE(cache->lookup(soa_qname, RRType::SOA(), RRClass::IN(),
+ msg_example_com_soa));
iter = msg_example_com_soa.beginSection(Message::SECTION_ANSWER);
rrset_ptr = *iter;
// The TTL should equal to the TTL of SOA record in answer section
const RRTTL& soa_ttl = rrset_ptr->getTTL();
- EXPECT_EQ(soa_ttl.getValue(), 172800);
+ EXPECT_GE(soa_ttl.getValue(), 172799);
+ EXPECT_LE(soa_ttl.getValue(), 172800);
// Query MX record of example.com again
Message msg_nodata2(Message::PARSE);
messageFromFile(msg_nodata2, "message_nodata_with_soa.wire");
msg_nodata2.makeResponse();
- sleep(1);
+ // Sleep for 2 seconds. 2 seconds to make sure the final range check
+ // does not overlap with the original ones (in which case this test
+ // would erroneously pass if the ttl value is not changed)
+ sleep(2);
EXPECT_TRUE(cache->lookup(example_dot_com, RRType::MX(), RRClass::IN(), msg_nodata2));
@@ -209,9 +227,11 @@ TEST_F(NegativeCacheTest, testNoerrorNodata){
iter = msg_nodata2.beginSection(Message::SECTION_AUTHORITY);
rrset_ptr = *iter;
- // The TTL should equal to the TTL of negative response SOA record and counted down
+ // The TTL should equal to the TTL of negative response SOA record
+ // and counted down
const RRTTL& nodata_ttl2 = rrset_ptr->getTTL();
- EXPECT_TRUE(86398 <= nodata_ttl2.getValue() && nodata_ttl2.getValue() <= 86399);
+ EXPECT_GE(nodata_ttl2.getValue(), 86397);
+ EXPECT_LE(nodata_ttl2.getValue(), 86398);
}
TEST_F(NegativeCacheTest, testReferralResponse){
More information about the bind10-changes
mailing list