Skip to content

Commit

Permalink
[#3110] Post rebase corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
tmarkwalder committed Dec 1, 2023
1 parent 9d205f0 commit 41f0410
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/hooks/dhcp/high_availability/ha_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ HAImpl::lease4ServerDecline(CalloutHandle& callout_handle) {
// If the hook library is configured to not send lease updates to the
// partner, there is nothing to do because this whole callout is
// currently about sending lease updates.
if (!config_->amSendingLeaseUpdates()) {
if (!config_->get()->amSendingLeaseUpdates()) {
// No need to log it, because it was already logged when configuration
// was applied.
callout_handle.setArgument("peers_to_update", peers_to_update);
Expand All @@ -214,7 +214,7 @@ HAImpl::lease4ServerDecline(CalloutHandle& callout_handle) {
// Asynchronously send the lease update. In some cases no updates will be sent,
// e.g. when this server is in the partner-down state and there are no backup
// servers.
peers_to_update = service_->asyncSendSingleLeaseUpdate(query4, lease4, 0);
peers_to_update = services_->get()->asyncSendSingleLeaseUpdate(query4, lease4, 0);
callout_handle.setArgument("peers_to_update", peers_to_update);
}

Expand Down
14 changes: 9 additions & 5 deletions src/hooks/dhcp/high_availability/tests/ha_impl_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1294,13 +1294,17 @@ TEST_F(HAImplTest, haScopesBadServerName) {
TEST_F(HAImplTest, lease4ServerDecline) {
// Create implementation object and configure it.
TestHAImpl ha_impl;
ASSERT_NO_THROW(ha_impl.startService(io_service_, network_state,
HAServerType::DHCPv4));
ASSERT_NO_THROW(ha_impl.configure(createValidJsonConfiguration()));

// Starting the service is required prior to running any callouts.
NetworkStatePtr network_state(new NetworkState(NetworkState::DHCPv4));
ASSERT_NO_THROW(ha_impl.startServices(io_service_, network_state,
HAServerType::DHCPv4));

// Make sure we wait for the acks from the backup server to be able to
// test the case of sending lease updates even though the service is
// in the state in which the lease updates are normally not sent.
ha_impl.config_->setWaitBackupAck(true);
ha_impl.config_->get()->setWaitBackupAck(true);

// Create callout handle to be used for passing arguments to the
// callout.
Expand All @@ -1325,7 +1329,7 @@ TEST_F(HAImplTest, lease4ServerDecline) {
// Set initial status.
callout_handle->setStatus(CalloutHandle::NEXT_STEP_CONTINUE);

ha_impl.config_->setSendLeaseUpdates(false);
ha_impl.config_->get()->setSendLeaseUpdates(false);

// Run the callout.
ASSERT_NO_THROW(ha_impl.lease4ServerDecline(*callout_handle));
Expand All @@ -1338,7 +1342,7 @@ TEST_F(HAImplTest, lease4ServerDecline) {
EXPECT_EQ(peers_to_update, 0);

// Enable updates and retry.
ha_impl.config_->setSendLeaseUpdates(true);
ha_impl.config_->get()->setSendLeaseUpdates(true);
callout_handle->setArgument("lease4", lease4);

// Run the callout again.
Expand Down

0 comments on commit 41f0410

Please sign in to comment.