From: JINMEI Tatuya Date: Sat, 22 Dec 2012 01:57:35 +0000 (-0800) Subject: [2480] extend query tests further, so we can test them with sqlite3, too. X-Git-Tag: bind10-1.0.0-rc-release~95^2~22^2~11^2~20 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=448686bfad7694acde8b08355dd5921efd4bb2ca;p=thirdparty%2Fkea.git [2480] extend query tests further, so we can test them with sqlite3, too. there was one missing RR, so it was added. --- diff --git a/src/bin/auth/tests/query_unittest.cc b/src/bin/auth/tests/query_unittest.cc index e320e247cd..0bdb2da9fa 100644 --- a/src/bin/auth/tests/query_unittest.cc +++ b/src/bin/auth/tests/query_unittest.cc @@ -732,7 +732,8 @@ MockZoneFinder::find(const Name& name, const RRType& type, enum DataSrcType { MOCK, - INMEMORY + INMEMORY, + SQLITE3 }; boost::shared_ptr @@ -750,6 +751,16 @@ createDataSrcClientList(DataSrcType type, DataSourceClient& client) { string(TEST_OWN_DATA_DIR "/example.zone") + "\"}}]"), true); return (list); + case SQLITE3: + list.reset(new ConfigurableClientList(RRClass::IN())); + list->configure(isc::data::Element::fromJSON( + "[{\"type\": \"sqlite3\"," + " \"cache-enable\": false, " + " \"cache-zones\": [], " + " \"params\": {\"database_file\": \"" + + string(TEST_OWN_DATA_DIR "/example-base.sqlite3") + + "\"}}]"), true); + return (list); } } @@ -795,9 +806,15 @@ protected: Query query; }; -// We test the in-memory and SQLite3 (TBD) data source implementations. +// We test the in-memory and SQLite3 data source implementations. SQLite3 +// will require a loadable module, which doesn't work with static link for +// all platforms. INSTANTIATE_TEST_CASE_P(, QueryTest, - ::testing::Values(MOCK, INMEMORY)); + ::testing::Values(MOCK, INMEMORY +#ifndef USE_STATIC_LINK + , SQLITE3 +#endif + )); // A wrapper to check resulting response message commonly used in // tests below. @@ -1149,6 +1166,12 @@ 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. + if (GetParam() == SQLITE3) { + return; + } + // See comments about no_txt. In this case the best possible wildcard // is derived from the next domain of the NSEC that proves NXDOMAIN, and // the NSEC to provide the non existence of wildcard is different from @@ -1169,6 +1192,13 @@ 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 + if (GetParam() == SQLITE3) { + return; + } + // See comments about nz_txt. In this case we only need one NSEC, // which proves both NXDOMAIN and the non existence of wildcard. query.process(list, Name("nx.no.example.com"), qtype, response, diff --git a/src/bin/auth/tests/testdata/query_testzone_data.txt b/src/bin/auth/tests/testdata/query_testzone_data.txt index a9aaab362f..928a7b0c2c 100644 --- a/src/bin/auth/tests/testdata/query_testzone_data.txt +++ b/src/bin/auth/tests/testdata/query_testzone_data.txt @@ -111,8 +111,12 @@ mx.delegation.example.com. 3600 IN A 192.0.2.100 *.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