mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-02 15:05:16 +00:00
[2377] Make incremental loading work
This commit is contained in:
@@ -60,6 +60,7 @@ public:
|
|||||||
bool loadIncremental(size_t count_limit) {
|
bool loadIncremental(size_t count_limit) {
|
||||||
if (!initialized_) {
|
if (!initialized_) {
|
||||||
pushSource(master_file_);
|
pushSource(master_file_);
|
||||||
|
initialized_ = true;
|
||||||
}
|
}
|
||||||
size_t count = 0;
|
size_t count = 0;
|
||||||
while (ok_ && count < count_limit) {
|
while (ok_ && count < count_limit) {
|
||||||
|
@@ -111,6 +111,32 @@ TEST_F(MasterLoaderTest, basicLoad) {
|
|||||||
checkRR("www.example.org", RRType::A(), "192.0.2.1");
|
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
|
// Try loading from file that doesn't exist. There should be single error
|
||||||
// saying so.
|
// saying so.
|
||||||
TEST_F(MasterLoaderTest, invalidFile) {
|
TEST_F(MasterLoaderTest, invalidFile) {
|
||||||
|
Reference in New Issue
Block a user