Commit f8720ba4 authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

[1177] Test for the SQLite3 find previous

parent 38af8a42
......@@ -481,7 +481,7 @@ public:
* This is used in DatabaseClient::findPreviousName and does more
* or less the real work, except for working on strings.
*
* \param name The name to ask for previous of.
* \param rname The name to ask for previous of, in reversed form.
* \param zone_id The zone to look through.
* \return The previous name.
*
......@@ -489,7 +489,7 @@ public:
* \throw NotImplemented if this database doesn't support DNSSEC.
*/
virtual std::string findPreviousName(int zone_id,
const std::string& name) const = 0;
const std::string& rname) const = 0;
};
/**
......
......@@ -351,6 +351,22 @@ TEST_F(SQLite3AccessorTest, getRecords) {
EXPECT_FALSE(context->getNext(columns));
}
TEST_F(SQLite3AccessorTest, findPrevious) {
EXPECT_EQ("dns01.example.com.",
accessor->findPreviousName(1, "com.example.dns02."));
// Wrap around
EXPECT_EQ("www.example.com.",
accessor->findPreviousName(1, "com.example."));
}
TEST_F(SQLite3AccessorTest, findPreviousNoData) {
// This one doesn't hold any NSEC records, so it shouldn't work
// The underlying DB/data don't support DNSSEC, so it's not implemented
// (does it make sense? Or different exception here?)
EXPECT_THROW(accessor->findPreviousName(3, "com.example."),
isc::NotImplemented);
}
// Test fixture for creating a db that automatically deletes it before start,
// and when done
class SQLite3Create : public ::testing::Test {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment