mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-31 22:15:23 +00:00
[#2815] Extend unit test
This commit is contained in:
@@ -3463,6 +3463,39 @@ HostMgrTest::testGetAllbyHostnameSubnet6(BaseHostDataSource& data_source1,
|
||||
// Make sure that hostname is correct including its case.
|
||||
EXPECT_EQ("Host", hosts[0]->getHostname());
|
||||
EXPECT_EQ("hosT", hosts[1]->getHostname());
|
||||
|
||||
// Make sure that the operation target is supported.
|
||||
bool is_first_source_primary = isPrimaryDataSource(data_source1);
|
||||
bool is_second_source_primary = isPrimaryDataSource(data_source2);
|
||||
size_t hosts_in_primary_source = is_first_source_primary + is_second_source_primary;
|
||||
|
||||
// Select hosts only from the primary source.
|
||||
hosts = HostMgr::instance().getAllbyHostname6("host", SubnetID(1), HostMgrOperationTarget::PRIMARY_SOURCE);
|
||||
EXPECT_EQ(hosts_in_primary_source, hosts.size());
|
||||
if (is_first_source_primary) {
|
||||
EXPECT_TRUE(hosts[0]->hasReservation(
|
||||
IPv6Resrv(IPv6Resrv::TYPE_NA, IOAddress("2001:db8:1::5"))));
|
||||
}
|
||||
if (is_second_source_primary) {
|
||||
EXPECT_TRUE(hosts[hosts_in_primary_source-1]->hasReservation(
|
||||
IPv6Resrv(IPv6Resrv::TYPE_NA, IOAddress("2001:db8:1::6"))));
|
||||
}
|
||||
|
||||
// Select hosts only from the alternate sources.
|
||||
hosts = HostMgr::instance().getAllbyHostname6("host", SubnetID(1), HostMgrOperationTarget::ALTERNATE_SOURCES);
|
||||
EXPECT_EQ(2 - hosts_in_primary_source, hosts.size());
|
||||
if (!is_first_source_primary) {
|
||||
EXPECT_TRUE(hosts[0]->hasReservation(
|
||||
IPv6Resrv(IPv6Resrv::TYPE_NA, IOAddress("2001:db8:1::5"))));
|
||||
}
|
||||
if (!is_second_source_primary) {
|
||||
EXPECT_TRUE(hosts[2 - hosts_in_primary_source - 1]->hasReservation(
|
||||
IPv6Resrv(IPv6Resrv::TYPE_NA, IOAddress("2001:db8:1::6"))));
|
||||
}
|
||||
|
||||
// Select hosts for an unspecified source.
|
||||
hosts = HostMgr::instance().getAllbyHostname6("host", SubnetID(1), HostMgrOperationTarget::UNSPECIFIED_SOURCE);
|
||||
EXPECT_EQ(0, hosts.size());
|
||||
}
|
||||
|
||||
void
|
||||
|
Reference in New Issue
Block a user