Repository: mesos
Updated Branches:
  refs/heads/master be47e96e7 -> 88f5629e5


Made sure test agent has reached stable state before starting test.

We require a certain number of offers in
`SlaveTest.ResourceProviderPublishAll`, so we need to make sure that
the agent knows all resources available during the test before offers
are being generated.

In this patch we await all `UpdateSlaveMessage` from the agent to make
sure the agent has seen all resources. Only then do we register a
framework. This greatly minimizes the risk of not seeing the expected
number of offers which now should only happen if due to
master-internal message reordering the allocator sees the framework
before it sees the latest agent resource update.

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


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

Branch: refs/heads/master
Commit: 2d35efb2d88b4dfb1f627688bc24435b1db513b9
Parents: be47e96
Author: Benjamin Bannier <benjamin.bann...@mesosphere.io>
Authored: Tue Apr 10 17:06:02 2018 +0200
Committer: Benjamin Bannier <bbann...@apache.org>
Committed: Tue Apr 10 17:06:02 2018 +0200

----------------------------------------------------------------------
 src/tests/slave_tests.cpp | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/2d35efb2/src/tests/slave_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/slave_tests.cpp b/src/tests/slave_tests.cpp
index 646a2b9..04f7aca 100644
--- a/src/tests/slave_tests.cpp
+++ b/src/tests/slave_tests.cpp
@@ -10575,13 +10575,13 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(SlaveTest, 
ResourceProviderPublishAll)
   slave::Flags flags = CreateSlaveFlags();
   flags.authenticate_http_readwrite = false;
 
-  Future<SlaveRegisteredMessage> slaveRegisteredMessage =
-    FUTURE_PROTOBUF(SlaveRegisteredMessage(), _, _);
+  Future<UpdateSlaveMessage> updateSlaveMessage =
+    FUTURE_PROTOBUF(UpdateSlaveMessage(), _, _);
 
   Try<Owned<cluster::Slave>> slave = StartSlave(detector.get(), flags);
   ASSERT_SOME(slave);
 
-  AWAIT_READY(slaveRegisteredMessage);
+  AWAIT_READY(updateSlaveMessage);
 
   // Register a mock local resource provider with the agent.
   v1::ResourceProviderInfo resourceProviderInfo;
@@ -10598,11 +10598,15 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(SlaveTest, 
ResourceProviderPublishAll)
   Owned<EndpointDetector> endpointDetector(
       resource_provider::createEndpointDetector(slave.get()->pid));
 
+  updateSlaveMessage = FUTURE_PROTOBUF(UpdateSlaveMessage(), _, _);
+
   resourceProvider.start(
       endpointDetector,
       ContentType::PROTOBUF,
       v1::DEFAULT_CREDENTIAL);
 
+  AWAIT_READY(updateSlaveMessage);
+
   // We want to register two frameworks to launch two concurrent tasks
   // that use the provider resources, and verify that when the second
   // task is launched, all provider resources are published.

Reply via email to