|
@@ -33,6 +33,7 @@
|
|
#include <gtest/gtest.h>
|
|
#include <gtest/gtest.h>
|
|
|
|
|
|
#include <boost/scoped_ptr.hpp>
|
|
#include <boost/scoped_ptr.hpp>
|
|
|
|
+#include <boost/lexical_cast.hpp>
|
|
|
|
|
|
#include <cassert>
|
|
#include <cassert>
|
|
|
|
|
|
@@ -56,6 +57,16 @@ public:
|
|
virtual void cleanup() const {};
|
|
virtual void cleanup() const {};
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ZoneNode*
|
|
|
|
+getNode(isc::util::MemorySegment& mem_sgmt, const Name& name,
|
|
|
|
+ ZoneData* zone_data)
|
|
|
|
+{
|
|
|
|
+ ZoneNode* node = NULL;
|
|
|
|
+ zone_data->insertName(mem_sgmt, name, &node);
|
|
|
|
+ EXPECT_NE(static_cast<ZoneNode*>(NULL), node);
|
|
|
|
+ return (node);
|
|
|
|
+}
|
|
|
|
+
|
|
class ZoneDataUpdaterTest : public ::testing::TestWithParam<SegmentCreator*> {
|
|
class ZoneDataUpdaterTest : public ::testing::TestWithParam<SegmentCreator*> {
|
|
protected:
|
|
protected:
|
|
ZoneDataUpdaterTest() :
|
|
ZoneDataUpdaterTest() :
|
|
@@ -149,16 +160,6 @@ TEST_P(ZoneDataUpdaterTest, bothNull) {
|
|
ZoneDataUpdater::NullRRset);
|
|
ZoneDataUpdater::NullRRset);
|
|
}
|
|
}
|
|
|
|
|
|
-ZoneNode*
|
|
|
|
-getNode(isc::util::MemorySegment& mem_sgmt, const Name& name,
|
|
|
|
- ZoneData* zone_data)
|
|
|
|
-{
|
|
|
|
- ZoneNode* node = NULL;
|
|
|
|
- zone_data->insertName(mem_sgmt, name, &node);
|
|
|
|
- EXPECT_NE(static_cast<ZoneNode*>(NULL), node);
|
|
|
|
- return (node);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
TEST_P(ZoneDataUpdaterTest, zoneMinTTL) {
|
|
TEST_P(ZoneDataUpdaterTest, zoneMinTTL) {
|
|
// If we add SOA, zone's min TTL will be updated.
|
|
// If we add SOA, zone's min TTL will be updated.
|
|
updater_->add(textToRRset(
|
|
updater_->add(textToRRset(
|
|
@@ -286,4 +287,29 @@ TEST_P(ZoneDataUpdaterTest, rrsigForNSEC3Only) {
|
|
isc::NotImplemented);
|
|
isc::NotImplemented);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// Generate many small RRsets. This tests that the underlying memory segment
|
|
|
|
+// can grow during the execution and that the updater handles that well.
|
|
|
|
+//
|
|
|
|
+// Some of the grows will happen inserting the RRSIG, some with the TXT.
|
|
|
|
+TEST_P(ZoneDataUpdaterTest, manySmallRRsets) {
|
|
|
|
+ for (size_t i = 0; i < 32768; ++i) {
|
|
|
|
+ const std::string name(boost::lexical_cast<std::string>(i) +
|
|
|
|
+ ".example.org.");
|
|
|
|
+ updater_->add(textToRRset(name + " 3600 IN TXT " +
|
|
|
|
+ std::string(30, 'X')),
|
|
|
|
+ textToRRset(name + " 3600 IN RRSIG TXT 5 3 3600 "
|
|
|
|
+ "20150420235959 20051021000000 1 "
|
|
|
|
+ "example.org. FAKE"));
|
|
|
|
+ ZoneNode* node = getNode(*mem_sgmt_,
|
|
|
|
+ Name(boost::lexical_cast<std::string>(i) +
|
|
|
|
+ ".example.org"), zone_data_);
|
|
|
|
+ const RdataSet* rdset = node->getData();
|
|
|
|
+ ASSERT_NE(static_cast<RdataSet*>(NULL), rdset);
|
|
|
|
+ rdset = RdataSet::find(rdset, RRType::TXT(), true);
|
|
|
|
+ ASSERT_NE(static_cast<RdataSet*>(NULL), rdset);
|
|
|
|
+ EXPECT_EQ(1, rdset->getRdataCount());
|
|
|
|
+ EXPECT_EQ(1, rdset->getSigRdataCount());
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
}
|
|
}
|