]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1041] Added getLastCommitTime unit test
authorFrancis Dupont <fdupont@isc.org>
Fri, 6 Dec 2019 11:55:42 +0000 (12:55 +0100)
committerMarcin Siodelski <marcin@isc.org>
Fri, 13 Dec 2019 15:54:14 +0000 (16:54 +0100)
src/lib/dhcpsrv/tests/cfgmgr_unittest.cc

index ecfe7fccc97dfb890ee42b192eef8f194c8e47d3..f81931a97aef94c32d5c864d15f29f230a0572a3 100644 (file)
@@ -461,12 +461,19 @@ TEST_F(CfgMgrTest, staging) {
 
     // This should change the staging configuration so as it becomes a current
     // one.
+    auto before = boost::posix_time::second_clock::universal_time();
     cfg_mgr.commit();
+    auto after = boost::posix_time::second_clock::universal_time();
     const_config = cfg_mgr.getCurrentCfg();
     ASSERT_TRUE(const_config);
     // Sequence id equal to 1 indicates that the current configuration points
     // to the configuration that used to be a staging configuration previously.
     EXPECT_EQ(1, const_config->getSequence());
+    // Last commit timestamp should be between before and after.
+    auto reload = const_config->getLastCommitTime();
+    ASSERT_FALSE(reload.is_not_a_date_time());
+    EXPECT_LE(before, reload);
+    EXPECT_GE(after, reload);
 
     // Create a new staging configuration. It should be assigned a new
     // sequence id.