]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3477] Applied and completed patch
authorFrancis Dupont <fdupont@isc.org>
Fri, 20 Sep 2024 08:45:07 +0000 (10:45 +0200)
committerFrancis Dupont <fdupont@isc.org>
Fri, 20 Sep 2024 11:46:27 +0000 (13:46 +0200)
src/bin/d2/tests/d2_http_command_unittest.cc
src/bin/dhcp4/tests/http_control_socket_unittest.cc
src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc
src/bin/dhcp6/tests/http_control_socket_unittest.cc

index 9629a24c5a133ef325e5e8af42806853458814d7..e47a3155d4fbf6c32f4258f8af123bf9dbc917b2 100644 (file)
@@ -429,7 +429,7 @@ public:
     void testShutdownExitValue();
 
     // This test verifies that the D2 server handles version-get commands.
-    void testGetversion();
+    void testGetVersion();
 
     // Tests that the server properly responds to list-commands command.
     void testListCommands();
@@ -688,6 +688,8 @@ TEST_F(HttpsCtrlChannelD2Test, shutdown) {
     testShutdown();
 }
 
+// Tests that the server sets exit value supplied as argument
+// to shutdown command.
 void
 BaseCtrlChannelD2Test::testShutdownExitValue() {
     EXPECT_NO_THROW(createHttpChannelServer());
@@ -703,21 +705,17 @@ BaseCtrlChannelD2Test::testShutdownExitValue() {
     EXPECT_EQ(77, server_->getExitValue());
 }
 
-// Tests that the server sets exit value supplied as argument
-// to shutdown command.
 TEST_F(HttpCtrlChannelD2Test, shutdownExitValue) {
     testShutdownExitValue();
 }
 
-// Tests that the server sets exit value supplied as argument
-// to shutdown command.
 TEST_F(HttpsCtrlChannelD2Test, shutdownExitValue) {
     testShutdownExitValue();
 }
 
 // This test verifies that the D2 server handles version-get commands.
 void
-BaseCtrlChannelD2Test::testGetversion() {
+BaseCtrlChannelD2Test::testGetVersion() {
     EXPECT_NO_THROW(createHttpChannelServer());
     string response;
 
@@ -733,12 +731,12 @@ BaseCtrlChannelD2Test::testGetversion() {
     EXPECT_TRUE(response.find("GTEST_VERSION") != string::npos);
 }
 
-TEST_F(HttpCtrlChannelD2Test, getversion) {
-    testGetversion();
+TEST_F(HttpCtrlChannelD2Test, getVersion) {
+    testGetVersion();
 }
 
-TEST_F(HttpsCtrlChannelD2Test, getversion) {
-    testGetversion();
+TEST_F(HttpsCtrlChannelD2Test, getVersion) {
+    testGetVersion();
 }
 
 // Tests that the server properly responds to list-commands command.
@@ -1728,7 +1726,7 @@ BaseCtrlChannelD2Test::testLongCommand() {
 
     ostringstream command;
 
-    // This is the desired size of the command sent to the server (MB).
+    // This is the desired size of the command sent to the server (1MB).
     // The actual size sent will be slightly greater than that.
     const size_t command_size = 1024 * 1000;
 
@@ -1842,4 +1840,4 @@ TEST_F(HttpsCtrlChannelD2Test, connectionTimeoutNoData) {
     testConnectionTimeoutNoData();
 }
 
-} // End of anonymous namespace
+} // end of anonymous namespace
index 085b8c30c6ee24cadf40649cebc8d82e2cbb3961..684a44870e5449b8ca850f45a458358e941990e0 100644 (file)
@@ -937,7 +937,7 @@ TEST_F(HttpsCtrlChannelDhcpv4Test, controlChannelStats) {
     testControlChannelStats();
 }
 
-// Check that the "config-set" command will replace current configuration
+// Check that the "config-set" command will replace current configuration.
 TEST_F(HttpCtrlChannelDhcpv4Test, configSet) {
     createHttpChannelServer();
 
@@ -1106,7 +1106,7 @@ TEST_F(HttpCtrlChannelDhcpv4Test, configSet) {
     CfgMgr::instance().clear();
 }
 
-// Check that the "config-set" command will replace current configuration
+// Check that the "config-set" command will replace current configuration.
 TEST_F(HttpsCtrlChannelDhcpv4Test, configSet) {
     createHttpChannelServer();
 
@@ -1507,7 +1507,6 @@ TEST_F(HttpCtrlChannelDhcpv4Test, configTest) {
 }
 
 // Verify that the "config-test" command will do what we expect.
-//////// TODO
 TEST_F(HttpsCtrlChannelDhcpv4Test, configTest) {
     createHttpChannelServer();
 
index 57bf6c1203789f0a76551795ed5cba069ea1e443..9469bc0f1569787eae61efa6392e268d381a493c 100644 (file)
@@ -559,6 +559,123 @@ TEST_F(CtrlChannelDhcpv6SrvTest, controlChannelShutdown) {
     EXPECT_EQ("{ \"result\": 0, \"text\": \"Shutting down.\" }",response);
 }
 
+// Tests that the server properly responds to statistics commands.  Note this
+// is really only intended to verify that the appropriate Statistics handler
+// is called based on the command.  It is not intended to be an exhaustive
+// test of Dhcpv6 statistics.
+TEST_F(CtrlChannelDhcpv6SrvTest, controlChannelStats) {
+    createUnixChannelServer();
+    std::string response;
+
+    // Check statistic-get
+    sendUnixCommand("{ \"command\" : \"statistic-get\", "
+                    "  \"arguments\": {"
+                    "  \"name\":\"bogus\" }}", response);
+    EXPECT_EQ("{ \"arguments\": {  }, \"result\": 0 }", response);
+
+    // Check statistic-get-all
+    sendUnixCommand("{ \"command\" : \"statistic-get-all\", "
+                    "  \"arguments\": {}}", response);
+
+    std::set<std::string> initial_stats = {
+        "pkt6-received",
+        "pkt6-solicit-received",
+        "pkt6-advertise-received",
+        "pkt6-request-received",
+        "pkt6-reply-received",
+        "pkt6-renew-received",
+        "pkt6-rebind-received",
+        "pkt6-decline-received",
+        "pkt6-release-received",
+        "pkt6-infrequest-received",
+        "pkt6-dhcpv4-query-received",
+        "pkt6-dhcpv4-response-received",
+        "pkt6-unknown-received",
+        "pkt6-sent",
+        "pkt6-advertise-sent",
+        "pkt6-reply-sent",
+        "pkt6-dhcpv4-response-sent",
+        "pkt6-parse-failed",
+        "pkt6-receive-drop",
+        "v6-allocation-fail",
+        "v6-allocation-fail-shared-network",
+        "v6-allocation-fail-subnet",
+        "v6-allocation-fail-no-pools",
+        "v6-allocation-fail-classes",
+        "v6-ia-na-lease-reuses",
+        "v6-ia-pd-lease-reuses",
+    };
+
+    std::ostringstream s;
+    bool first = true;
+    s << "{ \"arguments\": { ";
+    for (auto const& st : initial_stats) {
+        if (!first) {
+            s << ", ";
+        } else {
+            first = false;
+        }
+        s << "\"" << st << "\": [ [ 0, \"";
+        s << isc::util::clockToText(StatsMgr::instance().getObservation(st)->getInteger().second);
+        s << "\" ] ]";
+    }
+    s << " }, \"result\": 0 }";
+
+    auto stats_get_all = s.str();
+
+    EXPECT_EQ(stats_get_all, response);
+
+    // Check statistic-reset
+    sendUnixCommand("{ \"command\" : \"statistic-reset\", "
+                    "  \"arguments\": {"
+                    "  \"name\":\"bogus\" }}", response);
+    EXPECT_EQ("{ \"result\": 1, \"text\": \"No 'bogus' statistic found\" }",
+              response);
+
+    // Check statistic-reset-all
+    sendUnixCommand("{ \"command\" : \"statistic-reset-all\", "
+                    "  \"arguments\": {}}", response);
+    EXPECT_EQ("{ \"result\": 0, \"text\": "
+              "\"All statistics reset to neutral values.\" }", response);
+
+    // Check statistic-remove
+    sendUnixCommand("{ \"command\" : \"statistic-remove\", "
+                    "  \"arguments\": {"
+                    "  \"name\":\"bogus\" }}", response);
+    EXPECT_EQ("{ \"result\": 1, \"text\": \"No 'bogus' statistic found\" }",
+              response);
+
+    // Check statistic-remove-all (deprecated)
+
+    // Check statistic-sample-age-set
+    sendUnixCommand("{ \"command\" : \"statistic-sample-age-set\", "
+                    "  \"arguments\": {"
+                    "  \"name\":\"bogus\", \"duration\": 1245 }}", response);
+    EXPECT_EQ("{ \"result\": 1, \"text\": \"No 'bogus' statistic found\" }",
+              response);
+
+    // Check statistic-sample-age-set-all
+    sendUnixCommand("{ \"command\" : \"statistic-sample-age-set-all\", "
+                    "  \"arguments\": {"
+                    "  \"duration\": 1245 }}", response);
+    EXPECT_EQ("{ \"result\": 0, \"text\": \"All statistics duration limit are set.\" }",
+              response);
+
+    // Check statistic-sample-count-set
+    sendUnixCommand("{ \"command\" : \"statistic-sample-count-set\", "
+                    "  \"arguments\": {"
+                    "  \"name\":\"bogus\", \"max-samples\": 100 }}", response);
+    EXPECT_EQ("{ \"result\": 1, \"text\": \"No 'bogus' statistic found\" }",
+              response);
+
+    // Check statistic-sample-count-set-all
+    sendUnixCommand("{ \"command\" : \"statistic-sample-count-set-all\", "
+                    "  \"arguments\": {"
+                    "  \"max-samples\": 100 }}", response);
+    EXPECT_EQ("{ \"result\": 0, \"text\": \"All statistics count limit are set.\" }",
+              response);
+}
+
 // Check that the "config-set" command will replace current configuration
 TEST_F(CtrlChannelDhcpv6SrvTest, configSet) {
     createUnixChannelServer();
@@ -965,6 +1082,27 @@ TEST_F(CtrlChannelDhcpv6SrvTest, getVersion) {
     EXPECT_TRUE(response.find("GTEST_VERSION") != string::npos);
 }
 
+// This test verifies that the DHCP server handles server-tag-get command
+TEST_F(CtrlChannelDhcpv6SrvTest, serverTagGet) {
+    createUnixChannelServer();
+
+    std::string response;
+    std::string expected;
+
+    // Send the server-tag-get command
+    sendUnixCommand("{ \"command\": \"server-tag-get\" }", response);
+    expected = "{ \"arguments\": { \"server-tag\": \"\" }, \"result\": 0 }";
+    EXPECT_EQ(expected, response);
+
+    // Set a value to the server tag
+    CfgMgr::instance().getCurrentCfg()->setServerTag("foobar");
+
+    // Retry...
+    sendUnixCommand("{ \"command\": \"server-tag-get\" }", response);
+    expected = "{ \"arguments\": { \"server-tag\": \"foobar\" }, \"result\": 0 }";
+    EXPECT_EQ(expected, response);
+}
+
 // This test verifies that the DHCP server handles status-get commands
 TEST_F(CtrlChannelDhcpv6SrvTest, statusGet) {
     createUnixChannelServer();
@@ -1179,26 +1317,6 @@ TEST_F(CtrlChannelDhcpv6SrvTest, statusGetSocketsErrors) {
     ASSERT_EQ("the interface down_interface is down", error->stringValue());
 }
 
-// This test verifies that the DHCP server handles server-tag-get command
-TEST_F(CtrlChannelDhcpv6SrvTest, serverTagGet) {
-    createUnixChannelServer();
-
-    std::string response;
-    std::string expected;
-
-    // Send the server-tag-get command
-    sendUnixCommand("{ \"command\": \"server-tag-get\" }", response);
-    expected = "{ \"arguments\": { \"server-tag\": \"\" }, \"result\": 0 }";
-    EXPECT_EQ(expected, response);
-
-    // Set a value to the server tag
-    CfgMgr::instance().getCurrentCfg()->setServerTag("foobar");
-
-    // Retry...
-    sendUnixCommand("{ \"command\": \"server-tag-get\" }", response);
-    expected = "{ \"arguments\": { \"server-tag\": \"foobar\" }, \"result\": 0 }";
-}
-
 // This test verifies that the DHCP server handles config-backend-pull command
 TEST_F(CtrlChannelDhcpv6SrvTest, configBackendPull) {
     createUnixChannelServer();
@@ -1317,123 +1435,6 @@ TEST_F(CtrlChannelDhcpv6SrvTest, controlLeasesReclaimRemove) {
     ASSERT_FALSE(lease1);
 }
 
-// Tests that the server properly responds to statistics commands.  Note this
-// is really only intended to verify that the appropriate Statistics handler
-// is called based on the command.  It is not intended to be an exhaustive
-// test of Dhcpv6 statistics.
-TEST_F(CtrlChannelDhcpv6SrvTest, controlChannelStats) {
-    createUnixChannelServer();
-    std::string response;
-
-    // Check statistic-get
-    sendUnixCommand("{ \"command\" : \"statistic-get\", "
-                    "  \"arguments\": {"
-                    "  \"name\":\"bogus\" }}", response);
-    EXPECT_EQ("{ \"arguments\": {  }, \"result\": 0 }", response);
-
-    // Check statistic-get-all
-    sendUnixCommand("{ \"command\" : \"statistic-get-all\", "
-                    "  \"arguments\": {}}", response);
-
-    std::set<std::string> initial_stats = {
-        "pkt6-received",
-        "pkt6-solicit-received",
-        "pkt6-advertise-received",
-        "pkt6-request-received",
-        "pkt6-reply-received",
-        "pkt6-renew-received",
-        "pkt6-rebind-received",
-        "pkt6-decline-received",
-        "pkt6-release-received",
-        "pkt6-infrequest-received",
-        "pkt6-dhcpv4-query-received",
-        "pkt6-dhcpv4-response-received",
-        "pkt6-unknown-received",
-        "pkt6-sent",
-        "pkt6-advertise-sent",
-        "pkt6-reply-sent",
-        "pkt6-dhcpv4-response-sent",
-        "pkt6-parse-failed",
-        "pkt6-receive-drop",
-        "v6-allocation-fail",
-        "v6-allocation-fail-shared-network",
-        "v6-allocation-fail-subnet",
-        "v6-allocation-fail-no-pools",
-        "v6-allocation-fail-classes",
-        "v6-ia-na-lease-reuses",
-        "v6-ia-pd-lease-reuses",
-    };
-
-    std::ostringstream s;
-    bool first = true;
-    s << "{ \"arguments\": { ";
-    for (auto const& st : initial_stats) {
-        if (!first) {
-            s << ", ";
-        } else {
-            first = false;
-        }
-        s << "\"" << st << "\": [ [ 0, \"";
-        s << isc::util::clockToText(StatsMgr::instance().getObservation(st)->getInteger().second);
-        s << "\" ] ]";
-    }
-    s << " }, \"result\": 0 }";
-
-    auto stats_get_all = s.str();
-
-    EXPECT_EQ(stats_get_all, response);
-
-    // Check statistic-reset
-    sendUnixCommand("{ \"command\" : \"statistic-reset\", "
-                    "  \"arguments\": {"
-                    "  \"name\":\"bogus\" }}", response);
-    EXPECT_EQ("{ \"result\": 1, \"text\": \"No 'bogus' statistic found\" }",
-              response);
-
-    // Check statistic-reset-all
-    sendUnixCommand("{ \"command\" : \"statistic-reset-all\", "
-                    "  \"arguments\": {}}", response);
-    EXPECT_EQ("{ \"result\": 0, \"text\": "
-              "\"All statistics reset to neutral values.\" }", response);
-
-    // Check statistic-remove
-    sendUnixCommand("{ \"command\" : \"statistic-remove\", "
-                    "  \"arguments\": {"
-                    "  \"name\":\"bogus\" }}", response);
-    EXPECT_EQ("{ \"result\": 1, \"text\": \"No 'bogus' statistic found\" }",
-              response);
-
-    // Check statistic-remove-all (deprecated)
-
-    // Check statistic-sample-age-set
-    sendUnixCommand("{ \"command\" : \"statistic-sample-age-set\", "
-                    "  \"arguments\": {"
-                    "  \"name\":\"bogus\", \"duration\": 1245 }}", response);
-    EXPECT_EQ("{ \"result\": 1, \"text\": \"No 'bogus' statistic found\" }",
-              response);
-
-    // Check statistic-sample-age-set-all
-    sendUnixCommand("{ \"command\" : \"statistic-sample-age-set-all\", "
-                    "  \"arguments\": {"
-                    "  \"duration\": 1245 }}", response);
-    EXPECT_EQ("{ \"result\": 0, \"text\": \"All statistics duration limit are set.\" }",
-              response);
-
-    // Check statistic-sample-count-set
-    sendUnixCommand("{ \"command\" : \"statistic-sample-count-set\", "
-                    "  \"arguments\": {"
-                    "  \"name\":\"bogus\", \"max-samples\": 100 }}", response);
-    EXPECT_EQ("{ \"result\": 1, \"text\": \"No 'bogus' statistic found\" }",
-              response);
-
-    // Check statistic-sample-count-set-all
-    sendUnixCommand("{ \"command\" : \"statistic-sample-count-set-all\", "
-                    "  \"arguments\": {"
-                    "  \"max-samples\": 100 }}", response);
-    EXPECT_EQ("{ \"result\": 0, \"text\": \"All statistics count limit are set.\" }",
-              response);
-}
-
 // Tests that the server properly responds to list-commands command sent
 // via ControlChannel
 TEST_F(CtrlChannelDhcpv6SrvTest, listCommands) {
index 8f3ce2f13cb76fb9de6fa251fa967aa98293e026..34b60afa81402296acb4ca60a320fda7f7067083 100644 (file)
@@ -118,12 +118,12 @@ public:
         IfaceMgr::instance().deleteAllExternalSockets();
         CfgMgr::instance().clear();
     }
-
 };
 
 /// @brief Base fixture class intended for testing HTTP/HTTPS control channel.
 class BaseCtrlChannelDhcpv6Test : public HttpCtrlDhcpv6Test {
 public:
+
     /// @brief List of interfaces (defaults to "*").
     std::string interfaces_;
 
@@ -201,7 +201,6 @@ public:
     /// @brief Create a server with a HTTP command channel.
     virtual void createHttpChannelServer() = 0;
 
-    /// @brief Create a server with a HTTP command channel.
     /// @brief Reset
     void reset() override {
         HttpCtrlDhcpv6Test::reset();
@@ -567,6 +566,7 @@ public:
 class HttpCtrlChannelDhcpv6Test : public BaseCtrlChannelDhcpv6Test {
 public:
 
+    /// @brief Create a server with a HTTP command channel.
     virtual void createHttpChannelServer() override {
         // Just a simple config. The important part here is the socket
         // location information.
@@ -678,6 +678,7 @@ public:
 class HttpsCtrlChannelDhcpv6Test : public BaseCtrlChannelDhcpv6Test {
 public:
 
+    /// @brief Create a server with a HTTP command channel.
     virtual void createHttpChannelServer() override {
         // Just a simple config. The important part here is the socket
         // location information.
@@ -823,7 +824,8 @@ BaseCtrlChannelDhcpv6Test::testControlChannelShutdown() {
     std::string response;
 
     sendHttpCommand("{ \"command\": \"shutdown\" }", response);
-    EXPECT_EQ("[ { \"result\": 0, \"text\": \"Shutting down.\" } ]", response);
+    EXPECT_EQ("[ { \"result\": 0, \"text\": \"Shutting down.\" } ]",
+              response);
 
     EXPECT_EQ(EXIT_SUCCESS, server_->getExitValue());
 }
@@ -836,6 +838,135 @@ TEST_F(HttpsCtrlChannelDhcpv6Test, controlChannelShutdown) {
     testControlChannelShutdown();
 }
 
+// Tests that the server properly responds to statistics commands.  Note this
+// is really only intended to verify that the appropriate Statistics handler
+// is called based on the command.  It is not intended to be an exhaustive
+// test of Dhcpv6 statistics.
+void
+BaseCtrlChannelDhcpv6Test::testControlChannelStats() {
+    createHttpChannelServer();
+    std::string response;
+
+    // Check statistic-get
+    sendHttpCommand("{ \"command\" : \"statistic-get\", "
+                    "  \"arguments\": {"
+                    "  \"name\":\"bogus\" }}", response);
+    EXPECT_EQ("[ { \"arguments\": {  }, \"result\": 0 } ]", response);
+
+    // Check statistic-get-all
+    sendHttpCommand("{ \"command\" : \"statistic-get-all\", "
+                    "  \"arguments\": {}}", response);
+
+    std::set<std::string> initial_stats = {
+        "pkt6-received",
+        "pkt6-solicit-received",
+        "pkt6-advertise-received",
+        "pkt6-request-received",
+        "pkt6-reply-received",
+        "pkt6-renew-received",
+        "pkt6-rebind-received",
+        "pkt6-decline-received",
+        "pkt6-release-received",
+        "pkt6-infrequest-received",
+        "pkt6-dhcpv4-query-received",
+        "pkt6-dhcpv4-response-received",
+        "pkt6-unknown-received",
+        "pkt6-sent",
+        "pkt6-advertise-sent",
+        "pkt6-reply-sent",
+        "pkt6-dhcpv4-response-sent",
+        "pkt6-parse-failed",
+        "pkt6-receive-drop",
+        "v6-allocation-fail",
+        "v6-allocation-fail-shared-network",
+        "v6-allocation-fail-subnet",
+        "v6-allocation-fail-no-pools",
+        "v6-allocation-fail-classes",
+        "v6-ia-na-lease-reuses",
+        "v6-ia-pd-lease-reuses",
+    };
+
+    std::ostringstream s;
+    s << "[ { \"arguments\": { ";
+    bool first = true;
+    for (auto const& st : initial_stats) {
+        if (!first) {
+            s << ", ";
+        } else {
+            first = false;
+        }
+        s << "\"" << st << "\": [ [ 0, \"";
+        s << isc::util::clockToText(StatsMgr::instance().getObservation(st)->getInteger().second);
+        s << "\" ] ]";
+    }
+    s << " }, \"result\": 0 } ]";
+
+    auto stats_get_all = s.str();
+
+    EXPECT_EQ(stats_get_all, response);
+
+    // Check statistic-reset
+    sendHttpCommand("{ \"command\" : \"statistic-reset\", "
+                    "  \"arguments\": {"
+                    "  \"name\":\"bogus\" }}", response);
+    EXPECT_EQ("[ { \"result\": 1, \"text\": \"No 'bogus' statistic found\" } ]",
+              response);
+
+    // Check statistic-reset-all
+    sendHttpCommand("{ \"command\" : \"statistic-reset-all\", "
+                    "  \"arguments\": {}}", response);
+    EXPECT_EQ("[ { \"result\": 0, \"text\": "
+              "\"All statistics reset to neutral values.\" } ]",
+              response);
+
+    // Check statistic-remove
+    sendHttpCommand("{ \"command\" : \"statistic-remove\", "
+                    "  \"arguments\": {"
+                    "  \"name\":\"bogus\" }}", response);
+    EXPECT_EQ("[ { \"result\": 1, \"text\": \"No 'bogus' statistic found\" } ]",
+              response);
+
+    // Check statistic-remove-all (deprecated)
+
+    // Check statistic-sample-age-set
+    sendHttpCommand("{ \"command\" : \"statistic-sample-age-set\", "
+                    "  \"arguments\": {"
+                    "  \"name\":\"bogus\", \"duration\": 1245 }}", response);
+    EXPECT_EQ("[ { \"result\": 1, \"text\": \"No 'bogus' statistic found\" } ]",
+              response);
+
+    // Check statistic-sample-age-set-all
+    sendHttpCommand("{ \"command\" : \"statistic-sample-age-set-all\", "
+                    "  \"arguments\": {"
+                    "  \"duration\": 1245 }}", response);
+    EXPECT_EQ("[ { \"result\": 0, \"text\": "
+              "\"All statistics duration limit are set.\" } ]",
+              response);
+
+    // Check statistic-sample-count-set
+    sendHttpCommand("{ \"command\" : \"statistic-sample-count-set\", "
+                    "  \"arguments\": {"
+                    "  \"name\":\"bogus\", \"max-samples\": 100 }}", response);
+    EXPECT_EQ("[ { \"result\": 1, \"text\": \"No 'bogus' statistic found\" } ]",
+              response);
+
+    // Check statistic-sample-count-set-all
+    sendHttpCommand("{ \"command\" : \"statistic-sample-count-set-all\", "
+                    "  \"arguments\": {"
+                    "  \"max-samples\": 100 }}", response);
+    EXPECT_EQ("[ { \"result\": 0, \"text\": "
+              "\"All statistics count limit are set.\" } ]",
+              response);
+}
+
+TEST_F(HttpCtrlChannelDhcpv6Test, controlChannelStats) {
+    testControlChannelStats();
+}
+
+TEST_F(HttpsCtrlChannelDhcpv6Test, controlChannelStats) {
+    testControlChannelStats();
+}
+
 // Check that the "config-set" command will replace current configuration.
 TEST_F(HttpCtrlChannelDhcpv6Test, configSet) {
     createHttpChannelServer();
@@ -1566,7 +1697,7 @@ TEST_F(HttpsCtrlChannelDhcpv6Test, configTest) {
     CfgMgr::instance().clear();
 }
 
-// This test verifies that the DHCP server handles version-get commands
+// This test verifies that the DHCP server handles version-get commands.
 void
 BaseCtrlChannelDhcpv6Test::testGetVersion() {
     createHttpChannelServer();
@@ -1593,6 +1724,38 @@ TEST_F(HttpsCtrlChannelDhcpv6Test, getVersion) {
     testGetVersion();
 }
 
+// This test verifies that the DHCP server handles server-tag-get command.
+void
+BaseCtrlChannelDhcpv6Test::testServerTagGet() {
+    createHttpChannelServer();
+
+    std::string response;
+    std::string expected;
+
+    // Send the server-tag-get command
+    sendHttpCommand("{ \"command\": \"server-tag-get\" }", response);
+    expected = "[ { \"arguments\": { \"server-tag\": \"\" }, ";
+    expected += "\"result\": 0 } ]";
+    EXPECT_EQ(expected, response);
+
+    // Set a value to the server tag
+    CfgMgr::instance().getCurrentCfg()->setServerTag("foobar");
+
+    // Retry...
+    sendHttpCommand("{ \"command\": \"server-tag-get\" }", response);
+    expected = "[ { \"arguments\": { \"server-tag\": \"foobar\" }, ";
+    expected += "\"result\": 0 } ]";
+    EXPECT_EQ(expected, response);
+}
+
+TEST_F(HttpCtrlChannelDhcpv6Test, serverTagGet) {
+    testServerTagGet();
+}
+
+TEST_F(HttpsCtrlChannelDhcpv6Test, serverTagGet) {
+    testServerTagGet();
+}
+
 // This test verifies that the DHCP server handles status-get commands.
 void
 BaseCtrlChannelDhcpv6Test::testStatusGet() {
@@ -1863,38 +2026,6 @@ TEST_F(HttpsCtrlChannelDhcpv6Test, statusGetSocketsErrors) {
     testStatusGetSocketsErrors();
 }
 
-// This test verifies that the DHCP server handles server-tag-get command.
-void
-BaseCtrlChannelDhcpv6Test::testServerTagGet() {
-    createHttpChannelServer();
-
-    std::string response;
-    std::string expected;
-
-    // Send the server-tag-get command
-    sendHttpCommand("{ \"command\": \"server-tag-get\" }", response);
-    expected = "[ { \"arguments\": { \"server-tag\": \"\" }, ";
-    expected += "\"result\": 0 } ]";
-    EXPECT_EQ(expected, response);
-
-    // Set a value to the server tag
-    CfgMgr::instance().getCurrentCfg()->setServerTag("foobar");
-
-    // Retry...
-    sendHttpCommand("{ \"command\": \"server-tag-get\" }", response);
-    expected = "[ { \"arguments\": { \"server-tag\": \"foobar\" }, ";
-    expected += "\"result\": 0 } ]";
-    EXPECT_EQ(expected, response);
-}
-
-TEST_F(HttpCtrlChannelDhcpv6Test, serverTagGet) {
-    testServerTagGet();
-}
-
-TEST_F(HttpsCtrlChannelDhcpv6Test, serverTagGet) {
-    testServerTagGet();
-}
-
 // This test verifies that the DHCP server handles config-backend-pull command.
 void
 BaseCtrlChannelDhcpv6Test::testConfigBackendPull() {
@@ -2045,135 +2176,6 @@ TEST_F(HttpsCtrlChannelDhcpv6Test, controlLeasesReclaimRemove) {
     testControlLeasesReclaimRemove();
 }
 
-// Tests that the server properly responds to statistics commands.  Note this
-// is really only intended to verify that the appropriate Statistics handler
-// is called based on the command.  It is not intended to be an exhaustive
-// test of Dhcpv6 statistics.
-void
-BaseCtrlChannelDhcpv6Test::testControlChannelStats() {
-    createHttpChannelServer();
-    std::string response;
-
-    // Check statistic-get
-    sendHttpCommand("{ \"command\" : \"statistic-get\", "
-                    "  \"arguments\": {"
-                    "  \"name\":\"bogus\" }}", response);
-    EXPECT_EQ("[ { \"arguments\": {  }, \"result\": 0 } ]", response);
-
-    // Check statistic-get-all
-    sendHttpCommand("{ \"command\" : \"statistic-get-all\", "
-                    "  \"arguments\": {}}", response);
-
-    std::set<std::string> initial_stats = {
-        "pkt6-received",
-        "pkt6-solicit-received",
-        "pkt6-advertise-received",
-        "pkt6-request-received",
-        "pkt6-reply-received",
-        "pkt6-renew-received",
-        "pkt6-rebind-received",
-        "pkt6-decline-received",
-        "pkt6-release-received",
-        "pkt6-infrequest-received",
-        "pkt6-dhcpv4-query-received",
-        "pkt6-dhcpv4-response-received",
-        "pkt6-unknown-received",
-        "pkt6-sent",
-        "pkt6-advertise-sent",
-        "pkt6-reply-sent",
-        "pkt6-dhcpv4-response-sent",
-        "pkt6-parse-failed",
-        "pkt6-receive-drop",
-        "v6-allocation-fail",
-        "v6-allocation-fail-shared-network",
-        "v6-allocation-fail-subnet",
-        "v6-allocation-fail-no-pools",
-        "v6-allocation-fail-classes",
-        "v6-ia-na-lease-reuses",
-        "v6-ia-pd-lease-reuses",
-    };
-
-    std::ostringstream s;
-    bool first = true;
-    s << "[ { \"arguments\": { ";
-    for (auto const& st : initial_stats) {
-        if (!first) {
-            s << ", ";
-        } else {
-            first = false;
-        }
-        s << "\"" << st << "\": [ [ 0, \"";
-        s << isc::util::clockToText(StatsMgr::instance().getObservation(st)->getInteger().second);
-        s << "\" ] ]";
-    }
-    s << " }, \"result\": 0 } ]";
-
-    auto stats_get_all = s.str();
-
-    EXPECT_EQ(stats_get_all, response);
-
-    // Check statistic-reset
-    sendHttpCommand("{ \"command\" : \"statistic-reset\", "
-                    "  \"arguments\": {"
-                    "  \"name\":\"bogus\" }}", response);
-    EXPECT_EQ("[ { \"result\": 1, \"text\": \"No 'bogus' statistic found\" } ]",
-              response);
-
-    // Check statistic-reset-all
-    sendHttpCommand("{ \"command\" : \"statistic-reset-all\", "
-                    "  \"arguments\": {}}", response);
-    EXPECT_EQ("[ { \"result\": 0, \"text\": "
-              "\"All statistics reset to neutral values.\" } ]",
-              response);
-
-    // Check statistic-remove
-    sendHttpCommand("{ \"command\" : \"statistic-remove\", "
-                    "  \"arguments\": {"
-                    "  \"name\":\"bogus\" }}", response);
-    EXPECT_EQ("[ { \"result\": 1, \"text\": \"No 'bogus' statistic found\" } ]",
-              response);
-
-    // Check statistic-remove-all (deprecated)
-
-    // Check statistic-sample-age-set
-    sendHttpCommand("{ \"command\" : \"statistic-sample-age-set\", "
-                    "  \"arguments\": {"
-                    "  \"name\":\"bogus\", \"duration\": 1245 }}", response);
-    EXPECT_EQ("[ { \"result\": 1, \"text\": \"No 'bogus' statistic found\" } ]",
-              response);
-
-    // Check statistic-sample-age-set-all
-    sendHttpCommand("{ \"command\" : \"statistic-sample-age-set-all\", "
-                    "  \"arguments\": {"
-                    "  \"duration\": 1245 }}", response);
-    EXPECT_EQ("[ { \"result\": 0, \"text\": \"All statistics duration "
-              "limit are set.\" } ]",
-              response);
-
-    // Check statistic-sample-count-set
-    sendHttpCommand("{ \"command\" : \"statistic-sample-count-set\", "
-                    "  \"arguments\": {"
-                    "  \"name\":\"bogus\", \"max-samples\": 100 }}", response);
-    EXPECT_EQ("[ { \"result\": 1, \"text\": \"No 'bogus' statistic found\" } ]",
-              response);
-
-    // Check statistic-sample-count-set-all
-    sendHttpCommand("{ \"command\" : \"statistic-sample-count-set-all\", "
-                    "  \"arguments\": {"
-                    "  \"max-samples\": 100 }}", response);
-    EXPECT_EQ("[ { \"result\": 0, \"text\": \"All statistics count limit "
-              "are set.\" } ]",
-              response);
-}
-
-TEST_F(HttpCtrlChannelDhcpv6Test, controlChannelStats) {
-    testControlChannelStats();
-}
-
-TEST_F(HttpsCtrlChannelDhcpv6Test, controlChannelStats) {
-    testControlChannelStats();
-}
-
 // Tests that the server properly responds to list-commands command sent
 // via ControlChannel.
 void
@@ -2284,8 +2286,8 @@ BaseCtrlChannelDhcpv6Test::testConfigReloadMissingFile() {
 
     // Verify the reload was rejected.
     EXPECT_EQ("[ { \"result\": 1, \"text\": \"Config reload failed: "
-              "configuration error using file 'test6.json': Unable to "
-              "open file test6.json\" } ]",
+              "configuration error using file 'test6.json': "
+              "Unable to open file test6.json\" } ]",
               response);
 }