@@ -9137,8 +9137,8 @@ TEST_F(HAServiceStateMachineTest, doNotTerminateWhenPartnerUnavailable) {
9137
9137
EXPECT_EQ (HA_COMMUNICATION_RECOVERY_ST, service_->getCurrState ());
9138
9138
}
9139
9139
9140
- // This test verifies that the service correctly identifies the leases that can
9141
- // be reclaimed while the server is the primary .
9140
+ // This test verifies that the service reclaims the leases while the server is
9141
+ // primary and it is in the terminated state .
9142
9142
TEST_F (HAServiceStateMachineTest, shouldReclaimLease4HotStandbyThisPrimary) {
9143
9143
startService (createValidConfiguration (HAConfig::HOT_STANDBY));
9144
9144
service_->verboseTransition (HA_TERMINATED_ST);
@@ -9148,8 +9148,19 @@ TEST_F(HAServiceStateMachineTest, shouldReclaimLease4HotStandbyThisPrimary) {
9148
9148
EXPECT_TRUE (service_->shouldReclaim (lease4));
9149
9149
}
9150
9150
9151
- // This test verifies that the service correctly identifies the leases that can
9152
- // be reclaimed while the server is the standby.
9151
+ // This test verifies that the service reclaims the leases while the server is
9152
+ // primary and it is in the non-terminated state.
9153
+ TEST_F (HAServiceStateMachineTest, shouldReclaimLease4HotStandbyThisPrimaryNotTerminated) {
9154
+ startService (createValidConfiguration (HAConfig::HOT_STANDBY));
9155
+ service_->verboseTransition (HA_READY_ST);
9156
+ service_->runModel (HAService::NOP_EVT);
9157
+
9158
+ Lease4Ptr lease4 = createLease4 (randomKey (HWAddr::ETHERNET_HWADDR_LEN));
9159
+ EXPECT_TRUE (service_->shouldReclaim (lease4));
9160
+ }
9161
+
9162
+ // This test verifies that the service does not reclaim the leases while the server is
9163
+ // standby and it is in the terminated state.
9153
9164
TEST_F (HAServiceStateMachineTest, shouldReclaimLease4HotStandbyThisStandby) {
9154
9165
HAConfigPtr valid_config = createValidConfiguration (HAConfig::HOT_STANDBY);
9155
9166
valid_config->getPeerConfig (" server2" )->setRole (" standby" );
@@ -9162,8 +9173,22 @@ TEST_F(HAServiceStateMachineTest, shouldReclaimLease4HotStandbyThisStandby) {
9162
9173
EXPECT_FALSE (service_->shouldReclaim (lease4));
9163
9174
}
9164
9175
9165
- // This test verifies that the service correctly identifies the leases that can
9166
- // be reclaimed while the server is the primary.
9176
+ // This test verifies that the service reclaims the leases while the server is
9177
+ // standby and it is in the non-terminated state.
9178
+ TEST_F (HAServiceStateMachineTest, shouldReclaimLease4HotStandbyThisStandbyNotTerminated) {
9179
+ HAConfigPtr valid_config = createValidConfiguration (HAConfig::HOT_STANDBY);
9180
+ valid_config->getPeerConfig (" server2" )->setRole (" standby" );
9181
+ valid_config->setThisServerName (" server2" );
9182
+ startService (valid_config);
9183
+ service_->verboseTransition (HA_READY_ST);
9184
+ service_->runModel (HAService::NOP_EVT);
9185
+
9186
+ Lease4Ptr lease4 = createLease4 (randomKey (HWAddr::ETHERNET_HWADDR_LEN));
9187
+ EXPECT_TRUE (service_->shouldReclaim (lease4));
9188
+ }
9189
+
9190
+ // This test verifies that the service reclaims the leases while the server is
9191
+ // primary and it is in the terminated state.
9167
9192
TEST_F (HAServiceStateMachineTest, shouldReclaimLease6HotStandbyThisPrimary) {
9168
9193
startService (createValidConfiguration (HAConfig::HOT_STANDBY));
9169
9194
service_->verboseTransition (HA_TERMINATED_ST);
@@ -9173,8 +9198,19 @@ TEST_F(HAServiceStateMachineTest, shouldReclaimLease6HotStandbyThisPrimary) {
9173
9198
EXPECT_TRUE (service_->shouldReclaim (lease6));
9174
9199
}
9175
9200
9176
- // This test verifies that the service correctly identifies the leases that can
9177
- // be reclaimed while the server is the standby.
9201
+ // This test verifies that the service reclaims the leases while the server is
9202
+ // primary and it is in the non-terminated state.
9203
+ TEST_F (HAServiceStateMachineTest, shouldReclaimLease6HotStandbyThisPrimaryNotTerminated) {
9204
+ startService (createValidConfiguration (HAConfig::HOT_STANDBY));
9205
+ service_->verboseTransition (HA_READY_ST);
9206
+ service_->runModel (HAService::NOP_EVT);
9207
+
9208
+ Lease6Ptr lease6 = createLease6 (randomKey (10 ));
9209
+ EXPECT_TRUE (service_->shouldReclaim (lease6));
9210
+ }
9211
+
9212
+ // This test verifies that the service does not reclaim the leases while the server is
9213
+ // standby and it is in the terminated state.
9178
9214
TEST_F (HAServiceStateMachineTest, shouldReclaimLease6HotStandbyThisStandby) {
9179
9215
HAConfigPtr valid_config = createValidConfiguration (HAConfig::HOT_STANDBY);
9180
9216
valid_config->getPeerConfig (" server2" )->setRole (" standby" );
@@ -9187,6 +9223,20 @@ TEST_F(HAServiceStateMachineTest, shouldReclaimLease6HotStandbyThisStandby) {
9187
9223
EXPECT_FALSE (service_->shouldReclaim (lease6));
9188
9224
}
9189
9225
9226
+ // This test verifies that the service reclaims the leases while the server is
9227
+ // standby and it is in the non-terminated state.
9228
+ TEST_F (HAServiceStateMachineTest, shouldReclaimLease6HotStandbyThisStandbyNotTerminated) {
9229
+ HAConfigPtr valid_config = createValidConfiguration (HAConfig::HOT_STANDBY);
9230
+ valid_config->getPeerConfig (" server2" )->setRole (" standby" );
9231
+ valid_config->setThisServerName (" server2" );
9232
+ startService (valid_config);
9233
+ service_->verboseTransition (HA_READY_ST);
9234
+ service_->runModel (HAService::NOP_EVT);
9235
+
9236
+ Lease6Ptr lease6 = createLease6 (randomKey (10 ));
9237
+ EXPECT_TRUE (service_->shouldReclaim (lease6));
9238
+ }
9239
+
9190
9240
// Test scenario when a single lease4 update is sent successfully, parking is not
9191
9241
// employed.
9192
9242
TEST_F (HAServiceTest, successfulSendSingleLeaseUpdateWithoutParking) {
0 commit comments