BIND 10 trac1976-cont-3, updated. 3359259cabddd159f85f6c9d16fbc261fb94ceda [1976] Make the reload test more realistic
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Jul 24 08:56:18 UTC 2012
The branch, trac1976-cont-3 has been updated
via 3359259cabddd159f85f6c9d16fbc261fb94ceda (commit)
from 9c128152d15049af019ad58e20be23810b518141 (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 3359259cabddd159f85f6c9d16fbc261fb94ceda
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Tue Jul 24 10:51:30 2012 +0200
[1976] Make the reload test more realistic
We change the file, not the memory content.
-----------------------------------------------------------------------
Summary of changes:
src/lib/datasrc/tests/client_list_unittest.cc | 31 ++++++++++++++-----------
1 file changed, 18 insertions(+), 13 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/tests/client_list_unittest.cc b/src/lib/datasrc/tests/client_list_unittest.cc
index 69bd586..7e553b9 100644
--- a/src/lib/datasrc/tests/client_list_unittest.cc
+++ b/src/lib/datasrc/tests/client_list_unittest.cc
@@ -25,6 +25,7 @@
#include <gtest/gtest.h>
#include <set>
+#include <fstream>
using namespace isc::datasrc;
using namespace isc::data;
@@ -887,32 +888,36 @@ TEST_F(ListTest, reloadNullIterator) {
// Test we can reload the master files too (special-cased)
TEST_F(ListTest, reloadMasterFile) {
+ const char* const install_cmd = INSTALL_PROG " -c " TEST_DATA_DIR
+ "/root.zone " TEST_DATA_BUILDDIR "/root.zone.copied";
+ if (system(install_cmd) != 0) {
+ // any exception will do, this is failure in test setup, but
+ // nice to show the command that fails, and shouldn't be caught
+ isc_throw(isc::Exception,
+ "Error setting up; command failed: " << install_cmd);
+ }
+
const ConstElementPtr elem(Element::fromJSON("["
"{"
" \"type\": \"MasterFiles\","
" \"cache-enable\": true,"
" \"params\": {"
- " \".\": \"" TEST_DATA_DIR "/root.zone\""
+ " \".\": \"" TEST_DATA_BUILDDIR "/root.zone.copied\""
" }"
"}]"));
list_->configure(elem, true);
- // Add an element there so it differs from the one in file.
+ // Add a record that is not in the zone
EXPECT_EQ(ZoneFinder::NXDOMAIN,
list_->find(Name(".")).finder_->find(Name("nosuchdomain"),
RRType::TXT())->code);
- RRsetPtr txt(new RRset(Name("nosuchdomain"), RRClass::IN(), RRType::TXT(),
- RRTTL(3600)));
- txt->addRdata(rdata::generic::TXT("test"));
- dynamic_pointer_cast<InMemoryZoneFinder>(list_->find(Name(".")).finder_)->
- add(txt);
- // It is here now.
- EXPECT_EQ(ZoneFinder::SUCCESS,
- list_->find(Name(".")).finder_->find(Name("nosuchdomain"),
- RRType::TXT())->code);
+ ofstream f;
+ f.open(TEST_DATA_BUILDDIR "/root.zone.copied", ios::out | ios::app);
+ f << "nosuchdomain.\t\t3600\tIN\tTXT\ttest" << std::endl;
+ f.close();
// Do the reload.
EXPECT_EQ(ConfigurableClientList::ZONE_RELOADED, list_->reload(Name(".")));
- // And our TXT record disappeared again, as it is not in the file.
- EXPECT_EQ(ZoneFinder::NXDOMAIN,
+ // It is here now.
+ EXPECT_EQ(ZoneFinder::SUCCESS,
list_->find(Name(".")).finder_->find(Name("nosuchdomain"),
RRType::TXT())->code);
}
More information about the bind10-changes
mailing list