You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ch...@apache.org on 2018/05/04 19:18:48 UTC

[1/2] mesos git commit: Fixed a race in resource provider resubscription test.

Repository: mesos
Updated Branches:
  refs/heads/master e048e898e -> 895f539b1


Fixed a race in resource provider resubscription test.

We previously did not make ensure that after the simulated agent
failover in
`ResourceProviderManagerHttpApiTest.ResubscribeResourceProvider` the
mock resource provider created as part of the test did not reconnect
to the restarted agent (as opposed to the newly initialized resource
provider). This lead to unmet test expectations.

With this patch we now explicitly tear down the mock resource provider
after we have detected that the agent went away to prevent the race.

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


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

Branch: refs/heads/master
Commit: c6a60b81ad74479f197dac82e002d509c1d27b14
Parents: e048e89
Author: Benjamin Bannier <be...@mesosphere.io>
Authored: Fri May 4 12:09:20 2018 -0700
Committer: Chun-Hung Hsiao <ch...@mesosphere.io>
Committed: Fri May 4 12:09:20 2018 -0700

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


http://git-wip-us.apache.org/repos/asf/mesos/blob/c6a60b81/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 e8ca377..662ea3b 100644
--- a/src/tests/resource_provider_manager_tests.cpp
+++ b/src/tests/resource_provider_manager_tests.cpp
@@ -1124,9 +1124,21 @@ TEST_P_TEMP_DISABLED_ON_WINDOWS(
 
   Future<Nothing> __recover = FUTURE_DISPATCH(_, &Slave::__recover);
 
+  // We terminate the resource provider once we have confirmed that it
+  // got disconnected. This avoids it to in turn resubscribe racing
+  // with the newly created resource provider.
+  Future<Nothing> disconnected;
+  EXPECT_CALL(*resourceProvider, disconnected())
+    .WillOnce(DoAll(
+        FutureSatisfy(&disconnected),
+        Invoke([&resourceProvider]() { resourceProvider.reset(); })))
+    .WillRepeatedly(Return()); // Ignore spurious calls concurrent with `reset`.
+
   // The agent failover.
-  EXPECT_CALL(*resourceProvider, disconnected());
   agent->reset();
+
+  AWAIT_READY(disconnected);
+
   agent = StartSlave(detector.get(), slaveFlags);
 
   Clock::advance(slaveFlags.registration_backoff_factor);


[2/2] mesos git commit: Fixed synchronization orders for destructing mock resource providers.

Posted by ch...@apache.org.
Fixed synchronization orders for destructing mock resource providers.

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


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

Branch: refs/heads/master
Commit: 895f539b17e8d1960c44554e4d646dc9972350bd
Parents: c6a60b8
Author: Chun-Hung Hsiao <ch...@mesosphere.io>
Authored: Fri May 4 12:13:30 2018 -0700
Committer: Chun-Hung Hsiao <ch...@mesosphere.io>
Committed: Fri May 4 12:14:32 2018 -0700

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


http://git-wip-us.apache.org/repos/asf/mesos/blob/895f539b/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 662ea3b..c2045f2 100644
--- a/src/tests/resource_provider_manager_tests.cpp
+++ b/src/tests/resource_provider_manager_tests.cpp
@@ -1130,8 +1130,8 @@ TEST_P_TEMP_DISABLED_ON_WINDOWS(
   Future<Nothing> disconnected;
   EXPECT_CALL(*resourceProvider, disconnected())
     .WillOnce(DoAll(
-        FutureSatisfy(&disconnected),
-        Invoke([&resourceProvider]() { resourceProvider.reset(); })))
+        Invoke([&resourceProvider]() { resourceProvider.reset(); }),
+        FutureSatisfy(&disconnected)))
     .WillRepeatedly(Return()); // Ignore spurious calls concurrent with `reset`.
 
   // The agent failover.
@@ -1375,8 +1375,8 @@ TEST_F(ResourceProviderManagerHttpApiTest, ResourceProviderSubscribeDisconnect)
   Future<Nothing> disconnected1;
   EXPECT_CALL(*resourceProvider1, disconnected())
     .WillOnce(DoAll(
-        FutureSatisfy(&disconnected1),
-        Invoke([&resourceProvider1]() { resourceProvider1.reset(); })))
+        Invoke([&resourceProvider1]() { resourceProvider1.reset(); }),
+        FutureSatisfy(&disconnected1)))
     .WillRepeatedly(Return()); // Ignore spurious calls concurrent with `reset`.
 
   Future<Event::Subscribed> subscribed2;