]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[50-dhcp-hook-libs-should-not-be-loadable-by-ca-d2] Reordered tests
authorFrancis Dupont <fdupont@isc.org>
Sat, 23 Nov 2019 16:53:50 +0000 (17:53 +0100)
committerFrancis Dupont <fdupont@isc.org>
Mon, 25 Nov 2019 12:46:41 +0000 (13:46 +0100)
src/hooks/dhcp/high_availability/libloadtests/load_unload_unittests.cc

index 40ccfc6474a9e1fb29c0b40d89367d275af3f30b..c2d64490691f341a115e4b0ee7da5b312b8ba9ac 100644 (file)
@@ -109,9 +109,8 @@ LibLoadTest::createValidJsonConfiguration() const {
     return (Element::fromJSON(config_text));
 }
 
-// Simple test that checks the library can be loaded and unloaded several times.
-TEST_F(LibLoadTest, validLoadsDhcp4) {
-
+// Simple test that checks the library can be loaded in a DHCPv4 server.
+TEST_F(LibLoadTest, validLoadDhcp4) {
     // Prepare parameters,
     ElementPtr params = Element::createMap();
     params->set("high-availability", createValidJsonConfiguration());
@@ -121,17 +120,11 @@ TEST_F(LibLoadTest, validLoadsDhcp4) {
     Daemon::setProcName("kea-dhcp4");
 
     addLib(HA_LIB_SO, params);
-
     EXPECT_TRUE(loadLibs());
-    unloadLibs();
-
-    EXPECT_TRUE(loadLibs());
-    unloadLibs();
 }
 
-// Simple test that checks the library can be loaded and unloaded several times.
-TEST_F(LibLoadTest, validLoadsDhcp6) {
-
+// Simple test that checks the library can be loaded in a DHCPv6 server.
+TEST_F(LibLoadTest, validLoadDhcp6) {
     // Prepare parameters,
     ElementPtr params = Element::createMap();
     params->set("high-availability", createValidJsonConfiguration());
@@ -141,15 +134,11 @@ TEST_F(LibLoadTest, validLoadsDhcp6) {
     Daemon::setProcName("kea-dhcp6");
 
     addLib(HA_LIB_SO, params);
-
     EXPECT_TRUE(loadLibs());
-    unloadLibs();
-
-    EXPECT_TRUE(loadLibs());
-    unloadLibs();
 }
 
-// Simple test that checks the library can be loaded in a DHCPv4 server.
+// Simple test that checks the library can be loaded in a DHCPv4 server
+// only if it is set for IP.
 TEST_F(LibLoadTest, invalidLoadDhcp4) {
     // Prepare parameters,
     ElementPtr params = Element::createMap();
@@ -165,7 +154,8 @@ TEST_F(LibLoadTest, invalidLoadDhcp4) {
     EXPECT_FALSE(loadLibs());
 }
 
-// Simple test that checks the library can be loaded in a DHCPv6 server.
+// Simple test that checks the library can be loaded in a DHCPv6 server
+// only if it is set for IPv6.
 TEST_F(LibLoadTest, invalidLoadDhcp6) {
     // Prepare parameters,
     ElementPtr params = Element::createMap();
@@ -181,8 +171,10 @@ TEST_F(LibLoadTest, invalidLoadDhcp6) {
     EXPECT_FALSE(loadLibs());
 }
 
-// Simple test that checks the library can be loaded in a DHCPv4 server.
-TEST_F(LibLoadTest, validLoadDhcp4) {
+// Simple test that checks the library can be loaded and unloaded several times
+// in a DHCPv4 server.
+TEST_F(LibLoadTest, validLoadsDhcp4) {
+
     // Prepare parameters,
     ElementPtr params = Element::createMap();
     params->set("high-availability", createValidJsonConfiguration());
@@ -192,11 +184,18 @@ TEST_F(LibLoadTest, validLoadDhcp4) {
     Daemon::setProcName("kea-dhcp4");
 
     addLib(HA_LIB_SO, params);
+
     EXPECT_TRUE(loadLibs());
+    unloadLibs();
+
+    EXPECT_TRUE(loadLibs());
+    unloadLibs();
 }
 
-// Simple test that checks the library can be loaded in a DHCPv6 server.
-TEST_F(LibLoadTest, validLoadDhcp6) {
+// Simple test that checks the library can be loaded and unloaded several times
+// in a DHCPv6 server.
+TEST_F(LibLoadTest, validLoadsDhcp6) {
+
     // Prepare parameters,
     ElementPtr params = Element::createMap();
     params->set("high-availability", createValidJsonConfiguration());
@@ -206,7 +205,12 @@ TEST_F(LibLoadTest, validLoadDhcp6) {
     Daemon::setProcName("kea-dhcp6");
 
     addLib(HA_LIB_SO, params);
+
     EXPECT_TRUE(loadLibs());
+    unloadLibs();
+
+    EXPECT_TRUE(loadLibs());
+    unloadLibs();
 }
 
 } // end of anonymous namespace