]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
review changes
authorRazvan Becheriu <razvan@isc.org>
Mon, 5 Aug 2019 10:34:45 +0000 (13:34 +0300)
committerRazvan Becheriu <razvan@isc.org>
Mon, 5 Aug 2019 17:34:27 +0000 (20:34 +0300)
13 files changed:
doc/sphinx/api/statistic-set-max-sample-age-all.json
doc/sphinx/api/statistic-set-max-sample-age.json
doc/sphinx/api/statistic-set-max-sample-count-all.json
doc/sphinx/api/statistic-set-max-sample-count.json
doc/sphinx/arm/stats.rst
src/bin/dhcp4/ctrl_dhcp4_srv.cc
src/bin/dhcp6/ctrl_dhcp6_srv.cc
src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc
src/lib/stats/observation.h
src/lib/stats/stats_mgr.cc
src/lib/stats/stats_mgr.h
src/lib/stats/tests/observation_unittest.cc
src/lib/stats/tests/stats_mgr_unittest.cc

index 93cec1d96726bb8389affc6f684a0529d0508387..5394aba21871235e88d21d4eb6797a6744494a1e 100644 (file)
@@ -10,5 +10,5 @@
         \"duration\": 1245
     }
 }",
-    "cmd-comment": "The server will respond with message about successfully setted limits for all statistics, with a result set to 0 indicating success and an empty parameters field. If an error is encountered, the server will return a status code of 1 (error) and the text field will contain the error description."
+    "cmd-comment": "The server will respond with message about successfully set limits for all statistics, with a result set to 0 indicating success and an empty parameters field. If an error is encountered, the server will return a status code of 1 (error) and the text field will contain the error description."
 }
index 9d9a8d794ab9e0402522cec1ca8606b63b3dec0d..20b53ffb816eb35d483d9c2e2bebe5f0d30c20c4 100644 (file)
@@ -11,5 +11,5 @@
         \"duration\": 1245
     }
 }",
-    "cmd-comment": "The server will respond with message about successfully setted limit for the given statistic, with a result set to 0 indicating success and an empty parameters field. If an error is encountered (e.g. requested statistic was not found), the server will return a status code of 1 (error) and the text field will contain the error description."
+    "cmd-comment": "The server will respond with message about successfully set limit for the given statistic, with a result set to 0 indicating success and an empty parameters field. If an error is encountered (e.g. requested statistic was not found), the server will return a status code of 1 (error) and the text field will contain the error description."
 }
index 4c71fc072bc2db50e10b11171a417d1eeed3084e..0c8df9e13062a12ad5a45a1613948bdb19394acb 100644 (file)
@@ -10,5 +10,5 @@
         \"max-samples\": 100
     }
 }",
-    "cmd-comment": "The server will respond with message about successfully setted limits for all statistics, with a result set to 0 indicating success and an empty parameters field. If an error is encountered, the server will return a status code of 1 (error) and the text field will contain the error description."
+    "cmd-comment": "The server will respond with message about successfully set limits for all statistics, with a result set to 0 indicating success and an empty parameters field. If an error is encountered, the server will return a status code of 1 (error) and the text field will contain the error description."
 }
index a713180593ff2621e7e1d9eb1f6e5a369e912601..3bffccacab1819e3ffb9cc85ac95a052f355623e 100644 (file)
@@ -11,5 +11,5 @@
         \"max-samples\": 100
     }
 }",
-    "cmd-comment": "The server will respond with message about successfully setted limit for the given statistic, with a result set to 0 indicating success and an empty parameters field. If an error is encountered (e.g. requested statistic was not found), the server will return a status code of 1 (error) and the text field will contain the error description."
+    "cmd-comment": "The server will respond with message about successfully set limit for the given statistic, with a result set to 0 indicating success and an empty parameters field. If an error is encountered (e.g. requested statistic was not found), the server will return a status code of 1 (error) and the text field will contain the error description."
 }
index 80495903bc3e74744905aa0e50b5f18dfe49f7ca..ac53fd15cb0a6de89d8bcbef89610d4fd684677c 100644 (file)
@@ -339,15 +339,14 @@ a status code of 1 (error) and the text field contains the error description.
 Time series
 ====================
 
