Commit b34151b6 authored by Francis Dupont's avatar Francis Dupont
Browse files

[738-kea4-crash-when-remote-network4-del-command-is-issued-with-subnets-action...

[738-kea4-crash-when-remote-network4-del-command-is-issued-with-subnets-action-delete] Addressed final comments
parent dd599e72
......@@ -2152,6 +2152,22 @@ TEST_F(MySqlConfigBackendDHCPv4Test, getSharedNetwork4WithOptionalUnspecified) {
EXPECT_FALSE(returned_network->getAuthoritative().get());
}
// Test that deleteSharedNetworkSubnets4 with not ANY selector throw.
TEST_F(MySqlConfigBackendDHCPv4Test, deleteSharedNetworkSubnets4) {
EXPECT_THROW(cbptr_->deleteSharedNetworkSubnets4(ServerSelector::UNASSIGNED(),
test_networks_[1]->getName()),
isc::InvalidOperation);
EXPECT_THROW(cbptr_->deleteSharedNetworkSubnets4(ServerSelector::ALL(),
test_networks_[1]->getName()),
isc::InvalidOperation);
EXPECT_THROW(cbptr_->deleteSharedNetworkSubnets4(ServerSelector::ONE("server1"),
test_networks_[1]->getName()),
isc::InvalidOperation);
EXPECT_THROW(cbptr_->deleteSharedNetworkSubnets4(ServerSelector::MULTIPLE({ "server1", "server2" }),
test_networks_[1]->getName()),
isc::InvalidOperation);
}
// Test that all shared networks can be fetched.
TEST_F(MySqlConfigBackendDHCPv4Test, getAllSharedNetworks4) {
// Insert test shared networks into the database. Note that the second shared
......@@ -2231,20 +2247,6 @@ TEST_F(MySqlConfigBackendDHCPv4Test, getAllSharedNetworks4) {
EXPECT_EQ(0, cbptr_->deleteAllSharedNetworks4(ServerSelector::ONE("server1")));
// Delete first shared network with it subnets and verify it is gone.
// It requires ANY so verifies that all other choices throw.
EXPECT_THROW(cbptr_->deleteSharedNetworkSubnets4(ServerSelector::UNASSIGNED(),
test_networks_[1]->getName()),
isc::InvalidOperation);
EXPECT_THROW(cbptr_->deleteSharedNetworkSubnets4(ServerSelector::ALL(),
test_networks_[1]->getName()),
isc::InvalidOperation);
EXPECT_THROW(cbptr_->deleteSharedNetworkSubnets4(ServerSelector::ONE("server1"),
test_networks_[1]->getName()),
isc::InvalidOperation);
EXPECT_THROW(cbptr_->deleteSharedNetworkSubnets4(ServerSelector::MULTIPLE({ "server1", "server2" }),
test_networks_[1]->getName()),
isc::InvalidOperation);
// Begin by its subnet.
EXPECT_EQ(1, cbptr_->deleteSharedNetworkSubnets4(ServerSelector::ANY(),
test_networks_[1]->getName()));
......
......@@ -2167,6 +2167,22 @@ TEST_F(MySqlConfigBackendDHCPv6Test, getSharedNetwork6WithOptionalUnspecified) {
EXPECT_FALSE(returned_network->getRapidCommit().get());
}
// Test that deleteSharedNetworkSubnets6 with not ANY selector throw.
TEST_F(MySqlConfigBackendDHCPv6Test, deleteSharedNetworkSubnets6) {
EXPECT_THROW(cbptr_->deleteSharedNetworkSubnets6(ServerSelector::UNASSIGNED(),
test_networks_[1]->getName()),
isc::InvalidOperation);
EXPECT_THROW(cbptr_->deleteSharedNetworkSubnets6(ServerSelector::ALL(),
test_networks_[1]->getName()),
isc::InvalidOperation);
EXPECT_THROW(cbptr_->deleteSharedNetworkSubnets6(ServerSelector::ONE("server1"),
test_networks_[1]->getName()),
isc::InvalidOperation);
EXPECT_THROW(cbptr_->deleteSharedNetworkSubnets6(ServerSelector::MULTIPLE({ "server1", "server2" }),
test_networks_[1]->getName()),
isc::InvalidOperation);
}
// Test that all shared networks can be fetched.
TEST_F(MySqlConfigBackendDHCPv6Test, getAllSharedNetworks6) {
// Insert test shared networks into the database. Note that the second shared
......@@ -2246,20 +2262,6 @@ TEST_F(MySqlConfigBackendDHCPv6Test, getAllSharedNetworks6) {
EXPECT_EQ(0, cbptr_->deleteAllSharedNetworks6(ServerSelector::ONE("server1")));
// Delete first shared network with it subnets and verify it is gone.
// It requires ANY so verifies that all other choices throw.
EXPECT_THROW(cbptr_->deleteSharedNetworkSubnets6(ServerSelector::UNASSIGNED(),
test_networks_[1]->getName()),
isc::InvalidOperation);
EXPECT_THROW(cbptr_->deleteSharedNetworkSubnets6(ServerSelector::ALL(),
test_networks_[1]->getName()),
isc::InvalidOperation);
EXPECT_THROW(cbptr_->deleteSharedNetworkSubnets6(ServerSelector::ONE("server1"),
test_networks_[1]->getName()),
isc::InvalidOperation);
EXPECT_THROW(cbptr_->deleteSharedNetworkSubnets6(ServerSelector::MULTIPLE({ "server1", "server2" }),
test_networks_[1]->getName()),
isc::InvalidOperation);
// Begin by its subnet.
EXPECT_EQ(1, cbptr_->deleteSharedNetworkSubnets6(ServerSelector::ANY(),
test_networks_[1]->getName()));
......
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