]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5062] Added provision for time skew
authorFrancis Dupont <fdupont@isc.org>
Tue, 14 Mar 2017 17:36:06 +0000 (18:36 +0100)
committerFrancis Dupont <fdupont@isc.org>
Tue, 14 Mar 2017 17:36:06 +0000 (18:36 +0100)
src/bin/dhcp6/tests/renew_unittest.cc

index c61066fcd811d50df0298fd8b985929e9c5205c4..7e4c5adb3f87dcf7dea2acc409711c5122a446ec 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015-2017 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -290,8 +290,16 @@ TEST_F(RenewTest, requestPrefixInRenew) {
     ASSERT_EQ(1, leases_client_na_renewed.size());
     EXPECT_EQ(STATUS_Success, client.getStatusCode(na_iaid_));
 
-    // The lease should have been renewed.
-    EXPECT_EQ(1000, leases_client_na_renewed[0].cltt_ - leases_client_na[0].cltt_);
+    // The lease should have been renewed. Allow some time skew.
+#ifdef STRICT_REQUEST_PREFIX_IN_RENEW
+    EXPECT_EQ(1000,
+              leases_client_na_renewed[0].cltt_ - leases_client_na[0].cltt_);
+#else
+    EXPECT_LE(995,
+              leases_client_na_renewed[0].cltt_ - leases_client_na[0].cltt_);
+    EXPECT_GE(1005,
+              leases_client_na_renewed[0].cltt_ - leases_client_na[0].cltt_);
+#endif
 
     // The client should now also acquire a PD lease.
     leases_client_pd = client.getLeasesByType(Lease::TYPE_PD);