-Previously, by default, each statistic holded only a single data point. When Kea
-attempted to record a new value, the existing previous value was
-overwritten. That approach has the benefit of taking up little memory and
-it covers most cases reasonably well. However, there may be cases where
-you need to have many data points for some process. For example, some
-processes, such as received packet size, packet processing time or number
-of database queries needed to process a packet, are not cumulative and it
-would be useful to keep many data points, perhaps to do some form of
-statistical analysis afterwards.
+Previously, by default, each statistic held only a single data point. When Kea
+attempted to record a new value, the existing previous value was overwritten.
+That approach has the benefit of taking up little memory and it covers most
+cases reasonably well. However, there may be cases where you need to have many
+data points for some process. For example, some processes, such as received
+packet size, packet processing time or number of database queries needed to
+process a packet, are not cumulative and it would be useful to keep many data
+points, perhaps to do some form of statistical analysis afterwards.
 
 
 Since Kea 1.6, by default, each statistic holds 20 data points. Setting such
index a6af5b31460c584b9dfa7bd934d1307fbe985f0c..8c2589b108d066179bc7666ffecd9efbde2ad597 100644 (file)
@@ -875,8 +875,6 @@ ControlledDhcpv4Srv::ControlledDhcpv4Srv(uint16_t server_port /*= DHCP4_SERVER_P
 
     CommandMgr::instance().registerCommand("statistic-set-max-sample-count-all",
         boost::bind(&StatsMgr::statisticSetMaxSampleCountAllHandler, _1, _2));
-
-
 }
 
 void ControlledDhcpv4Srv::shutdown() {
@@ -922,7 +920,6 @@ ControlledDhcpv4Srv::~ControlledDhcpv4Srv() {
         CommandMgr::instance().deregisterCommand("statistic-set-max-sample-count-all");
         CommandMgr::instance().deregisterCommand("version-get");
 
-
     } catch (...) {
         // Don't want to throw exceptions from the destructor. The server
         // is shutting down anyway.
index 6d4a74b3d1898817b8b93cb29d093c3fe1d481c2..3552f7eedff24563e1c9df41d85d07689ad22b7d 100644 (file)
@@ -941,7 +941,7 @@ ControlledDhcpv6Srv::~ControlledDhcpv6Srv() {
         CommandMgr::instance().deregisterCommand("statistic-set-max-sample-age");
         CommandMgr::instance().deregisterCommand("statistic-set-max-sample-count");
         CommandMgr::instance().deregisterCommand("statistic-set-max-sample-age-all");
-        CommandMgr::instance().deregisterCommand("statistic-set-max-sample-count-all");        
+        CommandMgr::instance().deregisterCommand("statistic-set-max-sample-count-all");
         CommandMgr::instance().deregisterCommand("version-get");
 
     } catch (...) {
index 733ca4e8f183d61222afb9c9dd302347977b0dde..77f2640bfaf0d18e4003ba63523c9822b8ed5f32 100644 (file)
@@ -1089,7 +1089,7 @@ TEST_F(CtrlChannelDhcpv6SrvTest, commandsList) {
     checkListCommands(rsp, "statistic-set-max-sample-age");
     checkListCommands(rsp, "statistic-set-max-sample-age-all");
     checkListCommands(rsp, "statistic-set-max-sample-count");
-    checkListCommands(rsp, "statistic-set-max-sample-count-all");    
+    checkListCommands(rsp, "statistic-set-max-sample-count-all");
 }
 
 // Tests if the server returns its configuration using config-get.
index a07e08772539c0497fbf9e6e1f401c0153fee6f2..d979500554822142083d3eed96b6399e0ed3fbcd 100644 (file)
@@ -193,12 +193,12 @@ class Observation {
     /// @return size of storage
     size_t getSize() const;
 
-    /// @brief Returns both value of max_sample_age_ of statistic.
+    /// @brief Returns both values of max_sample_age_ of statistic.
     ///
     /// @return max_sample_age_.
     std::pair<bool, StatsDuration> getMaxSampleAge() const;
 
-    /// @brief Returns both value of max_sample_count_ of statistic.
+    /// @brief Returns both values of max_sample_count_ of statistic.
     ///
     /// @return max_sample_count_.
     std::pair<bool, uint32_t> getMaxSampleCount() const;
index 444b5e49b863ebba0233aadae0c4bc3739cf5197..70a6edb29c310d8f99f57f8ccbe50f4cb39a40e2 100644 (file)
@@ -195,7 +195,7 @@ StatsMgr::statisticSetMaxSampleAgeHandler(const std::string& /*name*/,
     if (!getStatDuration(params, duration, error)) {
         return (createAnswer(CONTROL_RESULT_ERROR, error));
     }
-    if (instance().setMaxSampleAge(name, duration)) {
+    if (setMaxSampleAge(name, duration)) {
         return (createAnswer(CONTROL_RESULT_SUCCESS,
                             "Statistic '" + name + "' duration limit is set."));
     } else {
@@ -215,7 +215,7 @@ StatsMgr::statisticSetMaxSampleCountHandler(const std::string& /*name*/,
     if (!getStatMaxSamples(params, max_samples, error)) {
         return (createAnswer(CONTROL_RESULT_ERROR, error));
     }
-    if (instance().setMaxSampleCount(name, max_samples)) {
+    if (setMaxSampleCount(name, max_samples)) {
         return (createAnswer(CONTROL_RESULT_SUCCESS,
                             "Statistic '" + name + "' count limit is set."));
     } else {
@@ -300,7 +300,7 @@ StatsMgr::statisticSetMaxSampleAgeAllHandler(const std::string& /*name*/,
     if (!getStatDuration(params, duration, error)) {
         return (createAnswer(CONTROL_RESULT_ERROR, error));
     }
-    instance().setMaxSampleAgeAll(duration);
+    setMaxSampleAgeAll(duration);
     return (createAnswer(CONTROL_RESULT_SUCCESS,
                          "All statistics duration limit are set."));
 }
@@ -313,7 +313,7 @@ StatsMgr::statisticSetMaxSampleCountAllHandler(const std::string& /*name*/,
     if (!getStatMaxSamples(params, max_samples, error)) {
         return (createAnswer(CONTROL_RESULT_ERROR, error));
     }
-    instance().setMaxSampleCountAll(max_samples);
+    setMaxSampleCountAll(max_samples);
     return (createAnswer(CONTROL_RESULT_SUCCESS,
                          "All statistics count limit are set."));
 }
@@ -354,16 +354,16 @@ StatsMgr::getStatDuration(const isc::data::ConstElementPtr& params,
         return (false);
     }
 
-    int64_t dur = stat_duration->intValue();
+    int64_t time_duration = stat_duration->intValue();
 
-    int64_t hours = dur/3600;
-    dur = dur - hours*3600;
+    int64_t hours = time_duration / 3600;
+    time_duration -= hours * 3600;
 
-    int64_t minutes = dur/60;
-    dur = dur - minutes*60;
+    int64_t minutes = time_duration / 60;
+    time_duration -= minutes * 60;
 
-    int64_t seconds = dur;
-    duration = boost::posix_time::time_duration(hours,minutes,seconds,0);
+    int64_t seconds = time_duration;
+    duration = boost::posix_time::time_duration(hours, minutes, seconds, 0);
     return (true);
 }
 
index 3ba00ad0722dd6fa62cfd709627784860cc88eff..11dc2d5abf635a33633b65cf2bfe8520c1188614 100644 (file)
@@ -149,7 +149,7 @@ class StatsMgr : public boost::noncopyable {
     ///
     /// Specifies that statistic name should be stored not as single value, but
     /// rather as a set of values. In this form, at most max_samples will be kept.
-    /// When adding max_samples+1 sample, the oldest sample will be discarded.
+    /// When adding max_samples + 1 sample, the oldest sample will be discarded.
     ///
     ///
     /// @param name name of the observation
@@ -256,7 +256,7 @@ class StatsMgr : public boost::noncopyable {
     ///
     /// This method handles statistic-get command, which returns value
     /// of a given statistic). It expects one parameter stored in params map:
-    /// name: name-of-the-statistic
+    /// name: name of the statistic
     ///
     /// Example params structure:
     /// {
@@ -274,7 +274,7 @@ class StatsMgr : public boost::noncopyable {
     ///
     /// This method handles statistic-reset command, which resets value
     /// of a given statistic. It expects one parameter stored in params map:
-    /// name: name-of-the-statistic
+    /// name: name of the statistic
     ///
     /// Example params structure:
     /// {
@@ -292,7 +292,7 @@ class StatsMgr : public boost::noncopyable {
     ///
     /// This method handles statistic-reset command, which removes a given
     /// statistic completely. It expects one parameter stored in params map:
-    /// name: name-of-the-statistic
+    /// name: name of the statistic
     ///
     /// Example params structure:
     /// {
@@ -312,7 +312,7 @@ class StatsMgr : public boost::noncopyable {
     /// which set max_sample_age_ limit of a given statistic
     /// and leaves max_sample_count_ disabled.
     /// It expects two parameters stored in params map:
-    /// name: name-of-the-statistic
+    /// name: name of the statistic
     /// duration: time limit expressed as a number of seconds
     ///
     /// Example params structure:
@@ -334,8 +334,8 @@ class StatsMgr : public boost::noncopyable {
     /// which set max_sample_count_ limit of a given statistic
     /// and leaves max_sample_age_ disabled.
     /// It expects two parameters stored in params map:
-    /// name: name-of-the-statistic
-    /// max-samples: value of max_sample_count_
+    /// name: name of the statistic
+    /// max-samples: count limit
     ///
     /// Example params structure:
     /// {
@@ -348,7 +348,7 @@ class StatsMgr : public boost::noncopyable {
     /// @return answer containing information about successfully setup limit of statistic
     static isc::data::ConstElementPtr
     statisticSetMaxSampleCountHandler(const std::string& name,
-                                    const isc::data::ConstElementPtr& params);
+                                      const isc::data::ConstElementPtr& params);
 
     /// @brief Handles statistic-get-all command
     ///
@@ -403,27 +403,27 @@ class StatsMgr : public boost::noncopyable {
     /// @return answer confirming success of this operation
     static isc::data::ConstElementPtr
     statisticSetMaxSampleAgeAllHandler(const std::string& name,
-                                    const isc::data::ConstElementPtr& params);
+                                       const isc::data::ConstElementPtr& params);
 
-    /// @brief Handles statistic-set-max-sample-count command
+    /// @brief Handles statistic-set-max-sample-count-all command
     ///
-    /// This method handles statistic-set-max-sample-count command,
+    /// This method handles statistic-set-max-sample-count-all command,
     /// which set max_sample_count_ limit of a given statistic
     /// and leaves max_sample_age_ disabled.
     /// It expects one parameter stored in params map:
-    /// max-samples: value of max_sample_count_
+    /// max-samples: count limit
     ///
     /// Example params structure:
     /// {
     ///     "max-samples": 15
     /// }
     ///
-    /// @param name name of the command (ignored, should be "statistic-set-max-sample-count")
+    /// @param name name of the command (ignored, should be "statistic-set-max-sample-count-all")
     /// @param params structure containing a map that contains "max-samples"
     /// @return answer confirming success of this operation
     static isc::data::ConstElementPtr
     statisticSetMaxSampleCountAllHandler(const std::string& name,
-                                    const isc::data::ConstElementPtr& params);
+                                         const isc::data::ConstElementPtr& params);
 
     /// @}
 
@@ -547,7 +547,7 @@ private:
     ///
     /// This method attempts to extract count limit for a given statistic
     /// from the params structure.
-    /// It is expected to be a map that contains 'max_samples' element,
+    /// It is expected to be a map that contains 'max-samples' element,
     /// that is of type int. If present as expected, statistic count
     /// limit (max_samples) is set and true is returned.
     /// If missing or is of incorrect type, the reason is specified in reason
index e12d406626d24c55925ee705db1183565d4f4efc..f2e066ac3fd45c3907a786849cee320e477b9850 100644 (file)
@@ -449,14 +449,31 @@ TEST_F(ObservationTest, getLimits) {
     EXPECT_EQ(c.getMaxSampleCount().second, 20);
     EXPECT_EQ(d.getMaxSampleCount().second, 20);
 
-    // Change limit to max_sample_age_
-    a.setMaxSampleAge(millisec::time_duration(0, 4, 5, 3));
+    // change limit to time duration
+    ASSERT_NOT_THROW(a.setMaxSampleAge(millisec::time_duration(0, 4, 5, 3)));
+    ASSERT_NOT_THROW(b.setMaxSampleAge(millisec::time_duration(0, 4, 5, 3)));
+    ASSERT_NOT_THROW(c.setMaxSampleAge(millisec::time_duration(0, 4, 5, 3)));
+    ASSERT_NOT_THROW(d.setMaxSampleAge(millisec::time_duration(0, 4, 5, 3)));
+
     EXPECT_EQ(a.getMaxSampleAge().first, true);
+    EXPECT_EQ(b.getMaxSampleAge().first, true);
+    EXPECT_EQ(c.getMaxSampleAge().first, true);
+    EXPECT_EQ(d.getMaxSampleAge().first, true);
+
     EXPECT_EQ(a.getMaxSampleAge().second, millisec::time_duration(0, 4, 5, 3));
+    EXPECT_EQ(b.getMaxSampleAge().second, millisec::time_duration(0, 4, 5, 3));
+    EXPECT_EQ(c.getMaxSampleAge().second, millisec::time_duration(0, 4, 5, 3));
+    EXPECT_EQ(d.getMaxSampleAge().second, millisec::time_duration(0, 4, 5, 3));
 
     EXPECT_EQ(a.getMaxSampleCount().first, false);
-    EXPECT_EQ(a.getMaxSampleCount().second, 20);
+    EXPECT_EQ(b.getMaxSampleCount().first, false);
+    EXPECT_EQ(c.getMaxSampleCount().first, false);
+    EXPECT_EQ(d.getMaxSampleCount().first, false);
 
+    EXPECT_EQ(a.getMaxSampleCount().second, 20);
+    EXPECT_EQ(b.getMaxSampleCount().second, 20);
+    EXPECT_EQ(c.getMaxSampleCount().second, 20);
+    EXPECT_EQ(d.getMaxSampleCount().second, 20);
 }
 
 // Test checks whether timing is reported properly.
index 7c9ab0b5cd837076466f0c221b08ac172097b9a9..b662e5fb4fc43387afb555d4af2773821b48b13e 100644 (file)
@@ -170,54 +170,48 @@ TEST_F(StatsMgrTest, setLimitsAll) {
     StatsMgr::instance().setValue("gamma", time_duration(1, 2, 3, 4));
     StatsMgr::instance().setValue("delta", "Lorem ipsum");
 
-    //First, check the setting of time limit to existing statistics
+    // check the setting of time limit to existing statistics
     EXPECT_NO_THROW(StatsMgr::instance().setMaxSampleAgeAll(time_duration(0, 0, 1, 0)));
-    // Now check if time limit was set properly
+
+    // check if time limit was set properly and whether count limit is disabled
     EXPECT_EQ(StatsMgr::instance().getObservation("alpha")->getMaxSampleAge().first, true);
     EXPECT_EQ(StatsMgr::instance().getObservation("alpha")->getMaxSampleAge().second,
-                                                            time_duration(0, 0, 1, 0));
-    // and whether count limit is disabled
+              time_duration(0, 0, 1, 0));
     EXPECT_EQ(StatsMgr::instance().getObservation("alpha")->getMaxSampleCount().first, false);
 
     EXPECT_EQ(StatsMgr::instance().getObservation("beta")->getMaxSampleAge().first, true);
     EXPECT_EQ(StatsMgr::instance().getObservation("beta")->getMaxSampleAge().second,
-                                                            time_duration(0, 0, 1, 0));
-
+              time_duration(0, 0, 1, 0));
     EXPECT_EQ(StatsMgr::instance().getObservation("beta")->getMaxSampleCount().first, false);
 
     EXPECT_EQ(StatsMgr::instance().getObservation("gamma")->getMaxSampleAge().first, true);
     EXPECT_EQ(StatsMgr::instance().getObservation("gamma")->getMaxSampleAge().second,
-                                                            time_duration(0, 0, 1, 0));
-
+              time_duration(0, 0, 1, 0));
     EXPECT_EQ(StatsMgr::instance().getObservation("gamma")->getMaxSampleCount().first, false);
 
     EXPECT_EQ(StatsMgr::instance().getObservation("delta")->getMaxSampleAge().first, true);
     EXPECT_EQ(StatsMgr::instance().getObservation("delta")->getMaxSampleAge().second,
-                                                            time_duration(0, 0, 1, 0));
-
+              time_duration(0, 0, 1, 0));
     EXPECT_EQ(StatsMgr::instance().getObservation("delta")->getMaxSampleCount().first, false);
 
-    //then, check the setting of count limit to existing statistics
+    // check the setting of count limit to existing statistics
     EXPECT_NO_THROW(StatsMgr::instance().setMaxSampleCountAll(1200));
-    // Now check if count limit was set properly
+
+    // check if count limit was set properly and whether count limit is disabled
     EXPECT_EQ(StatsMgr::instance().getObservation("alpha")->getMaxSampleCount().first, true);
     EXPECT_EQ(StatsMgr::instance().getObservation("alpha")->getMaxSampleCount().second, 1200);
-    // and whether count limit is disabled
     EXPECT_EQ(StatsMgr::instance().getObservation("alpha")->getMaxSampleAge().first, false);
 
     EXPECT_EQ(StatsMgr::instance().getObservation("beta")->getMaxSampleCount().first, true);
     EXPECT_EQ(StatsMgr::instance().getObservation("beta")->getMaxSampleCount().second, 1200);
-
     EXPECT_EQ(StatsMgr::instance().getObservation("beta")->getMaxSampleAge().first, false);
 
     EXPECT_EQ(StatsMgr::instance().getObservation("gamma")->getMaxSampleCount().first, true);
     EXPECT_EQ(StatsMgr::instance().getObservation("gamma")->getMaxSampleCount().second, 1200);
-
     EXPECT_EQ(StatsMgr::instance().getObservation("gamma")->getMaxSampleAge().first, false);
 
     EXPECT_EQ(StatsMgr::instance().getObservation("delta")->getMaxSampleCount().first, true);
     EXPECT_EQ(StatsMgr::instance().getObservation("delta")->getMaxSampleCount().second, 1200);
-
     EXPECT_EQ(StatsMgr::instance().getObservation("delta")->getMaxSampleAge().first, false);
 }
 
@@ -793,11 +787,10 @@ TEST_F(StatsMgrTest, commandSetMaxSampleAge) {
     ASSERT_NO_THROW(parseAnswer(status_code, rsp));
     EXPECT_EQ(CONTROL_RESULT_SUCCESS, status_code);
 
-    // Now check if time limit was set properly
+    // check if time limit was set properly and whether count limit is disabled
     EXPECT_EQ(StatsMgr::instance().getObservation("alpha")->getMaxSampleAge().first, true);
     EXPECT_EQ(StatsMgr::instance().getObservation("alpha")->getMaxSampleAge().second,
-                                                            time_duration(0, 20, 45, 0));
-    // and whether count limit is disabled
+              time_duration(0, 20, 45, 0));
     EXPECT_EQ(StatsMgr::instance().getObservation("alpha")->getMaxSampleCount().first, false);
 }
 
@@ -807,7 +800,6 @@ TEST_F(StatsMgrTest, commandSetMaxSampleAge) {
 // - a request with missing statistic name
 // - a request for non-existing statistic.
 TEST_F(StatsMgrTest, commandSetMaxSampleAgeNegative) {
-
     // Case 1: a request without parameters
     ConstElementPtr rsp =
         StatsMgr::instance().statisticSetMaxSampleAgeHandler("statistic-set-max-sample-age", ElementPtr());
@@ -852,29 +844,25 @@ TEST_F(StatsMgrTest, commandSetMaxSampleAgeAll) {
     ASSERT_NO_THROW(parseAnswer(status_code, rsp));
     EXPECT_EQ(CONTROL_RESULT_SUCCESS, status_code);
 
-    // Now check if time limit was set properly
+    // check if time limit was set properly and whether count limit is disabled
     EXPECT_EQ(StatsMgr::instance().getObservation("alpha")->getMaxSampleAge().first, true);
     EXPECT_EQ(StatsMgr::instance().getObservation("alpha")->getMaxSampleAge().second,
-                                                            time_duration(1, 2, 45, 0));
-    // and whether count limit is disabled
+              time_duration(1, 2, 45, 0));
     EXPECT_EQ(StatsMgr::instance().getObservation("alpha")->getMaxSampleCount().first, false);
 
     EXPECT_EQ(StatsMgr::instance().getObservation("beta")->getMaxSampleAge().first, true);
     EXPECT_EQ(StatsMgr::instance().getObservation("beta")->getMaxSampleAge().second,
-                                                            time_duration(1, 2, 45, 0));
-
+              time_duration(1, 2, 45, 0));
     EXPECT_EQ(StatsMgr::instance().getObservation("beta")->getMaxSampleCount().first, false);
 
     EXPECT_EQ(StatsMgr::instance().getObservation("gamma")->getMaxSampleAge().first, true);
     EXPECT_EQ(StatsMgr::instance().getObservation("gamma")->getMaxSampleAge().second,
-                                                            time_duration(1, 2, 45, 0));
-
+              time_duration(1, 2, 45, 0));
     EXPECT_EQ(StatsMgr::instance().getObservation("gamma")->getMaxSampleCount().first, false);
 
     EXPECT_EQ(StatsMgr::instance().getObservation("delta")->getMaxSampleAge().first, true);
     EXPECT_EQ(StatsMgr::instance().getObservation("delta")->getMaxSampleAge().second,
-                                                            time_duration(1, 2, 45, 0));
-
+              time_duration(1, 2, 45, 0));
     EXPECT_EQ(StatsMgr::instance().getObservation("delta")->getMaxSampleCount().first, false);
 }
 
@@ -893,21 +881,18 @@ TEST_F(StatsMgrTest, commandSetMaxSampleCount) {
     ASSERT_NO_THROW(parseAnswer(status_code, rsp));
     EXPECT_EQ(CONTROL_RESULT_SUCCESS, status_code);
 
-    // Now check if time limit was set properly
+    // check if time limit was set properly and whether duration limit is disabled
     EXPECT_EQ(StatsMgr::instance().getObservation("alpha")->getMaxSampleCount().first, true);
     EXPECT_EQ(StatsMgr::instance().getObservation("alpha")->getMaxSampleCount().second, 15);
-
-    // and whether duration limit is disabled
     EXPECT_EQ(StatsMgr::instance().getObservation("alpha")->getMaxSampleAge().first, false);
 }
 
-// Test checks if statistic-set-max-sample-age is able to handle:
+// Test checks if statistic-set-max-sample-count is able to handle:
 // - a request without parameters
 // - a request without max-samples parameter
 // - a request with missing statistic name
 // - a request for non-existing statistic.
 TEST_F(StatsMgrTest, commandSetMaxSampleCountNegative) {
-
     // Case 1: a request without parameters
     ConstElementPtr rsp =
         StatsMgr::instance().statisticSetMaxSampleCountHandler("statistic-set-max-sample-count", ElementPtr());
@@ -951,25 +936,22 @@ TEST_F(StatsMgrTest, commandSetMaxSampleCountAll) {
     int status_code;
     ASSERT_NO_THROW(parseAnswer(status_code, rsp));
     EXPECT_EQ(CONTROL_RESULT_SUCCESS, status_code);
-    // Now check if count limit was set properly
+
+    // check if count limit was set properly and whether count limit is disabled
     EXPECT_EQ(StatsMgr::instance().getObservation("alpha")->getMaxSampleCount().first, true);
     EXPECT_EQ(StatsMgr::instance().getObservation("alpha")->getMaxSampleCount().second, 200);
-    // and whether count limit is disabled
     EXPECT_EQ(StatsMgr::instance().getObservation("alpha")->getMaxSampleAge().first, false);
 
     EXPECT_EQ(StatsMgr::instance().getObservation("beta")->getMaxSampleCount().first, true);
     EXPECT_EQ(StatsMgr::instance().getObservation("beta")->getMaxSampleCount().second, 200);
-
     EXPECT_EQ(StatsMgr::instance().getObservation("beta")->getMaxSampleAge().first, false);
 
     EXPECT_EQ(StatsMgr::instance().getObservation("gamma")->getMaxSampleCount().first, true);
     EXPECT_EQ(StatsMgr::instance().getObservation("gamma")->getMaxSampleCount().second, 200);
-
     EXPECT_EQ(StatsMgr::instance().getObservation("gamma")->getMaxSampleAge().first, false);
 
     EXPECT_EQ(StatsMgr::instance().getObservation("delta")->getMaxSampleCount().first, true);
     EXPECT_EQ(StatsMgr::instance().getObservation("delta")->getMaxSampleCount().second, 200);
-
     EXPECT_EQ(StatsMgr::instance().getObservation("delta")->getMaxSampleAge().first, false);
 }