BIND 10 #1976: use meta-or-container-of data source in b10-auth
BIND 10 Development
do-not-reply at isc.org
Tue Jul 24 07:46:44 UTC 2012
#1976: use meta-or-container-of data source in b10-auth
-------------------------------------+-------------------------------------
Reporter: | Owner: vorner
jinmei | Status: reviewing
Type: task | Milestone:
Priority: | Sprint-20120731
medium | Resolution:
Component: | Sensitive: 0
b10-auth | Sub-Project: DNS
Keywords: | Estimated Difficulty: 8
Defect Severity: N/A | Total Hours: 0
Feature Depending on Ticket: |
Add Hours to Ticket: 0 |
Internal?: 0 |
-------------------------------------+-------------------------------------
Changes (by muks):
* owner: muks => vorner
Comment:
Hi vorner
Replying to [comment:14 vorner]:
> > * In `ListTest.reloadMasterFile`, currently the code modifies the zone
in memory and reloads the master file to see if it was reset to the old
data. Can you add a test that modifies the master file instead and checks
if it shows up after the reload?
>
> Such test would be possible, but not as simple. Would it test anything
extra to what we test now?
I'll leave it to your judgement, but the correct test would check that
updates to the file show up. I don't mean anything complicated. Something
like this should be enough:
{{{
diff --git a/src/lib/datasrc/tests/client_list_unittest.cc
b/src/lib/datasrc/tests/client_list_unittest.cc
index 69bd586..d86f025 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,38 @@ 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.
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\t3600000\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);
}
diff --git a/src/lib/datasrc/tests/testdata/.gitignore
b/src/lib/datasrc/tests/testdata/.gitignore
index 58ea8cd..00f20da 100644
--- a/src/lib/datasrc/tests/testdata/.gitignore
+++ b/src/lib/datasrc/tests/testdata/.gitignore
@@ -1 +1,2 @@
/*.sqlite3.copied
+/root.zone.copied
}}}
The rest of the changes seem fine, and `make check` and lettuce pass
still. So please feel free to merge.
--
Ticket URL: <http://bind10.isc.org/ticket/1976#comment:15>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development
More information about the bind10-tickets
mailing list