Commit ea064b16 authored by Stephen Morris's avatar Stephen Morris

[trac704] Add tests to check that RTT can's be set to 0

... and a test to check that setting the RTT to an absurdly high
value causes no problems.
parent 6ffefafd
......@@ -513,6 +513,11 @@ TEST_F(NameserverEntryTest, UpdateRTT) {
// The rtt should be close to stable rtt value
EXPECT_TRUE((stable_rtt - new_rtt) < (new_rtt - init_rtt));
// Finally, try updating the RTT to a very large value (large enough for
// RTT^2 - used in the internal calculation - to exceed a 32-bit value).
EXPECT_NO_THROW(vec[0].updateRTT(1000000000)); // 10^9
}
} // namespace
......@@ -320,20 +320,26 @@ class TestResolver : public isc::resolve::ResolverInterface {
/*
* Sends a simple answer to a query.
* Provide index of a query and the address to pass.
* 1) Provide index of a query and the address(es) to pass.
* 2) Provide index of query and components of address to pass.
*/
void answer(size_t index, const Name& name, const RRType& type,
const rdata::Rdata& rdata, size_t TTL = 100)
{
void answer(size_t index, RRsetPtr& set) {
if (index >= requests.size()) {
throw NoSuchRequest();
}
requests[index].second->success(createResponseMessage(set));
}
void answer(size_t index, const Name& name, const RRType& type,
const rdata::Rdata& rdata, size_t TTL = 100)
{
RRsetPtr set(new RRset(name, RRClass::IN(),
type, RRTTL(TTL)));
set->addRdata(rdata);
requests[index].second->success(createResponseMessage(set));
answer(index, set);
}
void provideNS(size_t index,
RRsetPtr nameservers)
{
......
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