]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3181] Reset the time stamp of the last sent release.
authorMarcin Siodelski <marcin@isc.org>
Wed, 4 Dec 2013 18:37:11 +0000 (19:37 +0100)
committerMarcin Siodelski <marcin@isc.org>
Wed, 4 Dec 2013 18:37:11 +0000 (19:37 +0100)
tests/tools/perfdhcp/test_control.cc
tests/tools/perfdhcp/test_control.h
tests/tools/perfdhcp/tests/test_control_unittest.cc

index 3fc69ffc243722bfbe44cdc9bfe2585e93d9830e..75adcd527546fa6c46330906b9fb7bd8c38e6c62 100644 (file)
@@ -1286,6 +1286,7 @@ TestControl::reset() {
     renew_due_ = send_due_;
     release_due_ = send_due_;
     last_renew_ = send_due_;
+    last_release_ = send_due_;
     transid_gen_.reset();
     // Actual generators will have to be set later on because we need to
     // get command line parameters first.
index 8f5ed945052eb06f1694f5337b0d3b035bc3146b..c949ee75a491428e592a4e22e6c83a451415937e 100644 (file)
@@ -1087,8 +1087,6 @@ protected:
                                            ///< was attempted.
     boost::posix_time::ptime last_release_;///< Indicates when the last Release
                                            ///< was attempted.
-private:
-
     boost::posix_time::ptime last_report_; ///< Last intermediate report time.
 
     StatsMgr4Ptr stats_mgr4_;  ///< Statistics Manager 4.
index 0a0b843d0c44b7dc801f60e1182bf8c7ce717883..384ae4a8475ba4a251a78664ccab6a861162471a 100644 (file)
@@ -120,6 +120,7 @@ public:
     using TestControl::processReceivedPacket4;
     using TestControl::processReceivedPacket6;
     using TestControl::registerOptionFactories;
+    using TestControl::reset;
     using TestControl::sendDiscover4;
     using TestControl::sendPackets;
     using TestControl::sendMultipleMessages6;
@@ -129,10 +130,15 @@ public:
     using TestControl::setDefaults6;
     using TestControl::send_due_;
     using TestControl::last_sent_;
+    using TestControl::last_report_;
     using TestControl::renew_due_;
     using TestControl::release_due_;
     using TestControl::last_renew_;
     using TestControl::last_release_;
+    using TestControl::transid_gen_;
+    using TestControl::macaddr_gen_;
+    using TestControl::first_packet_serverid_;
+    using TestControl::interrupted_;
 
     NakedTestControl() : TestControl() {
         uint32_t clients_num = CommandOptions::instance().getClientsNum() == 0 ?
@@ -905,6 +911,25 @@ public:
 
 };
 
+// This test verifies that the class members are reset to expected values.
+TEST_F(TestControlTest, reset) {
+    NakedTestControl tc;
+    tc.reset();
+    EXPECT_FALSE(tc.send_due_.is_not_a_date_time());
+    EXPECT_FALSE(tc.last_sent_.is_not_a_date_time());
+    EXPECT_FALSE(tc.last_report_.is_not_a_date_time());
+    EXPECT_FALSE(tc.renew_due_.is_not_a_date_time());
+    EXPECT_FALSE(tc.release_due_.is_not_a_date_time());
+    EXPECT_FALSE(tc.last_renew_.is_not_a_date_time());
+    EXPECT_FALSE(tc.last_release_.is_not_a_date_time());
+    EXPECT_FALSE(tc.send_due_.is_not_a_date_time());
+    EXPECT_FALSE(tc.transid_gen_);
+    EXPECT_FALSE(tc.macaddr_gen_);
+    EXPECT_TRUE(tc.first_packet_serverid_.empty());
+    EXPECT_FALSE(tc.interrupted_);
+
+}
+
 TEST_F(TestControlTest, GenerateDuid) {
     // Simple command line that simulates one client only. Always the
     // same DUID will be generated.