You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2017/11/24 03:03:42 UTC

mesos git commit: Fixed a flaky resource provider test.

Repository: mesos
Updated Branches:
  refs/heads/master 7d55c9244 -> 708902d6f


Fixed a flaky resource provider test.

An agent could run into a registration timeout and try to register a
second time. In that case the master will acknowledge the registration
twice. This is expected. As a result the agent would send
'UpdateSlaveMessage' twice. The test expected the second
'UpdateSlaveMessage' to be the result of a resource provider
registration, hence the test would fail. This has been resolved by
controlling the clock during registration to avoid registration
timeouts.

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


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

Branch: refs/heads/master
Commit: 708902d6f207b6f93c94b3589a31d54c812a7657
Parents: 7d55c92
Author: Jan Schlicht <ja...@mesosphere.io>
Authored: Thu Nov 23 19:03:35 2017 -0800
Committer: Jie Yu <yu...@gmail.com>
Committed: Thu Nov 23 19:03:35 2017 -0800

----------------------------------------------------------------------
 src/tests/resource_provider_manager_tests.cpp | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/708902d6/src/tests/resource_provider_manager_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/resource_provider_manager_tests.cpp b/src/tests/resource_provider_manager_tests.cpp
index ce4335b..27fa440 100644
--- a/src/tests/resource_provider_manager_tests.cpp
+++ b/src/tests/resource_provider_manager_tests.cpp
@@ -619,9 +619,19 @@ TEST_P(ResourceProviderManagerHttpApiTest, ConvertResources)
     capability->set_type(type);
   }
 
+  // Pause the clock and control it manually in order to
+  // control the timing of the registration. A registration timeout
+  // would trigger multiple registration attempts. As a result, multiple
+  // 'UpdateSlaveMessage' would be sent, which we need to avoid to
+  // ensure that the second 'UpdateSlaveMessage' is a result of the
+  // resource provider registration.
+  Clock::pause();
+
   Try<Owned<cluster::Slave>> agent = StartSlave(detector.get(), slaveFlags);
   ASSERT_SOME(agent);
 
+  Clock::advance(slaveFlags.registration_backoff_factor);
+  Clock::settle();
   AWAIT_READY(updateSlaveMessage);
 
   v1::Resource disk = v1::createDiskResource(
@@ -629,6 +639,8 @@ TEST_P(ResourceProviderManagerHttpApiTest, ConvertResources)
 
   updateSlaveMessage = FUTURE_PROTOBUF(UpdateSlaveMessage(), _, _);
 
+  Clock::resume();
+
   v1::MockResourceProvider resourceProvider(Some(v1::Resources(disk)));
 
   // Start and register a resource provider.