static void checkRecordExists(const std::vector<DNSZoneRecord>& records, const DNSName& name, uint16_t type, int zoneId, uint8_t scopeMask, bool auth)
{
- BOOST_REQUIRE_GE(records.size(), 1);
+ BOOST_REQUIRE_GE(records.size(), 1U);
for (const auto& record : records) {
if (record.domain_id == zoneId &&
record.dr.d_type == type &&
{
// test SOA with unknown zone id == -1
auto records = getRecords(ub, DNSName("powerdns.com."), QType::SOA, -1, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 1);
+ BOOST_REQUIRE_EQUAL(records.size(), 1U);
checkRecordExists(records, DNSName("powerdns.com."), QType::SOA, 1, 0, true);
}
{
// test ANY with zone id == -1
auto records = getRecords(ub, DNSName("powerdns.com."), QType::ANY, -1, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 2);
+ BOOST_REQUIRE_EQUAL(records.size(), 2U);
checkRecordExists(records, DNSName("powerdns.com."), QType::SOA, 1, 0, true);
checkRecordExists(records, DNSName("powerdns.com."), QType::AAAA, 1, 0, true);
}
{
// test AAAA with zone id == -1
auto records = getRecords(ub, DNSName("powerdns.com."), QType::AAAA, -1, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 1);
+ BOOST_REQUIRE_EQUAL(records.size(), 1U);
checkRecordExists(records, DNSName("powerdns.com."), QType::AAAA, 1, 0, true);
}
{
// test NODATA with zone id == -1
auto records = getRecords(ub, DNSName("powerdns.com."), QType::PTR, -1, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 0);
+ BOOST_REQUIRE_EQUAL(records.size(), 0U);
}
{
// test ANY with zone id set
auto records = getRecords(ub, DNSName("powerdns.com."), QType::ANY, 1, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 2);
+ BOOST_REQUIRE_EQUAL(records.size(), 2U);
checkRecordExists(records, DNSName("powerdns.com."), QType::SOA, 1, 0, true);
checkRecordExists(records, DNSName("powerdns.com."), QType::AAAA, 1, 0, true);
}
{
// test AAAA with zone id set
auto records = getRecords(ub, DNSName("powerdns.com."), QType::AAAA, 1, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 1);
+ BOOST_REQUIRE_EQUAL(records.size(), 1U);
checkRecordExists(records, DNSName("powerdns.com."), QType::AAAA, 1, 0, true);
}
{
// test NODATA with zone id set
auto records = getRecords(ub, DNSName("powerdns.com."), QType::PTR, 1, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 0);
+ BOOST_REQUIRE_EQUAL(records.size(), 0U);
}
{
// test ANY with wrong zone id
auto records = getRecords(ub, DNSName("powerdns.com."), QType::ANY, 65535, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 0);
+ BOOST_REQUIRE_EQUAL(records.size(), 0U);
}
{
ComboAddress remote("192.0.2.1");
pkt.setRemote(&remote);
auto records = getRecords(ub, DNSName("geo.powerdns.com."), QType::ANY, 1, &pkt);
- BOOST_REQUIRE_EQUAL(records.size(), 1);
+ BOOST_REQUIRE_EQUAL(records.size(), 1U);
checkRecordExists(records, DNSName("geo.powerdns.com."), QType::A, 1, 32, true);
// and that we don't get the same result for a different client
remote = ComboAddress("192.0.2.2");
pkt.setRemote(&remote);
records = getRecords(ub, DNSName("geo.powerdns.com."), QType::ANY, 1, &pkt);
- BOOST_REQUIRE_EQUAL(records.size(), 1);
+ BOOST_REQUIRE_EQUAL(records.size(), 1U);
checkRecordExists(records, DNSName("geo.powerdns.com."), QType::A, 1, 0, true);
}
{
// test SOA with unknown zone id == -1
auto records = getRecords(ub, DNSName("powerdns.com."), QType::SOA, -1, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 1);
+ BOOST_REQUIRE_EQUAL(records.size(), 1U);
checkRecordExists(records, DNSName("powerdns.com."), QType::SOA, 1, 0, true);
records = getRecords(ub, DNSName("powerdns.org."), QType::SOA, -1, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 1);
+ BOOST_REQUIRE_EQUAL(records.size(), 1U);
checkRecordExists(records, DNSName("powerdns.org."), QType::SOA, 2, 0, true);
}
{
// test ANY with zone id == -1
auto records = getRecords(ub, DNSName("powerdns.com."), QType::ANY, -1, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 2);
+ BOOST_REQUIRE_EQUAL(records.size(), 2U);
checkRecordExists(records, DNSName("powerdns.com."), QType::SOA, 1, 0, true);
checkRecordExists(records, DNSName("powerdns.com."), QType::AAAA, 1, 0, true);
records = getRecords(ub, DNSName("powerdns.org."), QType::ANY, -1, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 2);
+ BOOST_REQUIRE_EQUAL(records.size(), 2U);
checkRecordExists(records, DNSName("powerdns.org."), QType::SOA, 2, 0, true);
checkRecordExists(records, DNSName("powerdns.org."), QType::AAAA, 2, 0, true);
}
{
// test AAAA with zone id == -1
auto records = getRecords(ub, DNSName("powerdns.com."), QType::AAAA, -1, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 1);
+ BOOST_REQUIRE_EQUAL(records.size(), 1U);
checkRecordExists(records, DNSName("powerdns.com."), QType::AAAA, 1, 0, true);
records = getRecords(ub, DNSName("powerdns.org."), QType::AAAA, -1, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 1);
+ BOOST_REQUIRE_EQUAL(records.size(), 1U);
checkRecordExists(records, DNSName("powerdns.org."), QType::AAAA, 2, 0, true);
}
{
// test NODATA with zone id == -1
auto records = getRecords(ub, DNSName("powerdns.com."), QType::PTR, -1, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 0);
+ BOOST_REQUIRE_EQUAL(records.size(), 0U);
records = getRecords(ub, DNSName("powerdns.org."), QType::PTR, -1, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 0);
+ BOOST_REQUIRE_EQUAL(records.size(), 0U);
}
{
// test ANY with zone id set
auto records = getRecords(ub, DNSName("powerdns.com."), QType::ANY, 1, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 2);
+ BOOST_REQUIRE_EQUAL(records.size(), 2U);
checkRecordExists(records, DNSName("powerdns.com."), QType::SOA, 1, 0, true);
checkRecordExists(records, DNSName("powerdns.com."), QType::AAAA, 1, 0, true);
records = getRecords(ub, DNSName("powerdns.org."), QType::ANY, 2, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 2);
+ BOOST_REQUIRE_EQUAL(records.size(), 2U);
checkRecordExists(records, DNSName("powerdns.org."), QType::SOA, 2, 0, true);
checkRecordExists(records, DNSName("powerdns.org."), QType::AAAA, 2, 0, true);
}
{
// test AAAA with zone id set
auto records = getRecords(ub, DNSName("powerdns.com."), QType::AAAA, 1, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 1);
+ BOOST_REQUIRE_EQUAL(records.size(), 1U);
checkRecordExists(records, DNSName("powerdns.com."), QType::AAAA, 1, 0, true);
records = getRecords(ub, DNSName("www.powerdns.org."), QType::AAAA, 2, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 1);
+ BOOST_REQUIRE_EQUAL(records.size(), 1U);
checkRecordExists(records, DNSName("www.powerdns.org."), QType::AAAA, 2, 0, true);
}
{
// test NODATA with zone id set
auto records = getRecords(ub, DNSName("powerdns.com."), QType::PTR, 1, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 0);
+ BOOST_REQUIRE_EQUAL(records.size(), 0U);
records = getRecords(ub, DNSName("powerdns.org."), QType::PTR, 2, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 0);
+ BOOST_REQUIRE_EQUAL(records.size(), 0U);
}
{
// test ANY with wrong zone id
auto records = getRecords(ub, DNSName("powerdns.com."), QType::ANY, 2, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 0);
+ BOOST_REQUIRE_EQUAL(records.size(), 0U);
records = getRecords(ub, DNSName("powerdns.org."), QType::ANY, 1, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 0);
+ BOOST_REQUIRE_EQUAL(records.size(), 0U);
records = getRecords(ub, DNSName("not-powerdns.com."), QType::ANY, 65535, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 0);
+ BOOST_REQUIRE_EQUAL(records.size(), 0U);
}
{
ComboAddress remote("192.0.2.1");
pkt.setRemote(&remote);
auto records = getRecords(ub, DNSName("geo.powerdns.com."), QType::ANY, 1, &pkt);
- BOOST_REQUIRE_EQUAL(records.size(), 1);
+ BOOST_REQUIRE_EQUAL(records.size(), 1U);
checkRecordExists(records, DNSName("geo.powerdns.com."), QType::A, 1, 32, true);
// and that we don't get the same result for a different client
remote = ComboAddress("192.0.2.2");
pkt.setRemote(&remote);
records = getRecords(ub, DNSName("geo.powerdns.com."), QType::ANY, 1, &pkt);
- BOOST_REQUIRE_EQUAL(records.size(), 1);
+ BOOST_REQUIRE_EQUAL(records.size(), 1U);
checkRecordExists(records, DNSName("geo.powerdns.com."), QType::A, 1, 0, true);
}
{
// test SOA with unknown zone id == -1
auto records = getRecords(ub, DNSName("powerdns.com."), QType::SOA, -1, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 1);
+ BOOST_REQUIRE_EQUAL(records.size(), 1U);
checkRecordExists(records, DNSName("powerdns.com."), QType::SOA, 1, 0, true);
}
// test ANY with zone id == -1
auto records = getRecords(ub, DNSName("powerdns.com."), QType::ANY, -1, nullptr);
// /!\ only 3 records are returned since we don't allow spreading the same name over several backends
- BOOST_REQUIRE_EQUAL(records.size(), 3);
+ BOOST_REQUIRE_EQUAL(records.size(), 3U);
checkRecordExists(records, DNSName("powerdns.com."), QType::SOA, 1, 0, true);
checkRecordExists(records, DNSName("powerdns.com."), QType::NS, 1, 0, true);
checkRecordExists(records, DNSName("powerdns.com."), QType::A, 1, 0, true);
// test AAAA with zone id == -1
auto records = getRecords(ub, DNSName("powerdns.com."), QType::AAAA, -1, nullptr);
// /!\ the AAAA will be found on an exact search, but not on an ANY one
- BOOST_REQUIRE_EQUAL(records.size(), 1);
+ BOOST_REQUIRE_EQUAL(records.size(), 1U);
checkRecordExists(records, DNSName("powerdns.com."), QType::AAAA, 1, 0, true);
}
{
// test NODATA with zone id == -1
auto records = getRecords(ub, DNSName("powerdns.com."), QType::PTR, -1, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 0);
+ BOOST_REQUIRE_EQUAL(records.size(), 0U);
}
{
// test ANY with zone id set
auto records = getRecords(ub, DNSName("powerdns.com."), QType::ANY, 1, nullptr);
// /!\ only 3 records are returned since we don't allow spreading the same name over several backends
- BOOST_REQUIRE_EQUAL(records.size(), 3);
+ BOOST_REQUIRE_EQUAL(records.size(), 3U);
checkRecordExists(records, DNSName("powerdns.com."), QType::SOA, 1, 0, true);
checkRecordExists(records, DNSName("powerdns.com."), QType::NS, 1, 0, true);
checkRecordExists(records, DNSName("powerdns.com."), QType::A, 1, 0, true);
// test AAAA with zone id set
auto records = getRecords(ub, DNSName("powerdns.com."), QType::AAAA, 1, nullptr);
// /!\ the AAAA will be found on an exact search, but not on an ANY one
- BOOST_REQUIRE_EQUAL(records.size(), 1);
+ BOOST_REQUIRE_EQUAL(records.size(), 1U);
checkRecordExists(records, DNSName("powerdns.com."), QType::AAAA, 1, 0, true);
}
{
// test www - A with zone id set (only in the second backend)
auto records = getRecords(ub, DNSName("www.powerdns.com."), QType::A, 1, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 1);
+ BOOST_REQUIRE_EQUAL(records.size(), 1U);
checkRecordExists(records, DNSName("www.powerdns.com."), QType::A, 1, 0, true);
}
{
// test NODATA with zone id set
auto records = getRecords(ub, DNSName("powerdns.com."), QType::PTR, 1, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 0);
+ BOOST_REQUIRE_EQUAL(records.size(), 0U);
}
{
// test ANY with wrong zone id
auto records = getRecords(ub, DNSName("powerdns.com."), QType::ANY, 2, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 0);
+ BOOST_REQUIRE_EQUAL(records.size(), 0U);
}
{
ComboAddress remote("192.0.2.1");
pkt.setRemote(&remote);
auto records = getRecords(ub, DNSName("geo.powerdns.com."), QType::ANY, 1, &pkt);
- BOOST_REQUIRE_EQUAL(records.size(), 1);
+ BOOST_REQUIRE_EQUAL(records.size(), 1U);
checkRecordExists(records, DNSName("geo.powerdns.com."), QType::A, 1, 32, true);
// and that we don't get the same result for a different client
remote = ComboAddress("192.0.2.2");
pkt.setRemote(&remote);
records = getRecords(ub, DNSName("geo.powerdns.com."), QType::ANY, 1, &pkt);
- BOOST_REQUIRE_EQUAL(records.size(), 1);
+ BOOST_REQUIRE_EQUAL(records.size(), 1U);
checkRecordExists(records, DNSName("geo.powerdns.com."), QType::A, 1, 0, true);
}
{
// test SOA with unknown zone id == -1
auto records = getRecords(ub, DNSName("powerdns.com."), QType::SOA, -1, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 1);
+ BOOST_REQUIRE_EQUAL(records.size(), 1U);
checkRecordExists(records, DNSName("powerdns.com."), QType::SOA, 1, 0, true);
}
{
// test ANY with zone id == -1
auto records = getRecords(ub, DNSName("powerdns.com."), QType::ANY, -1, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 5);
+ BOOST_REQUIRE_EQUAL(records.size(), 5U);
checkRecordExists(records, DNSName("powerdns.com."), QType::SOA, 1, 0, true);
checkRecordExists(records, DNSName("powerdns.com."), QType::NS, 1, 0, true);
checkRecordExists(records, DNSName("powerdns.com."), QType::A, 1, 0, true);
{
// test AAAA with zone id == -1
auto records = getRecords(ub, DNSName("powerdns.com."), QType::AAAA, -1, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 1);
+ BOOST_REQUIRE_EQUAL(records.size(), 1U);
checkRecordExists(records, DNSName("powerdns.com."), QType::AAAA, 1, 0, true);
}
{
// test NODATA with zone id == -1
auto records = getRecords(ub, DNSName("powerdns.com."), QType::PTR, -1, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 0);
+ BOOST_REQUIRE_EQUAL(records.size(), 0U);
}
{
// test ANY with zone id set
auto records = getRecords(ub, DNSName("powerdns.com."), QType::ANY, 1, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 5);
+ BOOST_REQUIRE_EQUAL(records.size(), 5U);
checkRecordExists(records, DNSName("powerdns.com."), QType::SOA, 1, 0, true);
checkRecordExists(records, DNSName("powerdns.com."), QType::NS, 1, 0, true);
checkRecordExists(records, DNSName("powerdns.com."), QType::A, 1, 0, true);
{
// test AAAA with zone id set
auto records = getRecords(ub, DNSName("powerdns.com."), QType::AAAA, 1, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 1);
+ BOOST_REQUIRE_EQUAL(records.size(), 1U);
checkRecordExists(records, DNSName("powerdns.com."), QType::AAAA, 1, 0, true);
}
{
// test www - A with zone id set (only in the second backend)
auto records = getRecords(ub, DNSName("www.powerdns.com."), QType::A, 1, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 1);
+ BOOST_REQUIRE_EQUAL(records.size(), 1U);
checkRecordExists(records, DNSName("www.powerdns.com."), QType::A, 1, 0, true);
}
{
// test NODATA with zone id set
auto records = getRecords(ub, DNSName("powerdns.com."), QType::PTR, 1, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 0);
+ BOOST_REQUIRE_EQUAL(records.size(), 0U);
}
{
// test ANY with wrong zone id
auto records = getRecords(ub, DNSName("powerdns.com."), QType::ANY, 2, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 0);
+ BOOST_REQUIRE_EQUAL(records.size(), 0U);
}
{
ComboAddress remote("192.0.2.1");
pkt.setRemote(&remote);
auto records = getRecords(ub, DNSName("geo.powerdns.com."), QType::ANY, 1, &pkt);
- BOOST_REQUIRE_EQUAL(records.size(), 1);
+ BOOST_REQUIRE_EQUAL(records.size(), 1U);
checkRecordExists(records, DNSName("geo.powerdns.com."), QType::A, 1, 32, true);
// and that we don't get the same result for a different client
remote = ComboAddress("192.0.2.2");
pkt.setRemote(&remote);
records = getRecords(ub, DNSName("geo.powerdns.com."), QType::ANY, 1, &pkt);
- BOOST_REQUIRE_EQUAL(records.size(), 1);
+ BOOST_REQUIRE_EQUAL(records.size(), 1U);
checkRecordExists(records, DNSName("geo.powerdns.com."), QType::A, 1, 0, true);
}
{
// test SOA with unknown zone id == -1
auto records = getRecords(ub, DNSName("com."), QType::SOA, -1, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 1);
+ BOOST_REQUIRE_EQUAL(records.size(), 1U);
checkRecordExists(records, DNSName("com."), QType::SOA, 1, 0, true);
records = getRecords(ub, DNSName("powerdns.com."), QType::SOA, -1, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 1);
+ BOOST_REQUIRE_EQUAL(records.size(), 1U);
checkRecordExists(records, DNSName("powerdns.com."), QType::SOA, 2, 0, true);
}
{
// test ANY with zone id == -1
auto records = getRecords(ub, DNSName("powerdns.com."), QType::ANY, -1, nullptr);
- BOOST_REQUIRE_EQUAL(records.size(), 3);
+ BOOST_REQUIRE_EQUAL(records.size(), 3U);
checkRecordExists(records, DNSName("powerdns.com."), QType::SOA, 2, 0, true);
checkRecordExists(records, DNSName("powerdns.com."), QType::NS, 2, 0, true);
checkRecordExists(records, DNSName("powerdns.com."), QType::AAAA, 2, 0, true);
BOOST_CHECK_EQUAL(sd.qname.toString(), "d.0.1.0.0.2.ip6.arpa.");
BOOST_CHECK_EQUAL(sd.domain_id, 1);
// check that only one auth lookup occurred to this backend
- BOOST_CHECK_EQUAL(sbba->d_authLookupCount, 1);
+ BOOST_CHECK_EQUAL(sbba->d_authLookupCount, 1U);
}
};
// check the initial values
std::vector<std::string> values;
BOOST_CHECK(ub.getDomainMetadata(DNSName("powerdns.com."), "test-data-a", values));
- BOOST_REQUIRE_EQUAL(values.size(), 2);
+ BOOST_REQUIRE_EQUAL(values.size(), 2U);
BOOST_CHECK_EQUAL(values.at(0), "value1");
BOOST_CHECK_EQUAL(values.at(1), "value2");
values.clear();
BOOST_CHECK(ub.getDomainMetadata(DNSName("powerdns.com."), "test-data-b", values));
- BOOST_CHECK_EQUAL(values.size(), 0);
+ BOOST_CHECK_EQUAL(values.size(), 0U);
values.clear();
BOOST_CHECK(ub.getDomainMetadata(DNSName("powerdns.org."), "test-data-a", values));
- BOOST_CHECK_EQUAL(values.size(), 0);
+ BOOST_CHECK_EQUAL(values.size(), 0U);
values.clear();
BOOST_CHECK(ub.getDomainMetadata(DNSName("powerdns.org."), "test-data-b", values));
- BOOST_CHECK_EQUAL(values.size(), 0);
+ BOOST_CHECK_EQUAL(values.size(), 0U);
}
{
{
std::vector<std::string> values;
BOOST_CHECK(ub.getDomainMetadata(DNSName("powerdns.com."), "test-data-a", values));
- BOOST_REQUIRE_EQUAL(values.size(), 1);
+ BOOST_REQUIRE_EQUAL(values.size(), 1U);
BOOST_CHECK_EQUAL(values.at(0), "value3");
values.clear();
BOOST_CHECK(ub.getDomainMetadata(DNSName("powerdns.org."), "test-data-a", values));
- BOOST_REQUIRE_EQUAL(values.size(), 1);
+ BOOST_REQUIRE_EQUAL(values.size(), 1U);
BOOST_CHECK_EQUAL(values.at(0), "value4");
values.clear();
BOOST_CHECK(ub.getDomainMetadata(DNSName("powerdns.org."), "test-data-b", values));
- BOOST_REQUIRE_EQUAL(values.size(), 1);
+ BOOST_REQUIRE_EQUAL(values.size(), 1U);
BOOST_CHECK_EQUAL(values.at(0), "value5");
}
// check that it has not been updated in the second backend
const auto& it = SimpleBackend::s_metadata[2].find(boost::make_tuple(DNSName("powerdns.org."), "test-data-b"));
BOOST_REQUIRE(it != SimpleBackend::s_metadata[2].end());
- BOOST_REQUIRE_EQUAL(it->d_values.size(), 2);
+ BOOST_REQUIRE_EQUAL(it->d_values.size(), 2U);
BOOST_CHECK_EQUAL(it->d_values.at(0), "value1");
BOOST_CHECK_EQUAL(it->d_values.at(1), "value2");
}