2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-31 05:55:28 +00:00

[2377] Make incremental loading work

This commit is contained in:
Michal 'vorner' Vaner
2012-12-03 13:17:30 +01:00
parent cbffb4ac5b
commit 24c515276e
2 changed files with 27 additions and 0 deletions

View File

@@ -60,6 +60,7 @@ public:
bool loadIncremental(size_t count_limit) {
if (!initialized_) {
pushSource(master_file_);
initialized_ = true;
}
size_t count = 0;
while (ok_ && count < count_limit) {

View File

@@ -111,6 +111,32 @@ TEST_F(MasterLoaderTest, basicLoad) {
checkRR("www.example.org", RRType::A(), "192.0.2.1");
}
// Try loading data incrementally.
TEST_F(MasterLoaderTest, incrementalLoad) {
setLoader("example.org", Name("example.org."), RRClass::IN(),
MasterLoader::MANY_ERRORS);
EXPECT_FALSE(loader_->loadIncremental(2));
EXPECT_TRUE(errors_.empty());
EXPECT_TRUE(warnings_.empty());
checkRR("example.org", RRType::SOA(), "ns1.example.org. admin.example.org. "
"1234 3600 1800 2419200 7200");
checkRR("example.org", RRType::NS(), "ns1.example.org.");
// The third one is not loaded yet
EXPECT_TRUE(rrsets_.empty());
// Load the rest.
EXPECT_TRUE(loader_->loadIncremental(20));
EXPECT_TRUE(errors_.empty());
EXPECT_TRUE(warnings_.empty());
checkRR("www.example.org", RRType::A(), "192.0.2.1");
}
// Try loading from file that doesn't exist. There should be single error
// saying so.
TEST_F(MasterLoaderTest, invalidFile) {