This is an automated email from the ASF dual-hosted git repository.

bbannier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit 0c544bb7f906a179a5caf6567b3d5de5da55a06b
Author: Benjamin Bannier <[email protected]>
AuthorDate: Thu Dec 20 10:24:22 2018 +0100

    Tested framework subscription with set but empty ID.
    
    This patch add a test for the case where a framework subscribes with a
    set, but empty `FrameworkID`. While this has never been officially
    supported, the master code currently contains extensive handling for
    this case.
    
    This test can be removed if MESOS-9481 gets implemented.
    
    Review: https://reviews.apache.org/r/69557/
---
 src/tests/master_tests.cpp | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/src/tests/master_tests.cpp b/src/tests/master_tests.cpp
index a67e3db..51fcbe8 100644
--- a/src/tests/master_tests.cpp
+++ b/src/tests/master_tests.cpp
@@ -6485,6 +6485,34 @@ TEST_F(MasterTest, RejectFrameworkWithInvalidRole)
 }
 
 
+// This test validates the undocumented but currently supported ability of
+// frameworks to register with an empty, but set ID. This case is treated
+// identical to the case where the framework registered without an ID.
+//
+// TODO(bbannier): Remove this test once MESOS-9481 is implemented.
+TEST_F(MasterTest, FrameworkSubscribeEmptyId)
+{
+  Try<Owned<cluster::Master>> master = StartMaster();
+  ASSERT_SOME(master);
+
+  FrameworkInfo framework = DEFAULT_FRAMEWORK_INFO;
+  framework.mutable_id()->set_value("");
+
+  MockScheduler sched;
+  MesosSchedulerDriver driver(
+      &sched, framework, master.get()->pid, DEFAULT_CREDENTIAL);
+
+  Future<FrameworkID> frameworkId;
+  EXPECT_CALL(sched, registered(&driver, _, _))
+    .WillOnce(FutureArg<1>(&frameworkId));
+
+  driver.start();
+
+  AWAIT_READY(frameworkId);
+  EXPECT_FALSE(frameworkId->value().empty());
+}
+
+
 TEST_F(MasterTest, FrameworksEndpointWithoutFrameworks)
 {
   master::Flags flags = CreateMasterFlags();

Reply via email to