]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#103,!277] Implemented CBControlBase::reset function.
authorMarcin Siodelski <marcin@isc.org>
Tue, 19 Mar 2019 12:53:10 +0000 (13:53 +0100)
committerMarcin Siodelski <marcin@isc.org>
Tue, 26 Mar 2019 07:08:56 +0000 (03:08 -0400)
src/lib/process/cb_ctl_base.h
src/lib/process/tests/cb_ctl_base_unittests.cc

index 8547cacc975447820cf5f60830de482290ebbf75..f5215cdc5734203a68985edf7f59501ab12f0d8c 100644 (file)
@@ -94,6 +94,15 @@ public:
         databaseConfigDisconnect();
     }
 
+    /// @brief Resets the state of this object.
+    ///
+    /// Disconnects the configuration backends resets the recorded last
+    /// audit entry time.
+    void reset() {
+        databaseConfigDisconnect();
+        last_audit_entry_time_ = getInitialAuditEntryTime();
+    }
+
     /// @brief (Re)connects to the specified configuration backends.
     ///
     /// This method disconnects from any existing configuration backends
index 19a07a879cd03320ae68412ff02bac1424f06ab2..9f971ae985cee04591b2341f103e9996173b7355 100644 (file)
@@ -381,6 +381,14 @@ TEST_F(CBControlBaseTest, getMgr) {
     EXPECT_EQ(TEST_INSTANCE_ID, mgr.getInstanceId());
 }
 
+// This test verifies that last audit entry time is reset upon the
+// call to CBControlBase::reset().
+TEST_F(CBControlBaseTest, reset) {
+    cb_ctl_.setLastAuditEntryTime(timestamps_["tomorrow"]);
+    cb_ctl_.reset();
+    EXPECT_EQ(cb_ctl_.getInitialAuditEntryTime(), cb_ctl_.getLastAuditEntryTime());
+}
+
 // This test verifies that it is correctly determined whether the
 // server should fetch the particular configuration element.
 TEST_F(CBControlBaseTest, fetchConfigElement) {