Browse Source

[master] Corrected Lease6 logical operator unit tests fail intermittently.

Equality operator tests were reliant on two Lease6 structs, constructed
back to back to have the same value for cltt_, which gets its value from
time(NULL).  Corrected this by simple assignment to ensure they are always
equal as the test expects.
Thomas Markwalder 12 years ago
parent
commit
c989ea1255
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/lib/dhcpsrv/tests/lease_mgr_unittest.cc

+ 4 - 0
src/lib/dhcpsrv/tests/lease_mgr_unittest.cc

@@ -487,6 +487,10 @@ TEST(Lease6, OperatorEquals) {
                                subnet_id);
     Lease6 lease2(Lease6::LEASE_IA_NA, addr, duid, iaid, 100, 200, 50, 80,
                                subnet_id);
+
+    // cltt_ constructs with time(NULL), make sure they are always equal
+    lease1.cltt_ = lease2.cltt_;
+
     EXPECT_TRUE(lease1 == lease2);
     EXPECT_FALSE(lease1 != lease2);