You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by tn...@apache.org on 2016/01/13 02:27:25 UTC

mesos git commit: Fixed flakiness in RegistryTokenTest.ExpiredToken.

Repository: mesos
Updated Branches:
  refs/heads/master 1d334bd92 -> d7daf708f


Fixed flakiness in RegistryTokenTest.ExpiredToken.

This test previously used `Clock::now`. Because the effect of `Clock::advance`
is not reset between test runs, every run of the complete test suite results in
advancing `Clock::now` by about four weeks. Hence, after running the test suite
~12 times, `Clock::now` is ~one year ahead of the actual time, which broke an
invariant in RegistryTokenTest.ExpiredToken.

It would be good to reset the clock to cancel the effect of any previous
`Clock::advance` calls between test runs, but that will be more complicated. So
for now the test has been modified to just use a fixed time in the past.

Review: https://reviews.apache.org/r/42208/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/d7daf708
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/d7daf708
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/d7daf708

Branch: refs/heads/master
Commit: d7daf708f2f4751f18439968d84dbb40b7195fa4
Parents: 1d334bd
Author: Neil Conway <ne...@gmail.com>
Authored: Tue Jan 12 15:17:48 2016 -0800
Committer: Timothy Chen <tn...@apache.org>
Committed: Tue Jan 12 17:26:55 2016 -0800

----------------------------------------------------------------------
 src/tests/containerizer/provisioner_docker_tests.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/d7daf708/src/tests/containerizer/provisioner_docker_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/provisioner_docker_tests.cpp b/src/tests/containerizer/provisioner_docker_tests.cpp
index 8d6a060..f81f003 100644
--- a/src/tests/containerizer/provisioner_docker_tests.cpp
+++ b/src/tests/containerizer/provisioner_docker_tests.cpp
@@ -226,11 +226,13 @@ TEST_F(RegistryTokenTest, ValidToken)
 }
 
 
-// Tests JSON Web Token parsing for a token string with expiration date in the
-// past.
+// Tests JSON Web Token parsing for a token string with expiration
+// date in the past.
 TEST_F(RegistryTokenTest, ExpiredToken)
 {
-  const double expirySecs = Clock::now().secs() - Days(365).secs();
+  // Use an arbitrary fixed date that is far in the past (12 weeks
+  // after the Unix epoch).
+  const double expirySecs = Weeks(12).secs();
 
   claimsJsonString =
     "{\"access\" \