BIND 10 trac2480-2, updated. 82041829bd8cc7400d0fee9d08e4cf1091c25a70 [2480] support in-memory datasrc for cases that require dynamic RR addition
BIND 10 source code commits
bind10-changes at lists.isc.org
Sat Dec 29 04:46:10 UTC 2012
The branch, trac2480-2 has been updated
via 82041829bd8cc7400d0fee9d08e4cf1091c25a70 (commit)
via baa1ddd9057d0f10f85faa67f92e94268189dcd1 (commit)
via 5379cabb61c3daff05c541ab6c9675a8a3ebfed7 (commit)
via 30cbe355d7fcccf3e06472e5fd04c9de870adbe6 (commit)
via 2629140f12accdfa6b4de4f59e5a76b0cc10ecb6 (commit)
from ea8082a263cb6d2b69764da2322b2c483913e5da (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 82041829bd8cc7400d0fee9d08e4cf1091c25a70
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Fri Dec 28 20:28:06 2012 -0800
[2480] support in-memory datasrc for cases that require dynamic RR addition
commit baa1ddd9057d0f10f85faa67f92e94268189dcd1
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Fri Dec 28 19:06:13 2012 -0800
[2480] added a note about the ";var" markup that is not strictly necessary.
commit 5379cabb61c3daff05c541ab6c9675a8a3ebfed7
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Fri Dec 28 19:02:08 2012 -0800
[2480] reorganized test data; define the source in a zone file format.
this will simplify the generation process and Makefile syntax.
commit 30cbe355d7fcccf3e06472e5fd04c9de870adbe6
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Fri Dec 28 15:40:30 2012 -0800
[2480] supported one other test case with sqlite3 data source
commit 2629140f12accdfa6b4de4f59e5a76b0cc10ecb6
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Fri Dec 28 15:07:31 2012 -0800
[2480] extracted some test cases that work only with mock datasrc separately.
so it won't report misleading success reports for other data sources.
-----------------------------------------------------------------------
Summary of changes:
configure.ac | 1 +
src/bin/auth/tests/Makefile.am | 19 +-
src/bin/auth/tests/gen-query-testdata.py | 28 +-
src/bin/auth/tests/query_unittest.cc | 336 +++++++++-----------
src/bin/auth/tests/testdata/Makefile.am | 4 +-
...ery_testzone_data.txt => example-base-inc.zone} | 250 ++++++++-------
src/bin/auth/tests/testdata/example-base.zone.in | 7 +
.../testdata/example-common-inc-template.zone | 5 +
...tzone_data_nsec3.txt => example-nsec3-inc.zone} | 18 +-
src/bin/auth/tests/testdata/example-nsec3.zone.in | 5 +-
10 files changed, 324 insertions(+), 349 deletions(-)
rename src/bin/auth/tests/testdata/{query_testzone_data.txt => example-base-inc.zone} (58%)
create mode 100644 src/bin/auth/tests/testdata/example-base.zone.in
create mode 100644 src/bin/auth/tests/testdata/example-common-inc-template.zone
rename src/bin/auth/tests/testdata/{query_testzone_data_nsec3.txt => example-nsec3-inc.zone} (65%)
-----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index 95f1b6f..f8a8d02 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1359,6 +1359,7 @@ AC_OUTPUT([doc/version.ent
src/bin/auth/auth.spec.pre
src/bin/auth/spec_config.h.pre
src/bin/auth/tests/testdata/example.zone
+ src/bin/auth/tests/testdata/example-base.zone
src/bin/auth/tests/testdata/example-nsec3.zone
src/bin/dhcp4/spec_config.h.pre
src/bin/dhcp6/spec_config.h.pre
diff --git a/src/bin/auth/tests/Makefile.am b/src/bin/auth/tests/Makefile.am
index c5e70b8..36a3c68 100644
--- a/src/bin/auth/tests/Makefile.am
+++ b/src/bin/auth/tests/Makefile.am
@@ -83,8 +83,7 @@ run_unittests_LDADD += $(SQLITE_LIBS)
# The following are definitions for auto-generating test data for query
# tests.
-BUILT_SOURCES = testdata/example-base.zone example_base_inc.cc
-BUILT_SOURCES += testdata/example-nsec3-inc.zone example_nsec3_inc.cc
+BUILT_SOURCES = example_base_inc.cc example_nsec3_inc.cc
BUILT_SOURCES += testdata/example-base.sqlite3
BUILT_SOURCES += testdata/example-nsec3.sqlite3
@@ -92,22 +91,26 @@ EXTRA_DIST = gen-query-testdata.py
CLEANFILES += example_base_inc.cc example_nsec3_inc.cc
-testdata/example-base.zone example_base_inc.cc: testdata/query_testzone_data.txt
+example_base_inc.cc: $(srcdir)/testdata/example-base-inc.zone
$(PYTHON) $(srcdir)/gen-query-testdata.py \
- $(srcdir)/testdata/query_testzone_data.txt \
- testdata/example-base.zone example_base_inc.cc
+ $(srcdir)/testdata/example-base-inc.zone example_base_inc.cc
-testdata/example-nsec3-inc.zone example_nsec3_inc.cc: testdata/query_testzone_data_nsec3.txt
+example_nsec3_inc.cc: $(srcdir)/testdata/example-nsec3-inc.zone
$(PYTHON) $(srcdir)/gen-query-testdata.py \
- $(srcdir)/testdata/query_testzone_data_nsec3.txt \
- testdata/example-nsec3-inc.zone example_nsec3_inc.cc
+ $(srcdir)/testdata/example-nsec3-inc.zone example_nsec3_inc.cc
testdata/example-base.sqlite3: testdata/example-base.zone
+ $(top_srcdir)/install-sh -c \
+ $(srcdir)/testdata/example-common-inc-template.zone \
+ testdata/example-common-inc.zone
$(SHELL) $(top_builddir)/src/bin/loadzone/run_loadzone.sh \
-c "{\"database_file\": \"$(builddir)/testdata/example-base.sqlite3\"}" \
example.com testdata/example-base.zone
testdata/example-nsec3.sqlite3: testdata/example-nsec3.zone
+ $(top_srcdir)/install-sh -c \
+ $(srcdir)/testdata/example-common-inc-template.zone \
+ testdata/example-common-inc.zone
$(SHELL) $(top_builddir)/src/bin/loadzone/run_loadzone.sh \
-c "{\"database_file\": \"$(builddir)/testdata/example-nsec3.sqlite3\"}" \
example.com testdata/example-nsec3.zone
diff --git a/src/bin/auth/tests/gen-query-testdata.py b/src/bin/auth/tests/gen-query-testdata.py
index cbdb380..8e2da65 100755
--- a/src/bin/auth/tests/gen-query-testdata.py
+++ b/src/bin/auth/tests/gen-query-testdata.py
@@ -18,7 +18,7 @@
This is a supplemental script to generate various forms of test data
from a unified source file.
-Usage: python gen-query-testdata.py source_file output-zonefile output--cc-file
+Usage: python gen-query-testdata.py source_file output-cc-file
The usage doesn't matter much, though, because it's expected to be invoked
from Makefile, and that would be only use case of this script.
@@ -27,11 +27,12 @@ from Makefile, and that would be only use case of this script.
import sys
import re
-# Skip lines starting with '##' (comments) or empty lines
-re_skip = re.compile('(^##)|(^\s*$)')
-
# Markup for variable definition
-re_start_rr = re.compile('^#var=(.*)')
+re_start_rr = re.compile('^;var=(.*)')
+
+# Skip lines starting with ';' (comments) or empty lines. re_start_rr
+# will also match this expression, so it should be checked first.
+re_skip = re.compile('(^;)|(^\s*$)')
def parse_input(input_file):
'''Build an internal list of RR data from the input source file.
@@ -48,14 +49,14 @@ def parse_input(input_file):
rrs = None
with open(input_file) as f:
for line in f:
- if re_skip.match(line):
- continue
m = re_start_rr.match(line)
if m:
if rrs is not None:
result.append((rr_varname, rrs))
rrs = []
rr_varname = m.group(1)
+ elif re_skip.match(line):
+ continue
else:
rrs.append(line.rstrip('\n'))
@@ -88,17 +89,10 @@ def generate_variables(out_file, rrsets_data):
for rr in rrs]))
out.write(';\n')
-def generate_zonefile(out_file, rrsets_data):
- '''Generate a DNS zone file for the given set of RRs.'''
- with open(out_file, 'w') as out:
- for (_, rrs) in rrsets_data:
- out.write('\n'.join(rrs) + '\n')
-
if __name__ == "__main__":
- if len(sys.argv) < 4:
- sys.stderr.write('gen-query-testdata.py require 3 args\n')
+ if len(sys.argv) < 3:
+ sys.stderr.write('gen-query-testdata.py require 2 args\n')
sys.exit(1)
rrsets_data = parse_input(sys.argv[1])
- generate_zonefile(sys.argv[2], rrsets_data)
- generate_variables(sys.argv[3], rrsets_data)
+ generate_variables(sys.argv[2], rrsets_data)
diff --git a/src/bin/auth/tests/query_unittest.cc b/src/bin/auth/tests/query_unittest.cc
index 14df6b2..ed61611 100644
--- a/src/bin/auth/tests/query_unittest.cc
+++ b/src/bin/auth/tests/query_unittest.cc
@@ -40,6 +40,7 @@
#include <gtest/gtest.h>
#include <cstdlib>
+#include <fstream>
#include <map>
#include <sstream>
#include <vector>
@@ -797,6 +798,12 @@ createDataSrcClientList(DataSrcType type, DataSourceClient& client) {
"\"}}]"), true);
return (list);
case SQLITE3:
+ // The copy should succeed; if it failed we should notice it in
+ // test cases.
+ std::system(INSTALL_PROG " -c " TEST_OWN_DATA_BUILDDIR
+ "/example-base.sqlite3 "
+ TEST_OWN_DATA_BUILDDIR
+ "/example-base.sqlite3.copied");
list.reset(new ConfigurableClientList(RRClass::IN()));
list->configure(isc::data::Element::fromJSON(
"[{\"type\": \"sqlite3\","
@@ -804,7 +811,7 @@ createDataSrcClientList(DataSrcType type, DataSourceClient& client) {
" \"cache-zones\": [], "
" \"params\": {\"database_file\": \"" +
string(TEST_OWN_DATA_BUILDDIR
- "/example-base.sqlite3") +
+ "/example-base.sqlite3.copied") +
"\"}}]"), true);
return (list);
default:
@@ -825,15 +832,14 @@ protected:
"glue.delegation.example.com. 3600 IN RRSIG " +
getCommonRRSIGText("AAAA") + "\n" +
"noglue.example.com. 3600 IN RRSIG " +
- getCommonRRSIGText("A"))
+ getCommonRRSIGText("A")),
+ base_zone_file(TEST_OWN_DATA_BUILDDIR "/example-base.zone"),
+ nsec3_zone_file(TEST_OWN_DATA_BUILDDIR "/example-nsec3.zone"),
+ common_zone_file(TEST_OWN_DATA_BUILDDIR "/example-common-inc.zone")
{
// Set up the faked hash calculator.
setNSEC3HashCreator(&nsec3hash_creator_);
- // Configure data source clients after setting NSEC3 hash in case
- // there's dependency.
- list_ = createDataSrcClientList(GetParam(), memory_client);
-
response.setRcode(Rcode::NOERROR());
response.setOpcode(Opcode::QUERY());
// create and add a matching zone.
@@ -841,7 +847,21 @@ protected:
memory_client.addZone(ZoneFinderPtr(mock_finder));
}
- ~QueryTest() {
+ virtual void SetUp() {
+ // clear the commonly included zone file.
+ ASSERT_EQ(0, std::system(INSTALL_PROG " -c " TEST_OWN_DATA_DIR
+ "/example-common-inc-template.zone "
+ TEST_OWN_DATA_BUILDDIR
+ "/example-common-inc.zone"));
+
+ // We create data source clients here, not in the constructor, so this
+ // doesn't happen for derived test class. This also ensures the
+ // data source clients are configured after setting NSEC3 hash in case
+ // there's dependency.
+ list_ = createDataSrcClientList(GetParam(), memory_client);
+ }
+
+ virtual ~QueryTest() {
// Make sure we reset the hash creator to the default
setNSEC3HashCreator(NULL);
}
@@ -851,24 +871,10 @@ protected:
switch (GetParam()) {
case MOCK:
mock_finder->setNSEC3Flag(true);
- for (vector<string>::const_iterator it = rrsets_to_add.begin();
- it != rrsets_to_add.end();
- ++it) {
- mock_finder->addRecord(*it);
- }
+ addRRsets(rrsets_to_add, *list_, "");
break;
case INMEMORY:
- // dynamic addition is not yet supported for in-memory
- ASSERT_TRUE(rrsets_to_add.empty());
- new_list.reset(new ConfigurableClientList(RRClass::IN()));
- new_list->configure(isc::data::Element::fromJSON(
- "[{\"type\": \"MasterFiles\","
- " \"cache-enable\": true, "
- " \"params\": {\"example.com\": \"" +
- string(TEST_OWN_DATA_BUILDDIR
- "/example-nsec3.zone") +
- "\"}}]"), true);
- list_ = new_list;
+ addRRsets(rrsets_to_add, *list_, nsec3_zone_file);
break;
case SQLITE3:
ASSERT_EQ(0, std::system(INSTALL_PROG " -c " TEST_OWN_DATA_BUILDDIR
@@ -884,10 +890,56 @@ protected:
string(TEST_OWN_DATA_BUILDDIR
"/example-nsec3.sqlite3.copied") +
"\"}}]"), true);
+ addRRsets(rrsets_to_add, *new_list, "");
+ list_ = new_list;
+ break;
+ }
+ }
+
+ // A helper to add some RRsets to the test zone in the middle of a test
+ // case. The detailed behavior is quite different depending on the
+ // data source type, and not all parameters are used in all cases.
+ void addRRsets(const vector<string>& rrsets_to_add, ClientList& list,
+ const string& zone_file)
+ {
+ boost::shared_ptr<ConfigurableClientList> new_list;
+ ofstream ofs;
+
+ switch (GetParam()) {
+ case MOCK:
+ // directly add them to the mock data source; ignore the passed
+ // list.
+ for (vector<string>::const_iterator it = rrsets_to_add.begin();
+ it != rrsets_to_add.end();
+ ++it) {
+ mock_finder->addRecord(*it);
+ }
+ break;
+ case INMEMORY:
+ // dump the RRsets to be added to the placeholder of commonly
+ // included zone file (removing any existing contents) and do
+ // full reconfiguration.
+ ofs.open(common_zone_file.c_str(), ios_base::trunc);
+ for (vector<string>::const_iterator it = rrsets_to_add.begin();
+ it != rrsets_to_add.end();
+ ++it) {
+ ofs << *it << "\n";
+ ofs << createRRSIG(textToRRset(*it))->toText() << "\n";
+ }
+ ofs.close();
+ new_list.reset(new ConfigurableClientList(RRClass::IN()));
+ new_list->configure(isc::data::Element::fromJSON(
+ "[{\"type\": \"MasterFiles\","
+ " \"cache-enable\": true, "
+ " \"params\": {\"example.com\": \"" +
+ zone_file + "\"}}]"), true);
+ list_ = new_list;
+ break;
+ case SQLITE3:
const Name origin("example.com");
ZoneUpdaterPtr updater =
- new_list->find(origin, true, false).dsrc_client_->
+ list.find(origin, true, false).dsrc_client_->
getUpdater(origin, false);
for (vector<string>::const_iterator it = rrsets_to_add.begin();
it != rrsets_to_add.end();
@@ -897,8 +949,6 @@ protected:
updater->addRRset(*createRRSIG(rrset));
}
updater->commit();
-
- list_ = new_list;
break;
}
}
@@ -934,7 +984,10 @@ protected:
Query query;
TestNSEC3Hash nsec3_hash_;
vector<string> rrsets_to_add_;
+ const string base_zone_file;
private:
+ const string nsec3_zone_file;
+ const string common_zone_file;
const TestNSEC3HashCreator nsec3hash_creator_;
};
@@ -948,6 +1001,19 @@ INSTANTIATE_TEST_CASE_P(, QueryTest,
#endif
));
+// This inherit the QueryTest cases except for the parameterized setup;
+// it's intended to be used selected test cases that only work for mock
+// data sources either because of some limitation or because of the type of
+// tests (relying on a "broken" data source behavior that can't happen with
+// production data source implementations).
+class QueryTestForMockOnly : public QueryTest {
+protected:
+ // Override SetUp() to avoid parameterized setup
+ virtual void SetUp() {
+ list_ = createDataSrcClientList(MOCK, memory_client);
+ }
+};
+
// A wrapper to check resulting response message commonly used in
// tests below.
// check_origin needs to be specified only when the authority section has
@@ -1071,7 +1137,8 @@ TEST_P(QueryTest, apexNSMatch) {
// test type any query logic
TEST_P(QueryTest, exactAnyMatch) {
- // there's a bug in the in-memory data source and this doesn't work
+ // This is an in-memory specific bug (#2585), until it's fixed we
+ // tentatively skip the test for in-memory
if (GetParam() == INMEMORY) {
return;
}
@@ -1128,11 +1195,7 @@ TEST_P(QueryTest, nodomainANY) {
//
// This only works with mock data source (for production datasrc the
// post-load would reject such a zone)
-TEST_P(QueryTest, noApexNS) {
- if (GetParam() != MOCK) {
- return;
- }
-
+TEST_F(QueryTestForMockOnly, noApexNS) {
// Disable apex NS record
mock_finder->setApexNSFlag(false);
@@ -1192,22 +1255,17 @@ TEST_P(QueryTest, secureUnsignedDelegation) {
}
TEST_P(QueryTest, secureUnsignedDelegationWithNSEC3) {
- // skip NSEC3-related tests for actual data source for the moment
- if (GetParam() != MOCK) {
- return;
- }
-
// Similar to the previous case, but the zone is signed with NSEC3,
// and this delegation is NOT an optout.
- const Name insecurechild_name("unsigned-delegation.example.com");
- mock_finder->setNSEC3Flag(true);
- mock_finder->addRecord(unsigned_delegation_nsec3_txt);
+ rrsets_to_add_.push_back(unsigned_delegation_nsec3_txt);
+ enableNSEC3(rrsets_to_add_);
query.process(*list_,
Name("foo.unsigned-delegation.example.com"),
qtype, response, true);
// The response should contain the NS and matching NSEC3 with its RRSIG
+ const Name insecurechild_name("unsigned-delegation.example.com");
responseCheck(response, Rcode::NOERROR(), 0, 0, 3, 0,
NULL,
(string(unsigned_delegation_txt) +
@@ -1244,11 +1302,8 @@ TEST_P(QueryTest, secureUnsignedDelegationWithNSEC3OptOut) {
NULL);
}
-TEST_P(QueryTest, badSecureDelegation) {
- // broken data source scenario; works only with mock.
- if (GetParam() != MOCK) {
- return;
- }
+TEST_F(QueryTestForMockOnly, badSecureDelegation) {
+ // This is a broken data source scenario; works only with mock.
// Test whether exception is raised if DS query at delegation results in
// something different than SUCCESS or NXRRSET
@@ -1294,7 +1349,7 @@ TEST_P(QueryTest, nxdomainWithNSEC) {
TEST_P(QueryTest, nxdomainWithNSEC2) {
// there seems to be a bug in the SQLite3 (or database in general) data
- // source and this doesn't work.
+ // source and this doesn't work (Trac #2586).
if (GetParam() == SQLITE3) {
return;
}
@@ -1321,7 +1376,7 @@ TEST_P(QueryTest, nxdomainWithNSEC2) {
TEST_P(QueryTest, nxdomainWithNSECDuplicate) {
// there seems to be a bug in the SQLite3 (or database in general) data
// source and this doesn't work. This is probably the same type of bug
- // as nxdomainWithNSEC2
+ // as nxdomainWithNSEC2 (Trac #2586).
if (GetParam() == SQLITE3) {
return;
}
@@ -1340,11 +1395,8 @@ TEST_P(QueryTest, nxdomainWithNSECDuplicate) {
NULL, mock_finder->getOrigin());
}
-TEST_P(QueryTest, nxdomainBadNSEC1) {
- // broken data source scenario; works only with mock.
- if (GetParam() != MOCK) {
- return;
- }
+TEST_F(QueryTestForMockOnly, nxdomainBadNSEC1) {
+ // This is a broken data source scenario; works only with mock.
// ZoneFinder::find() returns NXDOMAIN with non NSEC RR.
mock_finder->setNSECResult(Name("badnsec.example.com"),
@@ -1355,11 +1407,8 @@ TEST_P(QueryTest, nxdomainBadNSEC1) {
std::bad_cast);
}
-TEST_P(QueryTest, nxdomainBadNSEC2) {
- // broken data source scenario; works only with mock.
- if (GetParam() != MOCK) {
- return;
- }
+TEST_F(QueryTestForMockOnly, nxdomainBadNSEC2) {
+ // This is a broken data source scenario; works only with mock.
// ZoneFinder::find() returns NXDOMAIN with an empty NSEC RR.
mock_finder->setNSECResult(Name("emptynsec.example.com"),
@@ -1370,11 +1419,8 @@ TEST_P(QueryTest, nxdomainBadNSEC2) {
Query::BadNSEC);
}
-TEST_P(QueryTest, nxdomainBadNSEC) {
- // broken data source scenario; works only with mock.
- if (GetParam() != MOCK) {
- return;
- }
+TEST_F(QueryTestForMockOnly, nxdomainBadNSEC) {
+ // This is a broken data source scenario; works only with mock.
// "no-wildcard proof" returns SUCCESS. it should be NXDOMAIN.
mock_finder->setNSECResult(Name("*.example.com"),
@@ -1385,11 +1431,8 @@ TEST_P(QueryTest, nxdomainBadNSEC) {
Query::BadNSEC);
}
-TEST_P(QueryTest, nxdomainBadNSEC4) {
- // broken data source scenario; works only with mock.
- if (GetParam() != MOCK) {
- return;
- }
+TEST_F(QueryTestForMockOnly, nxdomainBadNSEC4) {
+ // This is a broken data source scenario; works only with mock.
// "no-wildcard proof" doesn't return RRset.
mock_finder->setNSECResult(Name("*.example.com"),
@@ -1399,11 +1442,8 @@ TEST_P(QueryTest, nxdomainBadNSEC4) {
Query::BadNSEC);
}
-TEST_P(QueryTest, nxdomainBadNSEC5) {
- // broken data source scenario; works only with mock.
- if (GetParam() != MOCK) {
- return;
- }
+TEST_F(QueryTestForMockOnly, nxdomainBadNSEC5) {
+ // This is a broken data source scenario; works only with mock.
// "no-wildcard proof" returns non NSEC.
mock_finder->setNSECResult(Name("*.example.com"),
@@ -1425,11 +1465,8 @@ TEST_P(QueryTest, nxdomainBadNSEC5) {
NULL, mock_finder->getOrigin());
}
-TEST_P(QueryTest, nxdomainBadNSEC6) {
- // broken data source scenario; works only with mock.
- if (GetParam() != MOCK) {
- return;
- }
+TEST_F(QueryTestForMockOnly, nxdomainBadNSEC6) {
+ // This is a broken data source scenario; works only with mock.
// "no-wildcard proof" returns empty NSEC.
mock_finder->setNSECResult(Name("*.example.com"),
@@ -1534,12 +1571,6 @@ TEST_P(QueryTest, CNAMEwildNSEC) {
}
TEST_P(QueryTest, wildcardNSEC3) {
- // This test requires incremental update to the zone; unavailable for
- // in-memory.
- if (GetParam() == INMEMORY) {
- return;
- }
-
// Similar to wildcardNSEC, but the zone is signed with NSEC3.
// The next closer is y.wild.example.com, the covering NSEC3 for it
// is (in our setup) the NSEC3 for the apex.
@@ -1568,11 +1599,6 @@ TEST_P(QueryTest, wildcardNSEC3) {
}
TEST_P(QueryTest, CNAMEwildNSEC3) {
- // skip NSEC3-related tests for actual data source for the moment
- if (GetParam() == INMEMORY) {
- return;
- }
-
// Similar to CNAMEwildNSEC, but with NSEC3.
// The next closer is qname itself, the covering NSEC3 for it
// is (in our setup) the NSEC3 for the www.example.com.
@@ -1593,12 +1619,8 @@ TEST_P(QueryTest, CNAMEwildNSEC3) {
mock_finder->getOrigin());
}
-TEST_P(QueryTest, badWildcardNSEC3) {
- // This test requires incremental update to the zone; unavailable for
- // in-memory.
- if (GetParam() != MOCK) {
- return;
- }
+TEST_F(QueryTestForMockOnly, badWildcardNSEC3) {
+ // This is a broken data source scenario; works only with mock.
// Similar to wildcardNSEC3, but emulating run time collision by
// returning NULL in the next closer proof for the closest encloser
@@ -1613,11 +1635,8 @@ TEST_P(QueryTest, badWildcardNSEC3) {
Query::BadNSEC3);
}
-TEST_P(QueryTest, badWildcardProof1) {
- // broken data source scenario; works only with mock.
- if (GetParam() != MOCK) {
- return;
- }
+TEST_F(QueryTestForMockOnly, badWildcardProof1) {
+ // This is a broken data source scenario; works only with mock.
// Unexpected case in wildcard proof: ZoneFinder::find() returns SUCCESS
// when NXDOMAIN is expected.
@@ -1629,11 +1648,8 @@ TEST_P(QueryTest, badWildcardProof1) {
Query::BadNSEC);
}
-TEST_P(QueryTest, badWildcardProof2) {
- // broken data source scenario; works only with mock.
- if (GetParam() != MOCK) {
- return;
- }
+TEST_F(QueryTestForMockOnly, badWildcardProof2) {
+ // This is a broken data source scenario; works only with mock.
// "wildcard proof" doesn't return RRset.
mock_finder->setNSECResult(Name("www.wild.example.com"),
@@ -1643,11 +1659,8 @@ TEST_P(QueryTest, badWildcardProof2) {
Query::BadNSEC);
}
-TEST_P(QueryTest, badWildcardProof3) {
- // broken data source scenario; works only with mock.
- if (GetParam() != MOCK) {
- return;
- }
+TEST_F(QueryTestForMockOnly, badWildcardProof3) {
+ // This is a broken data source scenario; works only with mock.
// "wildcard proof" returns empty NSEC.
mock_finder->setNSECResult(Name("www.wild.example.com"),
@@ -1659,7 +1672,8 @@ TEST_P(QueryTest, badWildcardProof3) {
}
TEST_P(QueryTest, wildcardNxrrsetWithDuplicateNSEC) {
- // TODO: this seems to be an in-memory specific bug
+ // This is an in-memory specific bug (#2585), until it's fixed we
+ // tentatively skip the test for in-memory
if (GetParam() == INMEMORY) {
return;
}
@@ -1680,7 +1694,8 @@ TEST_P(QueryTest, wildcardNxrrsetWithDuplicateNSEC) {
}
TEST_P(QueryTest, wildcardNxrrsetWithNSEC) {
- // TODO: this seems to be an in-memory specific bug
+ // This is an in-memory specific bug (#2585), until it's fixed we
+ // tentatively skip the test for in-memory
if (GetParam() == INMEMORY) {
return;
}
@@ -1705,12 +1720,6 @@ TEST_P(QueryTest, wildcardNxrrsetWithNSEC) {
}
TEST_P(QueryTest, wildcardNxrrsetWithNSEC3) {
- // This test requires incremental update to the zone; unavailable for
- // in-memory.
- if (GetParam() == INMEMORY) {
- return;
- }
-
// Similar to the previous case, but providing NSEC3 proofs according to
// RFC5155 Section 7.2.5.
@@ -1743,11 +1752,8 @@ TEST_P(QueryTest, wildcardNxrrsetWithNSEC3) {
NULL, mock_finder->getOrigin());
}
-TEST_P(QueryTest, wildcardNxrrsetWithNSEC3Collision) {
- // broken data source scenario; works only with mock.
- if (GetParam() != MOCK) {
- return;
- }
+TEST_F(QueryTestForMockOnly, wildcardNxrrsetWithNSEC3Collision) {
+ // This is a broken data source scenario; works only with mock.
// Similar to the previous case, but emulating run time collision by
// returning NULL in the next closer proof for the closest encloser
@@ -1762,11 +1768,8 @@ TEST_P(QueryTest, wildcardNxrrsetWithNSEC3Collision) {
Query::BadNSEC3);
}
-TEST_P(QueryTest, wildcardNxrrsetWithNSEC3Broken) {
- // broken data source scenario; works only with mock.
- if (GetParam() != MOCK) {
- return;
- }
+TEST_F(QueryTestForMockOnly, wildcardNxrrsetWithNSEC3Broken) {
+ // This is a broken data source scenario; works only with mock.
// Similar to wildcardNxrrsetWithNSEC3, but no matching NSEC3 for the
// wildcard name will be returned. This shouldn't happen in a reasonably
@@ -1807,11 +1810,8 @@ TEST_P(QueryTest, wildcardEmptyWithNSEC) {
* This tests that when there's no SOA and we need a negative answer. It should
* throw in that case.
*/
-TEST_P(QueryTest, noSOA) {
- // broken data source scenario; works only with mock.
- if (GetParam() != MOCK) {
- return;
- }
+TEST_F(QueryTestForMockOnly, noSOA) {
+ // This is a broken data source scenario; works only with mock.
// disable zone's SOA RR.
mock_finder->setSOAFlag(false);
@@ -2106,12 +2106,9 @@ nsec3Check(bool expected_matched, uint8_t expected_labels,
actual_rrsets.end());
}
-TEST_P(QueryTest, findNSEC3) {
+TEST_F(QueryTestForMockOnly, findNSEC3) {
// This test is intended to test the mock data source behavior; no need
// to do it for others.
- if (GetParam() != MOCK) {
- return;
- }
// In all test cases in the recursive mode, the closest encloser is the
// apex, and result's closest_labels should be the number of apex labels.
@@ -2250,12 +2247,9 @@ private:
const bool have_ds_;
};
-TEST_P(QueryTest, dsAboveDelegation) {
+TEST_F(QueryTestForMockOnly, dsAboveDelegation) {
// We could setup the child zone for other data sources, but it won't be
// simple addition. For now we test it for mock only.
- if (GetParam() != MOCK) {
- return;
- }
// Pretending to have authority for the child zone, too.
memory_client.addZone(ZoneFinderPtr(new AlternateZoneFinder(
@@ -2321,12 +2315,8 @@ TEST_P(QueryTest, dsBelowDelegation) {
// exists in the child zone. The Query module should still return SOA.
// In our implementation NSEC/NSEC3 isn't attached in this case.
TEST_P(QueryTest, dsBelowDelegationWithDS) {
- // Requires in-test addition of an RR; works only for mock.
- if (GetParam() != MOCK) {
- return;
- }
-
- mock_finder->addRecord(zone_ds_txt); // add the DS to the child's apex
+ rrsets_to_add_.push_back(zone_ds_txt);
+ addRRsets(rrsets_to_add_, *list_, base_zone_file);
EXPECT_NO_THROW(query.process(*list_, Name("example.com"),
RRType::DS(), response, true));
@@ -2362,12 +2352,9 @@ TEST_P(QueryTest, dsAtGrandParent) {
// side and should result in no data with SOA. Note that the server doesn't
// have authority for the "parent". Unlike the dsAboveDelegation test case
// the query should be handled in the child zone, not in the grandparent.
-TEST_P(QueryTest, dsAtGrandParentAndChild) {
+TEST_F(QueryTestForMockOnly, dsAtGrandParentAndChild) {
// We could setup the child zone for other data sources, but it won't be
// simple addition. For now we test it for mock only.
- if (GetParam() != MOCK) {
- return;
- }
// Pretending to have authority for the child zone, too.
const Name childname("grand.delegation.example.com");
@@ -2387,12 +2374,9 @@ TEST_P(QueryTest, dsAtGrandParentAndChild) {
// DS query for the root name (quite pathological). Since there's no "parent",
// the query will be handled in the root zone anyway, and should (normally)
// result in no data.
-TEST_P(QueryTest, dsAtRoot) {
+TEST_F(QueryTestForMockOnly, dsAtRoot) {
// We could setup the additional zone for other data sources, but it
// won't be simple addition. For now we test it for mock only.
- if (GetParam() != MOCK) {
- return;
- }
// Pretend to be a root server.
memory_client.addZone(ZoneFinderPtr(
@@ -2410,12 +2394,9 @@ TEST_P(QueryTest, dsAtRoot) {
// Even more pathological case: A faked root zone actually has its own DS
// query. How we respond wouldn't matter much in practice, but check if
// it behaves as it's intended. This implementation should return the DS.
-TEST_P(QueryTest, dsAtRootWithDS) {
+TEST_F(QueryTestForMockOnly, dsAtRootWithDS) {
// We could setup the additional zone for other data sources, but it
// won't be simple addition. For now we test it for mock only.
- if (GetParam() != MOCK) {
- return;
- }
memory_client.addZone(ZoneFinderPtr(
new AlternateZoneFinder(Name::ROOT_NAME(),
@@ -2452,11 +2433,8 @@ TEST_P(QueryTest, nxrrsetWithNSEC3) {
// Check the exception is correctly raised when the NSEC3 thing isn't in the
// zone
-TEST_P(QueryTest, nxrrsetMissingNSEC3) {
- // broken data source scenario; works only with mock.
- if (GetParam() != MOCK) {
- return;
- }
+TEST_F(QueryTestForMockOnly, nxrrsetMissingNSEC3) {
+ // This is a broken data source scenario; works only with mock.
mock_finder->setNSEC3Flag(true);
// We just need it to return false for "matched". This indicates
@@ -2471,12 +2449,6 @@ TEST_P(QueryTest, nxrrsetMissingNSEC3) {
}
TEST_P(QueryTest, nxrrsetWithNSEC3_ds_exact) {
- // This test requires incremental update to the zone; unavailable for
- // in-memory.
- if (GetParam() == INMEMORY) {
- return;
- }
-
rrsets_to_add_.push_back(unsigned_delegation_nsec3_txt);
enableNSEC3(rrsets_to_add_);
@@ -2496,12 +2468,6 @@ TEST_P(QueryTest, nxrrsetWithNSEC3_ds_exact) {
}
TEST_P(QueryTest, nxrrsetWithNSEC3_ds_no_exact) {
- // This test requires incremental update to the zone; unavailable for
- // in-memory.
- if (GetParam() == INMEMORY) {
- return;
- }
-
rrsets_to_add_.push_back(unsigned_delegation_nsec3_txt);
enableNSEC3(rrsets_to_add_);
@@ -2528,12 +2494,6 @@ TEST_P(QueryTest, nxrrsetWithNSEC3_ds_no_exact) {
}
TEST_P(QueryTest, nxdomainWithNSEC3Proof) {
- // This test requires incremental update to the zone; unavailable for
- // in-memory.
- if (GetParam() == INMEMORY) {
- return;
- }
-
// Name Error (NXDOMAIN) case with NSEC3 proof per RFC5155 Section 7.2.2.
// This will be the covering NSEC3 for the next closer
@@ -2569,11 +2529,8 @@ TEST_P(QueryTest, nxdomainWithNSEC3Proof) {
NULL, mock_finder->getOrigin());
}
-TEST_P(QueryTest, nxdomainWithBadNextNSEC3Proof) {
- // broken data source scenario; works only with mock.
- if (GetParam() != MOCK) {
- return;
- }
+TEST_F(QueryTestForMockOnly, nxdomainWithBadNextNSEC3Proof) {
+ // This is a broken data source scenario; works only with mock.
// Similar to the previous case, but emulating run time collision by
// returning NULL in the next closer proof for the closest encloser
@@ -2588,11 +2545,8 @@ TEST_P(QueryTest, nxdomainWithBadNextNSEC3Proof) {
Query::BadNSEC3);
}
-TEST_P(QueryTest, nxdomainWithBadWildcardNSEC3Proof) {
- // broken data source scenario; works only with mock.
- if (GetParam() != MOCK) {
- return;
- }
+TEST_F(QueryTestForMockOnly, nxdomainWithBadWildcardNSEC3Proof) {
+ // This is a broken data source scenario; works only with mock.
// Similar to nxdomainWithNSEC3Proof, but let findNSEC3() return a matching
// NSEC3 for the possible wildcard name, emulating run-time collision.
diff --git a/src/bin/auth/tests/testdata/Makefile.am b/src/bin/auth/tests/testdata/Makefile.am
index c5655c5..fa4ffdf 100644
--- a/src/bin/auth/tests/testdata/Makefile.am
+++ b/src/bin/auth/tests/testdata/Makefile.am
@@ -1,6 +1,6 @@
CLEANFILES = *.wire *.copied
-CLEANFILES += example-base.zone example-nsec3-inc.zone
CLEANFILES += example-base.sqlite3 example-nsec3.sqlite3
+CLEANFILES += example-common-inc.zone
BUILT_SOURCES = badExampleQuery_fromWire.wire examplequery_fromWire.wire
BUILT_SOURCES += iqueryresponse_fromWire.wire multiquestion_fromWire.wire
@@ -26,7 +26,7 @@ EXTRA_DIST += example.com
EXTRA_DIST += example.zone
EXTRA_DIST += example.sqlite3
-EXTRA_DIST += query_testzone_data.txt query_testzone_data_nsec3.txt
+EXTRA_DIST += example-base-inc.zone example-nsec3-inc.zone
.spec.wire:
$(PYTHON) $(top_builddir)/src/lib/util/python/gen_wiredata.py -o $@ $<
diff --git a/src/bin/auth/tests/testdata/example-base-inc.zone b/src/bin/auth/tests/testdata/example-base-inc.zone
new file mode 100644
index 0000000..bbcbef1
--- /dev/null
+++ b/src/bin/auth/tests/testdata/example-base-inc.zone
@@ -0,0 +1,236 @@
+;; This file defines a set of RRs commonly used in query tests in the
+;; form of standard master zone file.
+;;
+;; It's a sequence of the following pattern:
+;; ;var=<var_name>
+;; RR_1
+;; RR_2
+;; ..
+;; RR_n
+;;
+;; where var_name is a string that can be used as a variable name in a
+;; C/C++ source file or an empty string. RR_x is a single-line
+;; textual representation of an arbitrary DNS RR.
+;;
+;; If var_name is non empty, the generator script will define a C
+;; variable of C-string type for that set of RRs so that it can be referred
+;; to in the test source file.
+;;
+;; Note that lines beginning ';var=' is no different from other
+;; comment lines as a zone file. It has special meaning only for the
+;; generator script. Obviously, real comment lines cannot begin with
+;; ';var=' (which should be less likely to happen in practice though).
+;;
+;; These RRs will be loaded into in-memory data source in that order.
+;; Note that it may impose stricter restriction on the order of RRs.
+;; In general, each RRset of the same name and type and its RRSIG (if
+;; any) is expected to be grouped.
+
+;var=soa_txt
+example.com. 3600 IN SOA . . 1 0 0 0 0
+;var=zone_ns_txt
+example.com. 3600 IN NS glue.delegation.example.com.
+example.com. 3600 IN NS noglue.example.com.
+example.com. 3600 IN NS example.net.
+
+;var=
+example.com. 3600 IN RRSIG SOA 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
+example.com. 3600 IN RRSIG NS 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
+
+;; Note: the position of the next RR is tricky. It's placed here to
+;; be grouped with the subsequent A RR of the name. But we also want
+;; to group the A RR with other RRs of a different owner name, so the RRSIG
+;; cannot be placed after the A RR. The empty 'var=' specification is
+;; not necessary here, but in case we want to reorganize the ordering
+;; (in which case it's more likely to be needed), we keep it here.
+;var=
+noglue.example.com. 3600 IN RRSIG A 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
+
+;var=ns_addrs_txt
+noglue.example.com. 3600 IN A 192.0.2.53
+glue.delegation.example.com. 3600 IN A 192.0.2.153
+glue.delegation.example.com. 3600 IN AAAA 2001:db8::53
+
+;var=
+glue.delegation.example.com. 3600 IN RRSIG A 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
+glue.delegation.example.com. 3600 IN RRSIG AAAA 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
+
+;var=delegation_txt
+delegation.example.com. 3600 IN NS glue.delegation.example.com.
+delegation.example.com. 3600 IN NS noglue.example.com.
+delegation.example.com. 3600 IN NS cname.example.com.
+delegation.example.com. 3600 IN NS example.org.
+
+;var=
+delegation.example.com. 3600 IN RRSIG DS 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
+
+;; Borrowed from the RFC4035
+;var=delegation_ds_txt
+delegation.example.com. 3600 IN DS 57855 5 1 B6DCD485719ADCA18E5F3D48A2331627FDD3 636B
+;var=mx_txt
+mx.example.com. 3600 IN MX 10 www.example.com.
+mx.example.com. 3600 IN MX 20 mailer.example.org.
+mx.example.com. 3600 IN MX 30 mx.delegation.example.com.
+;var=www_a_txt
+www.example.com. 3600 IN A 192.0.2.80
+
+;var=
+www.example.com. 3600 IN RRSIG A 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
+
+;var=cname_txt
+cname.example.com. 3600 IN CNAME www.example.com.
+;var=cname_nxdom_txt
+cnamenxdom.example.com. 3600 IN CNAME nxdomain.example.com.
+;; CNAME Leading out of zone
+;var=cname_out_txt
+cnameout.example.com. 3600 IN CNAME www.example.org.
+;; The DNAME to do tests against
+;var=dname_txt
+dname.example.com. 3600 IN DNAME somethinglong.dnametarget.example.com.
+;; Some data at the dname node (allowed by RFC 2672)
+;var=dname_a_txt
+dname.example.com. 3600 IN A 192.0.2.5
+;; This is not inside the zone, this is created at runtime
+;; www.dname.example.com. 3600 IN CNAME www.somethinglong.dnametarget.example.com.
+;; The rest of data won't be referenced from the test cases.
+;var=other_zone_rrs
+cnamemailer.example.com. 3600 IN CNAME www.example.com.
+cnamemx.example.com. 3600 IN MX 10 cnamemailer.example.com.
+mx.delegation.example.com. 3600 IN A 192.0.2.100
+;; Wildcards
+;var=wild_txt
+*.wild.example.com. 3600 IN A 192.0.2.7
+;var=nsec_wild_txt
+*.wild.example.com. 3600 IN NSEC www.example.com. A NSEC RRSIG
+
+;var=
+*.wild.example.com. 3600 IN RRSIG A 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
+*.wild.example.com. 3600 IN RRSIG NSEC 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
+
+;var=cnamewild_txt
+*.cnamewild.example.com. 3600 IN CNAME www.example.org.
+;var=nsec_cnamewild_txt
+*.cnamewild.example.com. 3600 IN NSEC delegation.example.com. CNAME NSEC RRSIG
+
+;var=
+*.cnamewild.example.com. 3600 IN RRSIG CNAME 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
+*.cnamewild.example.com. 3600 IN RRSIG NSEC 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
+
+;; Wildcard_nxrrset
+;var=wild_txt_nxrrset
+*.uwild.example.com. 3600 IN A 192.0.2.9
+;var=nsec_wild_txt_nxrrset
+*.uwild.example.com. 3600 IN NSEC www.uwild.example.com. A NSEC RRSIG
+;var=
+*.uwild.example.com. 3600 IN RRSIG NSEC 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
+;var=wild_txt_next
+www.uwild.example.com. 3600 IN A 192.0.2.11
+;var=
+www.uwild.example.com. 3600 IN RRSIG NSEC 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
+;var=nsec_wild_txt_next
+www.uwild.example.com. 3600 IN NSEC *.wild.example.com. A NSEC RRSIG
+;; Wildcard empty
+;var=empty_txt
+b.*.t.example.com. 3600 IN A 192.0.2.13
+;var=nsec_empty_txt
+b.*.t.example.com. 3600 IN NSEC *.uwild.example.com. A NSEC RRSIG
+
+;var=
+b.*.t.example.com. 3600 IN RRSIG NSEC 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
+
+;var=empty_prev_txt
+t.example.com. 3600 IN A 192.0.2.15
+;var=nsec_empty_prev_txt
+t.example.com. 3600 IN NSEC b.*.t.example.com. A NSEC RRSIG
+
+;var=
+t.example.com. 3600 IN RRSIG NSEC 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
+
+;; Used in NXDOMAIN proof test. We are going to test some unusual case where
+;; the best possible wildcard is below the "next domain" of the NSEC RR that
+;; proves the NXDOMAIN, i.e.,
+;; mx.example.com. (exist)
+;; (.no.example.com. (qname, NXDOMAIN)
+;; ).no.example.com. (exist)
+;; *.no.example.com. (best possible wildcard, not exist)
+;var=no_txt
+\).no.example.com. 3600 IN AAAA 2001:db8::53
+;; NSEC records.
+;var=nsec_apex_txt
+example.com. 3600 IN NSEC cname.example.com. NS SOA NSEC RRSIG
+;var=
+example.com. 3600 IN RRSIG NSEC 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
+;var=nsec_mx_txt
+mx.example.com. 3600 IN NSEC \).no.example.com. MX NSEC RRSIG
+
+;var=
+mx.example.com. 3600 IN RRSIG NSEC 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
+
+;var=nsec_no_txt
+\).no.example.com. 3600 IN NSEC nz.no.example.com. AAAA NSEC RRSIG
+
+;var=
+\).no.example.com. 3600 IN RRSIG NSEC 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
+
+;; We'll also test the case where a single NSEC proves both NXDOMAIN and the
+;; non existence of wildcard. The following records will be used for that
+;; test.
+;; ).no.example.com. (exist, whose NSEC proves everything)
+;; *.no.example.com. (best possible wildcard, not exist)
+;; nx.no.example.com. (NXDOMAIN)
+;; nz.no.example.com. (exist)
+;var=nz_txt
+nz.no.example.com. 3600 IN AAAA 2001:db8::5300
+;var=nsec_nz_txt
+nz.no.example.com. 3600 IN NSEC noglue.example.com. AAAA NSEC RRSIG
+;var=nsec_nxdomain_txt
+noglue.example.com. 3600 IN NSEC nonsec.example.com. A
+
+;var=
+noglue.example.com. 3600 IN RRSIG NSEC 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
+
+;; NSEC for the normal NXRRSET case
+;var=nsec_www_txt
+www.example.com. 3600 IN NSEC example.com. A NSEC RRSIG
+
+;var=
+www.example.com. 3600 IN RRSIG NSEC 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
+
+;; Authoritative data without NSEC
+;var=nonsec_a_txt
+nonsec.example.com. 3600 IN A 192.0.2.0
+
+;; (Secure) delegation data; Delegation with DS record
+;var=signed_delegation_txt
+signed-delegation.example.com. 3600 IN NS ns.example.net.
+;var=signed_delegation_ds_txt
+signed-delegation.example.com. 3600 IN DS 12345 8 2 764501411DE58E8618945054A3F620B36202E115D015A7773F4B78E0F952CECA
+
+;var=
+signed-delegation.example.com. 3600 IN RRSIG DS 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
+
+;; (Secure) delegation data; Delegation without DS record (and both NSEC
+;; and NSEC3 denying its existence)
+;var=unsigned_delegation_txt
+unsigned-delegation.example.com. 3600 IN NS ns.example.net.
+;var=unsigned_delegation_nsec_txt
+unsigned-delegation.example.com. 3600 IN NSEC unsigned-delegation-optout.example.com. NS RRSIG NSEC
+
+;var=
+unsigned-delegation.example.com. 3600 IN RRSIG NSEC 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
+
+;; Delegation without DS record, and no direct matching NSEC3 record
+;var=unsigned_delegation_optout_txt
+unsigned-delegation-optout.example.com. 3600 IN NS ns.example.net.
+;var=unsigned_delegation_optout_nsec_txt
+unsigned-delegation-optout.example.com. 3600 IN NSEC *.uwild.example.com. NS RRSIG NSEC
+
+;; (Secure) delegation data; Delegation where the DS lookup will raise an
+;; exception.
+;var=bad_delegation_txt
+bad-delegation.example.com. 3600 IN NS ns.example.net.
+
+;; Delegation from an unsigned parent. There's no DS, and there's no NSEC
+;; or NSEC3 that proves it.
+;var=nosec_delegation_txt
+nosec-delegation.example.com. 3600 IN NS ns.nosec.example.net.
diff --git a/src/bin/auth/tests/testdata/example-base.zone.in b/src/bin/auth/tests/testdata/example-base.zone.in
new file mode 100644
index 0000000..63d2af0
--- /dev/null
+++ b/src/bin/auth/tests/testdata/example-base.zone.in
@@ -0,0 +1,7 @@
+;;
+;; This is a complete (but crafted and somewhat broken) zone file used
+;; in query tests.
+;;
+
+$INCLUDE @abs_srcdir@/example-base-inc.zone
+$INCLUDE @abs_builddir@/example-common-inc.zone
diff --git a/src/bin/auth/tests/testdata/example-common-inc-template.zone b/src/bin/auth/tests/testdata/example-common-inc-template.zone
new file mode 100644
index 0000000..d7259bf
--- /dev/null
+++ b/src/bin/auth/tests/testdata/example-common-inc-template.zone
@@ -0,0 +1,5 @@
+;;
+;; This is an initial template of part of test zone file used in query test
+;; and expected to be included from other zone files. This is
+;; intentionally kept empty.
+;;
diff --git a/src/bin/auth/tests/testdata/example-nsec3-inc.zone b/src/bin/auth/tests/testdata/example-nsec3-inc.zone
new file mode 100644
index 0000000..7742df0
--- /dev/null
+++ b/src/bin/auth/tests/testdata/example-nsec3-inc.zone
@@ -0,0 +1,16 @@
+;; See query_testzone_data.txt for general notes.
+
+;; NSEC3PARAM. This is needed for database-based data source to
+;; signal the zone is NSEC3-signed
+;var=
+example.com. 3600 IN NSEC3PARAM 1 1 12 aabbccdd
+
+;; NSEC3 RRs. You may also need to add mapping to MockZoneFinder::hash_map_.
+;var=nsec3_apex_txt
+0p9mhaveqvm6t7vbl5lop2u3t2rp3tom.example.com. 3600 IN NSEC3 1 1 12 aabbccdd 2t7b4g4vsa5smi47k61mv5bv1a22bojr NS SOA NSEC3PARAM RRSIG
+;var=nsec3_apex_rrsig_txt
+0p9mhaveqvm6t7vbl5lop2u3t2rp3tom.example.com. 3600 IN RRSIG NSEC3 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
+;var=nsec3_www_txt
+q04jkcevqvmu85r014c7dkba38o0ji5r.example.com. 3600 IN NSEC3 1 1 12 aabbccdd r53bq7cc2uvmubfu5ocmm6pers9tk9en A RRSIG
+;var=nsec3_www_rrsig_txt
+q04jkcevqvmu85r014c7dkba38o0ji5r.example.com. 3600 IN RRSIG NSEC3 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
diff --git a/src/bin/auth/tests/testdata/example-nsec3.zone.in b/src/bin/auth/tests/testdata/example-nsec3.zone.in
index 616c2d6..aaf3d6a 100644
--- a/src/bin/auth/tests/testdata/example-nsec3.zone.in
+++ b/src/bin/auth/tests/testdata/example-nsec3.zone.in
@@ -3,5 +3,6 @@
;; in query tests including NSEC3 records, making the zone is "NSEC3 signed".
;;
-$INCLUDE @abs_builddir@/example-base.zone
-$INCLUDE @abs_builddir@/example-nsec3-inc.zone
+$INCLUDE @abs_srcdir@/example-base-inc.zone
+$INCLUDE @abs_srcdir@/example-nsec3-inc.zone
+$INCLUDE @abs_builddir@/example-common-inc.zone
diff --git a/src/bin/auth/tests/testdata/query_testzone_data.txt b/src/bin/auth/tests/testdata/query_testzone_data.txt
deleted file mode 100644
index 928a7b0..0000000
--- a/src/bin/auth/tests/testdata/query_testzone_data.txt
+++ /dev/null
@@ -1,226 +0,0 @@
-## This file defines a set of RRs commonly used in query tests.
-## It's a sequence of the following pattern:
-## #var=<var_name>
-## RR_1
-## RR_2
-## ..
-## RR_n
-##
-## where var_name is a string that can be used as a variable name in a
-## C/C++ source file or an empty string. RR_x is a single-line
-## textual representation of an arbitrary DNS RR.
-##
-## If var_name is non empty, the generator script will define a C
-## variable of C-string type for that set of RRs so that it can be referred
-## to in the test source file.
-##
-## These RRs will be loaded into in-memory data source in that order.
-## Note that it may impose stricter restriction on the order of RRs.
-## In general, each RRset of the same name and type and its RRSIG (if
-## any) is expected to be grouped.
-##
-## Lines beginning with '##' or empty lines will be ignored by the
-## generator script.
-
-#var=soa_txt
-example.com. 3600 IN SOA . . 0 0 0 0 0
-#var=zone_ns_txt
-example.com. 3600 IN NS glue.delegation.example.com.
-example.com. 3600 IN NS noglue.example.com.
-example.com. 3600 IN NS example.net.
-
-#var=
-example.com. 3600 IN RRSIG SOA 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
-example.com. 3600 IN RRSIG NS 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
-
-#var=
-noglue.example.com. 3600 IN RRSIG A 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
-
-#var=ns_addrs_txt
-noglue.example.com. 3600 IN A 192.0.2.53
-glue.delegation.example.com. 3600 IN A 192.0.2.153
-glue.delegation.example.com. 3600 IN AAAA 2001:db8::53
-
-#var=
-glue.delegation.example.com. 3600 IN RRSIG A 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
-glue.delegation.example.com. 3600 IN RRSIG AAAA 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
-
-#var=delegation_txt
-delegation.example.com. 3600 IN NS glue.delegation.example.com.
-delegation.example.com. 3600 IN NS noglue.example.com.
-delegation.example.com. 3600 IN NS cname.example.com.
-delegation.example.com. 3600 IN NS example.org.
-
-#var=
-delegation.example.com. 3600 IN RRSIG DS 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
-
-## Borrowed from the RFC4035
-#var=delegation_ds_txt
-delegation.example.com. 3600 IN DS 57855 5 1 B6DCD485719ADCA18E5F3D48A2331627FDD3 636B
-#var=mx_txt
-mx.example.com. 3600 IN MX 10 www.example.com.
-mx.example.com. 3600 IN MX 20 mailer.example.org.
-mx.example.com. 3600 IN MX 30 mx.delegation.example.com.
-#var=www_a_txt
-www.example.com. 3600 IN A 192.0.2.80
-
-#var=
-www.example.com. 3600 IN RRSIG A 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
-
-#var=cname_txt
-cname.example.com. 3600 IN CNAME www.example.com.
-#var=cname_nxdom_txt
-cnamenxdom.example.com. 3600 IN CNAME nxdomain.example.com.
-## CNAME Leading out of zone
-#var=cname_out_txt
-cnameout.example.com. 3600 IN CNAME www.example.org.
-## The DNAME to do tests against
-#var=dname_txt
-dname.example.com. 3600 IN DNAME somethinglong.dnametarget.example.com.
-## Some data at the dname node (allowed by RFC 2672)
-#var=dname_a_txt
-dname.example.com. 3600 IN A 192.0.2.5
-## This is not inside the zone, this is created at runtime
-## www.dname.example.com. 3600 IN CNAME www.somethinglong.dnametarget.example.com.
-## The rest of data won't be referenced from the test cases.
-#var=other_zone_rrs
-cnamemailer.example.com. 3600 IN CNAME www.example.com.
-cnamemx.example.com. 3600 IN MX 10 cnamemailer.example.com.
-mx.delegation.example.com. 3600 IN A 192.0.2.100
-## Wildcards
-#var=wild_txt
-*.wild.example.com. 3600 IN A 192.0.2.7
-#var=nsec_wild_txt
-*.wild.example.com. 3600 IN NSEC www.example.com. A NSEC RRSIG
-
-#var=
-*.wild.example.com. 3600 IN RRSIG A 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
-*.wild.example.com. 3600 IN RRSIG NSEC 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
-
-#var=cnamewild_txt
-*.cnamewild.example.com. 3600 IN CNAME www.example.org.
-#var=nsec_cnamewild_txt
-*.cnamewild.example.com. 3600 IN NSEC delegation.example.com. CNAME NSEC RRSIG
-
-#var=
-*.cnamewild.example.com. 3600 IN RRSIG CNAME 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
-*.cnamewild.example.com. 3600 IN RRSIG NSEC 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
-
-## Wildcard_nxrrset
-#var=wild_txt_nxrrset
-*.uwild.example.com. 3600 IN A 192.0.2.9
-#var=nsec_wild_txt_nxrrset
-*.uwild.example.com. 3600 IN NSEC www.uwild.example.com. A NSEC RRSIG
-#var=
-*.uwild.example.com. 3600 IN RRSIG NSEC 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
-#var=wild_txt_next
-www.uwild.example.com. 3600 IN A 192.0.2.11
-#var=
-www.uwild.example.com. 3600 IN RRSIG NSEC 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
-#var=nsec_wild_txt_next
-www.uwild.example.com. 3600 IN NSEC *.wild.example.com. A NSEC RRSIG
-## Wildcard empty
-#var=empty_txt
-b.*.t.example.com. 3600 IN A 192.0.2.13
-#var=nsec_empty_txt
-b.*.t.example.com. 3600 IN NSEC *.uwild.example.com. A NSEC RRSIG
-
-#var=
-b.*.t.example.com. 3600 IN RRSIG NSEC 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
-
-#var=empty_prev_txt
-t.example.com. 3600 IN A 192.0.2.15
-#var=nsec_empty_prev_txt
-t.example.com. 3600 IN NSEC b.*.t.example.com. A NSEC RRSIG
-
-#var=
-t.example.com. 3600 IN RRSIG NSEC 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
-
-## Used in NXDOMAIN proof test. We are going to test some unusual case where
-## the best possible wildcard is below the "next domain" of the NSEC RR that
-## proves the NXDOMAIN, i.e.,
-## mx.example.com. (exist)
-## (.no.example.com. (qname, NXDOMAIN)
-## ).no.example.com. (exist)
-## *.no.example.com. (best possible wildcard, not exist)
-#var=no_txt
-\).no.example.com. 3600 IN AAAA 2001:db8::53
-## NSEC records.
-#var=nsec_apex_txt
-example.com. 3600 IN NSEC cname.example.com. NS SOA NSEC RRSIG
-#var=
-example.com. 3600 IN RRSIG NSEC 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
-#var=nsec_mx_txt
-mx.example.com. 3600 IN NSEC \).no.example.com. MX NSEC RRSIG
-
-#var=
-mx.example.com. 3600 IN RRSIG NSEC 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
-
-#var=nsec_no_txt
-\).no.example.com. 3600 IN NSEC nz.no.example.com. AAAA NSEC RRSIG
-
-#var=
-\).no.example.com. 3600 IN RRSIG NSEC 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
-
-## We'll also test the case where a single NSEC proves both NXDOMAIN and the
-## non existence of wildcard. The following records will be used for that
-## test.
-## ).no.example.com. (exist, whose NSEC proves everything)
-## *.no.example.com. (best possible wildcard, not exist)
-## nx.no.example.com. (NXDOMAIN)
-## nz.no.example.com. (exist)
-#var=nz_txt
-nz.no.example.com. 3600 IN AAAA 2001:db8::5300
-#var=nsec_nz_txt
-nz.no.example.com. 3600 IN NSEC noglue.example.com. AAAA NSEC RRSIG
-#var=nsec_nxdomain_txt
-noglue.example.com. 3600 IN NSEC nonsec.example.com. A
-
-#var=
-noglue.example.com. 3600 IN RRSIG NSEC 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
-
-## NSEC for the normal NXRRSET case
-#var=nsec_www_txt
-www.example.com. 3600 IN NSEC example.com. A NSEC RRSIG
-
-#var=
-www.example.com. 3600 IN RRSIG NSEC 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
-
-## Authoritative data without NSEC
-#var=nonsec_a_txt
-nonsec.example.com. 3600 IN A 192.0.2.0
-
-## (Secure) delegation data; Delegation with DS record
-#var=signed_delegation_txt
-signed-delegation.example.com. 3600 IN NS ns.example.net.
-#var=signed_delegation_ds_txt
-signed-delegation.example.com. 3600 IN DS 12345 8 2 764501411DE58E8618945054A3F620B36202E115D015A7773F4B78E0F952CECA
-
-#var=
-signed-delegation.example.com. 3600 IN RRSIG DS 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
-
-## (Secure) delegation data; Delegation without DS record (and both NSEC
-## and NSEC3 denying its existence)
-#var=unsigned_delegation_txt
-unsigned-delegation.example.com. 3600 IN NS ns.example.net.
-#var=unsigned_delegation_nsec_txt
-unsigned-delegation.example.com. 3600 IN NSEC unsigned-delegation-optout.example.com. NS RRSIG NSEC
-
-#var=
-unsigned-delegation.example.com. 3600 IN RRSIG NSEC 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
-
-## Delegation without DS record, and no direct matching NSEC3 record
-#var=unsigned_delegation_optout_txt
-unsigned-delegation-optout.example.com. 3600 IN NS ns.example.net.
-#var=unsigned_delegation_optout_nsec_txt
-unsigned-delegation-optout.example.com. 3600 IN NSEC *.uwild.example.com. NS RRSIG NSEC
-
-## (Secure) delegation data; Delegation where the DS lookup will raise an
-## exception.
-#var=bad_delegation_txt
-bad-delegation.example.com. 3600 IN NS ns.example.net.
-
-## Delegation from an unsigned parent. There's no DS, and there's no NSEC
-## or NSEC3 that proves it.
-#var=nosec_delegation_txt
-nosec-delegation.example.com. 3600 IN NS ns.nosec.example.net.
diff --git a/src/bin/auth/tests/testdata/query_testzone_data_nsec3.txt b/src/bin/auth/tests/testdata/query_testzone_data_nsec3.txt
deleted file mode 100644
index fbedf86..0000000
--- a/src/bin/auth/tests/testdata/query_testzone_data_nsec3.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-## See query_testzone_data.txt for general notes.
-
-## NSEC3PARAM. This is needed for database-based data source to
-## signal the zone is NSEC3-signed
-#var=
-example.com. 3600 IN NSEC3PARAM 1 1 12 aabbccdd
-
-## NSEC3 RRs. You may also need to add mapping to MockZoneFinder::hash_map_.
-#var=nsec3_apex_txt
-0p9mhaveqvm6t7vbl5lop2u3t2rp3tom.example.com. 3600 IN NSEC3 1 1 12 aabbccdd 2t7b4g4vsa5smi47k61mv5bv1a22bojr NS SOA NSEC3PARAM RRSIG
-#var=nsec3_apex_rrsig_txt
-0p9mhaveqvm6t7vbl5lop2u3t2rp3tom.example.com. 3600 IN RRSIG NSEC3 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
-#var=nsec3_www_txt
-q04jkcevqvmu85r014c7dkba38o0ji5r.example.com. 3600 IN NSEC3 1 1 12 aabbccdd r53bq7cc2uvmubfu5ocmm6pers9tk9en A RRSIG
-#var=nsec3_www_rrsig_txt
-q04jkcevqvmu85r014c7dkba38o0ji5r.example.com. 3600 IN RRSIG NSEC3 5 3 3600 20000101000000 20000201000000 12345 example.com. FAKEFAKEFAKE
More information about the bind10-changes
mailing list