Commit 019d977b authored by Francis Dupont's avatar Francis Dupont
Browse files

[5533a] Reverted add() to return void

parent 3016b711
......@@ -247,8 +247,7 @@ public:
/// is identified by HW address, another one by DUID.
///
/// @param host Pointer to the new @c Host object being added.
/// @return true if addition was successful.
virtual bool add(const HostPtr& host) = 0;
virtual void add(const HostPtr& host) = 0;
/// @brief Attempts to delete a host by (subnet-id, address)
///
......
......@@ -22,7 +22,7 @@ public:
/// @brief Insert a host into the cache.
///
/// Does the same than @c add() but with a different purpose.
/// Similar to @c add() but with a different purpose.
///
/// @param host Pointer to the new @c Host object being inserted.
/// @param[in,out] overwrite -1 if accepting conflicts, 0 if removing
......
// Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2014-2017 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -549,7 +549,7 @@ CfgHosts::getHostInternal(const SubnetID& subnet_id, const bool subnet6,
return (host);
}
bool
void
CfgHosts::add(const HostPtr& host) {
LOG_DEBUG(hosts_logger, HOSTS_DBG_TRACE, HOSTS_CFG_ADD_HOST)
.arg(host ? host->toText() : "(no-host)");
......@@ -569,8 +569,6 @@ CfgHosts::add(const HostPtr& host) {
add4(host);
add6(host);
return (true);
}
void
......
// Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2014-2017 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -318,10 +318,9 @@ public:
///
/// @param host Pointer to the new @c Host object being added.
///
/// @return always return true as additions are successful or throw.
/// @throw DuplicateHost If a host for a particular HW address or DUID
/// has already been added to the IPv4 or IPv6 subnet.
virtual bool add(const HostPtr& host);
virtual void add(const HostPtr& host);
/// @brief Attempts to delete a host by address.
///
......
......@@ -1782,13 +1782,11 @@ CqlHostDataSource::~CqlHostDataSource() {
delete impl_;
}
bool
void
CqlHostDataSource::add(const HostPtr& host) {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_CQL_HOST_ADD);
impl_->add(host);
return (true);
}
ConstHostCollection
......
......@@ -98,8 +98,7 @@ public:
/// Host, where one instance is identified by different identifier types.
///
/// @param host pointer to the new @ref Host being added.
/// @return true as addition is successful or throws.
virtual bool add(const HostPtr& host) override;
virtual void add(const HostPtr& host) override;
/// @brief Retrieves a single @ref Host connected to an IPv4 subnet.
///
......
......@@ -404,7 +404,7 @@ HostMgr::get6(const SubnetID& subnet_id,
return (host);
}
bool
void
HostMgr::add(const HostPtr& host) {
if (alternate_sources_.empty()) {
isc_throw(NoHostDataSourceManager, "Unable to add new host because there is "
......@@ -412,12 +412,12 @@ HostMgr::add(const HostPtr& host) {
}
for (auto it = alternate_sources_.begin();
it != alternate_sources_.end(); ++it) {
if ((*it)->add(host)) {
return (true);
}
(*it)->add(host);
}
// If no backend throws it should be cached.
if (cache_ptr_) {
cache(host);
}
// This should never happen as at least one backend implements addition.
return (false);
}
bool
......
......@@ -315,8 +315,7 @@ public:
/// in use.
///
/// @param host Pointer to the new @c Host object being added.
/// @return true if addition was successful.
virtual bool add(const HostPtr& host);
virtual void add(const HostPtr& host);
/// @brief Attempts to delete a host by address.
///
......
// Copyright (C) 2015-2018 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2015-2017 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -2562,7 +2562,7 @@ MySqlHostDataSource::~MySqlHostDataSource() {
delete impl_;
}
bool
void
MySqlHostDataSource::add(const HostPtr& host) {
// If operating in read-only mode, throw exception.
impl_->checkReadOnly();
......@@ -2607,8 +2607,6 @@ MySqlHostDataSource::add(const HostPtr& host) {
// Everything went fine, so explicitly commit the transaction.
transaction.commit();
return (true);
}
bool
......
// Copyright (C) 2015-2018 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2015-2017 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -223,8 +223,7 @@ public:
/// one instance is identified by HW address, another one by DUID.
///
/// @param host Pointer to the new @c Host object being added.
/// @return true as addition is successful or throws.
virtual bool add(const HostPtr& host);
virtual void add(const HostPtr& host);
/// @brief Attempts to delete a host by (subnet-id, address)
///
......
......@@ -1934,7 +1934,7 @@ PgSqlHostDataSource::~PgSqlHostDataSource() {
delete impl_;
}
bool
void
PgSqlHostDataSource::add(const HostPtr& host) {
// If operating in read-only mode, throw exception.
impl_->checkReadOnly();
......@@ -1977,8 +1977,6 @@ PgSqlHostDataSource::add(const HostPtr& host) {
// Everything went fine, so explicitly commit the transaction.
transaction.commit();
return (true);
}
bool
......
// Copyright (C) 2016-2018 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2016-2017 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -247,10 +247,9 @@ public:
/// -# Address and Prefix Length must be unique (DuplicateEntry)
///
/// @param host Pointer to the new @c Host object being added.
/// @return true as addition is successful or throws.
/// @throw DuplicateEntry or DbOperationError dependent on the constraint
/// violation
virtual bool add(const HostPtr& host);
virtual void add(const HostPtr& host);
/// @brief Attempts to delete a host by (subnet-id, address)
///
......
......@@ -37,7 +37,7 @@ public:
virtual ~TestHostCache() { }
/// Override add
bool add(const HostPtr& host) {
void add(const HostPtr& host) {
isc_throw(NotImplemented,
"add is not implemented: " << host->toText());
}
......@@ -165,9 +165,7 @@ TEST_F(HostCacheTest, identifier4) {
const IOAddress& address = host->getIPv4Reservation();
// Try to add it to the host data source.
bool added = false;
ASSERT_NO_THROW(added = memptr_->add(host));
EXPECT_TRUE(added);
ASSERT_NO_THROW(memptr_->add(host));
// Try to get it cached.
ConstHostPtr got = HostMgr::instance().get4(host->getIPv4SubnetID(),
......@@ -224,9 +222,7 @@ TEST_F(HostCacheTest, identifier6) {
ASSERT_EQ("2001:db8::1", address.toText());
// Try to add it to the host data source.
bool added = false;
ASSERT_NO_THROW(added = memptr_->add(host));
EXPECT_TRUE(added);
ASSERT_NO_THROW(memptr_->add(host));
// Try to get it cached.
ConstHostPtr got = HostMgr::instance().get6(host->getIPv6SubnetID(),
......@@ -277,9 +273,7 @@ TEST_F(HostCacheTest, address4) {
const IOAddress& address = host->getIPv4Reservation();
// Try to add it to the host data source.
bool added = false;
ASSERT_NO_THROW(added = memptr_->add(host));
EXPECT_TRUE(added);
ASSERT_NO_THROW(memptr_->add(host));
// Try to get it cached.
ConstHostPtr got = HostMgr::instance().get4(host->getIPv4SubnetID(),
......@@ -334,9 +328,7 @@ TEST_F(HostCacheTest, address6) {
ASSERT_EQ("2001:db8::1", address.toText());
// Try to add it to the host data source.
bool added = false;
ASSERT_NO_THROW(added = memptr_->add(host));
EXPECT_TRUE(added);
ASSERT_NO_THROW(memptr_->add(host));
// Try to get it cached.
ConstHostPtr got = HostMgr::instance().get6(host->getIPv6SubnetID(),
......
......@@ -196,9 +196,7 @@ GenericHostDataSourceTest::testReadOnlyDatabase(const char* valid_db_type) {
// insert some data to the database.
HostPtr host = HostDataSourceUtils::initializeHost6("2001:db8::1", Host::IDENT_DUID, false);
ASSERT_TRUE(host);
bool added = false;
ASSERT_NO_THROW(added = hdsptr_->add(host));
EXPECT_TRUE(added);
ASSERT_NO_THROW(hdsptr_->add(host));
// Subnet id will be used in queries to the database.
SubnetID subnet_id = host->getIPv6SubnetID();
......@@ -247,9 +245,7 @@ GenericHostDataSourceTest::testBasic4(const Host::IdentifierType& id) {
SubnetID subnet = host->getIPv4SubnetID();
// Try to add it to the host data source.
bool added = false;
ASSERT_NO_THROW(added = hdsptr_->add(host));
EXPECT_TRUE(added);
ASSERT_NO_THROW(hdsptr_->add(host));
// This should not return anything
ConstHostPtr from_hds = hdsptr_->get4(subnet, IOAddress("10.10.10.10"));
......@@ -275,15 +271,10 @@ GenericHostDataSourceTest::testGetByIPv4(const Host::IdentifierType& id) {
HostPtr host4 = HostDataSourceUtils::initializeHost4("192.0.2.4", id);
// ... and add them to the data source.
bool added = false;
ASSERT_NO_THROW(added = hdsptr_->add(host1));
EXPECT_TRUE(added);
ASSERT_NO_THROW(added = hdsptr_->add(host2));
EXPECT_TRUE(added);
ASSERT_NO_THROW(added = hdsptr_->add(host3));
EXPECT_TRUE(added);
ASSERT_NO_THROW(added = hdsptr_->add(host4));
EXPECT_TRUE(added);
ASSERT_NO_THROW(hdsptr_->add(host1));
ASSERT_NO_THROW(hdsptr_->add(host2));
ASSERT_NO_THROW(hdsptr_->add(host3));
ASSERT_NO_THROW(hdsptr_->add(host4));
SubnetID subnet1 = host1->getIPv4SubnetID();
SubnetID subnet2 = host2->getIPv4SubnetID();
......@@ -326,11 +317,8 @@ GenericHostDataSourceTest::testGet4ByIdentifier(
ASSERT_FALSE(host1->getIdentifier() == host2->getIdentifier());
// Try to add both of them to the host data source.
bool added = false;
ASSERT_NO_THROW(added = hdsptr_->add(host1));
EXPECT_TRUE(added);
ASSERT_NO_THROW(added = hdsptr_->add(host2));
EXPECT_TRUE(added);
ASSERT_NO_THROW(hdsptr_->add(host1));
ASSERT_NO_THROW(hdsptr_->add(host2));
SubnetID subnet1 = host1->getIPv4SubnetID();
SubnetID subnet2 = host2->getIPv4SubnetID();
......@@ -361,9 +349,7 @@ GenericHostDataSourceTest::testHWAddrNotClientId() {
ASSERT_FALSE(host->getDuid());
// Try to add it to the host data source.
bool added = false;
ASSERT_NO_THROW(added = hdsptr_->add(host));
EXPECT_TRUE(added);
ASSERT_NO_THROW(hdsptr_->add(host));
SubnetID subnet = host->getIPv4SubnetID();
......@@ -395,9 +381,7 @@ GenericHostDataSourceTest::testClientIdNotHWAddr() {
ASSERT_TRUE(host->getDuid());
// Try to add it to the host data source.
bool added = false;
ASSERT_NO_THROW(added = hdsptr_->add(host));
EXPECT_TRUE(added);
ASSERT_NO_THROW(hdsptr_->add(host));
SubnetID subnet = host->getIPv4SubnetID();
......@@ -450,9 +434,7 @@ GenericHostDataSourceTest::testHostname(std::string name, int num) {
for (vector<HostPtr>::const_iterator it = hosts.begin(); it != hosts.end();
++it) {
// Try to add both of the to the host data source.
bool added = false;
ASSERT_NO_THROW(added = hdsptr_->add(*it));
EXPECT_TRUE(added);
ASSERT_NO_THROW(hdsptr_->add(*it));
}
// And finally retrieve them one by one and check
......@@ -481,9 +463,7 @@ GenericHostDataSourceTest::testUserContext(ConstElementPtr user_context) {
SubnetID subnet = host->getIPv4SubnetID();
// Try to add it to the host data source.
bool added = false;
ASSERT_NO_THROW(added = hdsptr_->add(host));
EXPECT_TRUE(added);
ASSERT_NO_THROW(hdsptr_->add(host));
// Retrieve it.
ConstHostPtr from_hds = hdsptr_->get4(subnet, IOAddress("192.0.2.1"));
......@@ -500,9 +480,8 @@ GenericHostDataSourceTest::testUserContext(ConstElementPtr user_context) {
host->setHostname("foo.example.com");
subnet = host->getIPv6SubnetID();
ASSERT_NO_THROW(added = hdsptr_->add(host));
EXPECT_TRUE(added);
ASSERT_NO_THROW(hdsptr_->add(host));
from_hds = hdsptr_->get6(subnet, Host::IDENT_HWADDR,
&host->getIdentifier()[0],
host->getIdentifier().size());
......@@ -524,9 +503,7 @@ GenericHostDataSourceTest::testMultipleSubnets(int subnets,
host->setIPv4SubnetID(i + 1000);
// Check that the same host can have reservations in multiple subnets.
bool added = false;
EXPECT_NO_THROW(added = hdsptr_->add(host));
EXPECT_TRUE(added);
EXPECT_NO_THROW(hdsptr_->add(host));
}
// Now check that the reservations can be retrieved by IPv4 address from
......@@ -600,11 +577,8 @@ GenericHostDataSourceTest::testGet6ByHWAddr() {
HostDataSourceUtils::compareHwaddrs(host1, host2, false);
// Try to add both of them to the host data source.
bool added = false;
ASSERT_NO_THROW(added = hdsptr_->add(host1));
EXPECT_TRUE(added);
ASSERT_NO_THROW(added = hdsptr_->add(host2));
EXPECT_TRUE(added);
ASSERT_NO_THROW(hdsptr_->add(host1));
ASSERT_NO_THROW(hdsptr_->add(host2));
SubnetID subnet1 = host1->getIPv6SubnetID();
SubnetID subnet2 = host2->getIPv6SubnetID();
......@@ -640,11 +614,8 @@ GenericHostDataSourceTest::testGet6ByClientId() {
HostDataSourceUtils::compareDuids(host1, host2, false);
// Try to add both of them to the host data source.
bool added = false;
ASSERT_NO_THROW(added = hdsptr_->add(host1));
EXPECT_TRUE(added);
ASSERT_NO_THROW(added = hdsptr_->add(host2));
EXPECT_TRUE(added);
ASSERT_NO_THROW(hdsptr_->add(host1));
ASSERT_NO_THROW(hdsptr_->add(host2));
SubnetID subnet1 = host1->getIPv6SubnetID();
SubnetID subnet2 = host2->getIPv6SubnetID();
......@@ -680,9 +651,7 @@ GenericHostDataSourceTest::testSubnetId6(int subnets, Host::IdentifierType id) {
host->setIPv6SubnetID(i + 1000);
// Check that the same host can have reservations in multiple subnets.
bool added = false;
EXPECT_NO_THROW(added = hdsptr_->add(host));
EXPECT_TRUE(added);
EXPECT_NO_THROW(hdsptr_->add(host));
// Increase address to make sure we don't assign the same address
// in different subnets.
......@@ -730,15 +699,10 @@ GenericHostDataSourceTest::testGetByIPv6(Host::IdentifierType id, bool prefix) {
HostPtr host4 = HostDataSourceUtils::initializeHost6("2001:db8::4", id, prefix);
// ... and add them to the data source.
bool added = false;
ASSERT_NO_THROW(added = hdsptr_->add(host1));
EXPECT_TRUE(added);
ASSERT_NO_THROW(added = hdsptr_->add(host2));
EXPECT_TRUE(added);
ASSERT_NO_THROW(added = hdsptr_->add(host3));
EXPECT_TRUE(added);
ASSERT_NO_THROW(added = hdsptr_->add(host4));
EXPECT_TRUE(added);
ASSERT_NO_THROW(hdsptr_->add(host1));
ASSERT_NO_THROW(hdsptr_->add(host2));
ASSERT_NO_THROW(hdsptr_->add(host3));
ASSERT_NO_THROW(hdsptr_->add(host4));
// Are we talking about addresses or prefixes?
uint8_t len = prefix ? 64 : 128;
......@@ -778,15 +742,10 @@ GenericHostDataSourceTest::testGetBySubnetIPv6() {
HostPtr host4 = HostDataSourceUtils::initializeHost6("2001:db8:4::", Host::IDENT_DUID, true);
// ... and add them to the data source.
bool added = false;
ASSERT_NO_THROW(added = hdsptr_->add(host1));
EXPECT_TRUE(added);
ASSERT_NO_THROW(added = hdsptr_->add(host2));
EXPECT_TRUE(added);
ASSERT_NO_THROW(added = hdsptr_->add(host3));
EXPECT_TRUE(added);
ASSERT_NO_THROW(added = hdsptr_->add(host4));
EXPECT_TRUE(added);
ASSERT_NO_THROW(hdsptr_->add(host1));
ASSERT_NO_THROW(hdsptr_->add(host2));
ASSERT_NO_THROW(hdsptr_->add(host3));
ASSERT_NO_THROW(hdsptr_->add(host4));
// And then try to retrieve them back.
ConstHostPtr from_hds1 = hdsptr_->get6(host1->getIPv6SubnetID(), IOAddress("2001:db8:1::"));
......@@ -816,9 +775,7 @@ GenericHostDataSourceTest::testAddDuplicate6WithSameDUID() {
HostPtr host = HostDataSourceUtils::initializeHost6("2001:db8::1", Host::IDENT_DUID, true);
// Add this reservation once.
bool added = false;
ASSERT_NO_THROW(added = hdsptr_->add(host));
EXPECT_TRUE(added);
ASSERT_NO_THROW(hdsptr_->add(host));
// Then try to add it again, it should throw an exception.
ASSERT_THROW(hdsptr_->add(host), DuplicateEntry);
......@@ -833,9 +790,7 @@ GenericHostDataSourceTest::testAddDuplicate6WithSameHWAddr() {
HostPtr host = HostDataSourceUtils::initializeHost6("2001:db8::1", Host::IDENT_HWADDR, true);
// Add this reservation once.
bool added = false;
ASSERT_NO_THROW(added = hdsptr_->add(host));
EXPECT_TRUE(added);
ASSERT_NO_THROW(hdsptr_->add(host));
// Then try to add it again, it should throw an exception.
ASSERT_THROW(hdsptr_->add(host), DuplicateEntry);
......@@ -850,9 +805,7 @@ GenericHostDataSourceTest::testAddDuplicate4() {
HostPtr host = HostDataSourceUtils::initializeHost4("192.0.2.1", Host::IDENT_DUID);
// Add this reservation once.
bool added = false;
ASSERT_NO_THROW(added = hdsptr_->add(host));
EXPECT_TRUE(added);
ASSERT_NO_THROW(hdsptr_->add(host));
// Then try to add it again, it should throw an exception.
ASSERT_THROW(hdsptr_->add(host), DuplicateEntry);
......@@ -866,8 +819,7 @@ GenericHostDataSourceTest::testAddDuplicate4() {
// Modify address to avoid its duplication and make sure
// we can now add the host.
ASSERT_NO_THROW(host->setIPv4Reservation(IOAddress("192.0.2.3")));
EXPECT_NO_THROW(added = hdsptr_->add(host));
EXPECT_TRUE(added);
EXPECT_NO_THROW(hdsptr_->add(host));
}
void
......@@ -883,9 +835,7 @@ GenericHostDataSourceTest::testAddr6AndPrefix() {
host->addReservation(resv);
// Add this reservation
bool added = false;
ASSERT_NO_THROW(added = hdsptr_->add(host));
EXPECT_TRUE(added);
ASSERT_NO_THROW(hdsptr_->add(host));
// Get this host by DUID
ConstHostPtr from_hds =
......@@ -919,9 +869,7 @@ GenericHostDataSourceTest::testMultipleReservations() {
host->addReservation(resv3);
host->addReservation(resv4);
bool added = false;
ASSERT_NO_THROW(added = hdsptr_->add(host));
EXPECT_TRUE(added);
ASSERT_NO_THROW(hdsptr_->add(host));
ConstHostPtr from_hds = hdsptr_->get6(IOAddress("2001:db8::1"), len);
......@@ -968,9 +916,7 @@ void GenericHostDataSourceTest::testOptionsReservations4(const bool formatted,
// Add a bunch of DHCPv4 and DHCPv6 options for the host.
ASSERT_NO_THROW(addTestOptions(host, formatted, DHCP4_ONLY, user_context));
// Insert host and the options into respective tables.
bool added = false;
ASSERT_NO_THROW(added = hdsptr_->add(host));
EXPECT_TRUE(added);
ASSERT_NO_THROW(hdsptr_->add(host));
// Subnet id will be used in queries to the database.
SubnetID subnet_id = host->getIPv4SubnetID();
......@@ -998,9 +944,7 @@ void GenericHostDataSourceTest::testOptionsReservations6(const bool formatted,
// Add a bunch of DHCPv4 and DHCPv6 options for the host.
ASSERT_NO_THROW(addTestOptions(host, formatted, DHCP6_ONLY, user_context));
// Insert host, options and IPv6 reservations into respective tables.
bool added = false;
ASSERT_NO_THROW(added = hdsptr_->add(host));
EXPECT_TRUE(added);
ASSERT_NO_THROW(hdsptr_->add(host));
// Subnet id will be used in queries to the database.
SubnetID subnet_id = host->getIPv6SubnetID();
......@@ -1022,9 +966,7 @@ GenericHostDataSourceTest::testOptionsReservations46(const bool formatted) {
// Add a bunch of DHCPv4 and DHCPv6 options for the host.
ASSERT_NO_THROW(addTestOptions(host, formatted, DHCP4_AND_DHCP6));
// Insert host, options and IPv6 reservations into respective tables.
bool added = false;
ASSERT_NO_THROW(added = hdsptr_->add(host));
EXPECT_TRUE(added);
ASSERT_NO_THROW(hdsptr_->add(host));
// getAll(identifier_type, identifier, identifier_size)
ConstHostCollection hosts_by_id =
......@@ -1049,9 +991,7 @@ GenericHostDataSourceTest::testMultipleClientClasses4() {
}
// Add the host.
bool added = false;
ASSERT_NO_THROW(added = hdsptr_->add(host));
EXPECT_TRUE(added);
ASSERT_NO_THROW(hdsptr_->add(host));
// Subnet id will be used in queries to the database.
SubnetID subnet_id = host->getIPv4SubnetID();
......@@ -1116,9 +1056,7 @@ GenericHostDataSourceTest::testMultipleClientClasses6() {
}
// Add the host.
bool added = false;
ASSERT_NO_THROW(added = hdsptr_->add(host));
EXPECT_TRUE(added);
ASSERT_NO_THROW(hdsptr_->add(host));
// Subnet id will be used in queries to the database.
SubnetID subnet_id = host->getIPv6SubnetID();
......@@ -1187,9 +1125,7 @@ GenericHostDataSourceTest::testMultipleClientClassesBoth() {
}
// Add the host.
bool added = false;
ASSERT_NO_THROW(added = hdsptr_->add(host));
EXPECT_TRUE(added);
ASSERT_NO_THROW(hdsptr_->add(host));
// Subnet id will be used in queries to the database.
SubnetID subnet_id = host->getIPv6SubnetID();
......@@ -1218,9 +1154,7 @@ GenericHostDataSourceTest::testMessageFields4() {
});
// Add the host.
bool added = false;
ASSERT_NO_THROW(added = hdsptr_->add(host));
EXPECT_TRUE(added);
ASSERT_NO_THROW(hdsptr_->add(host));
// Subnet id will be used in queries to the database.
SubnetID subnet_id = host->getIPv4SubnetID();
......@@ -1349,9 +1283,7 @@ void GenericHostDataSourceTest::testDeleteByAddr4() {
SubnetID subnet1 = host1->getIPv4SubnetID();
// ... and add it to the data source.
bool added = false;
ASSERT_NO_THROW(added = hdsptr_->add(host1));
EXPECT_TRUE(added);
ASSERT_NO_THROW(hdsptr_->add(host1));
// And then try to retrieve it back.
ConstHostPtr before = hdsptr_->get4(subnet1, IOAddress("192.0.2.1"));
......@@ -1378,9 +1310,7 @@ void GenericHostDataSourceTest::testDeleteById4() {
SubnetID subnet1 = host1->getIPv4SubnetID();
// ... and add it to the data source.
bool added = false;
ASSERT_NO_THROW(added = hdsptr_->add(host1));
EXPECT_TRUE(added);
ASSERT_NO_THROW(hdsptr_->add(host1));