2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 21:45:37 +00:00

[1577] Test findNSEC3 throws on non-NSEC3 zone

Just confirming it throws in case there's no NSEC3PARAM to compute the
hash by.
This commit is contained in:
Michal 'vorner' Vaner
2012-04-11 10:46:16 +02:00
parent 76f364b152
commit b407617f16

View File

@@ -3575,8 +3575,6 @@ TEST_F(MockDatabaseClientTest, journalWithBadData) {
TEST_F(MockDatabaseClientTest, findNSEC3) { TEST_F(MockDatabaseClientTest, findNSEC3) {
// Set up the faked hash calculator. // Set up the faked hash calculator.
setNSEC3HashCreator(&test_nsec3_hash_creator_); setNSEC3HashCreator(&test_nsec3_hash_creator_);
// And enable NSEC3 in the zone.
this->current_accessor_->enableNSEC3();
DataSourceClient::FindResult DataSourceClient::FindResult
zone(this->client_->findZone(Name("example.org"))); zone(this->client_->findZone(Name("example.org")));
@@ -3584,6 +3582,12 @@ TEST_F(MockDatabaseClientTest, findNSEC3) {
boost::shared_ptr<DatabaseClient::Finder> finder( boost::shared_ptr<DatabaseClient::Finder> finder(
dynamic_pointer_cast<DatabaseClient::Finder>(zone.zone_finder)); dynamic_pointer_cast<DatabaseClient::Finder>(zone.zone_finder));
// It'll complain if there is no NSEC3PARAM yet
EXPECT_THROW(finder->findNSEC3(Name("example.org"), false),
DataSourceError);
// And enable NSEC3 in the zone.
this->current_accessor_->enableNSEC3();
// Parameter validation: the query name must be in or below the zone // Parameter validation: the query name must be in or below the zone
EXPECT_THROW(finder->findNSEC3(Name("example.com"), false), OutOfZone); EXPECT_THROW(finder->findNSEC3(Name("example.com"), false), OutOfZone);
EXPECT_THROW(finder->findNSEC3(Name("org"), true), OutOfZone); EXPECT_THROW(finder->findNSEC3(Name("org"), true), OutOfZone);