Browse Source

[3181] Reset the time stamp of the last sent release.

Marcin Siodelski 11 years ago
parent
commit
b25d9710ab

+ 1 - 0
tests/tools/perfdhcp/test_control.cc

@@ -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.

+ 0 - 2
tests/tools/perfdhcp/test_control.h

@@ -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.

+ 25 - 0
tests/tools/perfdhcp/tests/test_control_unittest.cc

@@ -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.