Commit 5d4fa4ed authored by Francis Dupont's avatar Francis Dupont
Browse files

[3504b] Rewrote ReleaseNoSubnet unit test

parent e40a9124
......@@ -259,4 +259,27 @@ TEST_F(ReleaseTest, releaseNonMatchingIPAddress) {
ASSERT_TRUE(lease);
}
// This test verifies that incoming RELEASE from a bad location
// is correctly dropped.
TEST_F(ReleaseTest, ReleaseNoSubnet) {
Dhcp4Client client(Dhcp4Client::SELECTING);
// Configure DHCP server.
configure(RELEASE_CONFIGS[0], *client.getServer());
// Perform 4-way exchange to obtain a new lease.
acquireLease(client);
// Remember the acquired address.
IOAddress leased_address = client.config_.lease_.addr_;
// Release is as it was relayed
client.useRelay(true);
// Send the release
ASSERT_NO_THROW(client.doRelease());
// Check that the lease was not removed (due to no subnet)
Lease4Ptr lease = LeaseMgrFactory::instance().getLease4(leased_address);
EXPECT_TRUE(lease);
}
} // end of anonymous namespace
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment