Repository: mesos
Updated Branches:
  refs/heads/master 15b9418f4 -> 9f2dc56f0


Fixed a bug where MockSlave `id` is not properly initialized.

The `MockSlave` did not initialize the id field using the input
argument. Also it is necessary to call its virtual base class
`ProcessBase` constructor explicitly to avoid argument `id` being
lost.

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


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

Branch: refs/heads/master
Commit: 9f2dc56f028a1835a05e40bdea4058ca7259c915
Parents: 15b9418
Author: Meng Zhu <m...@mesosphere.io>
Authored: Mon Feb 12 22:07:27 2018 -0800
Committer: Benjamin Mahler <bmah...@apache.org>
Committed: Mon Feb 12 22:07:27 2018 -0800

----------------------------------------------------------------------
 src/tests/mock_slave.cpp | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/9f2dc56f/src/tests/mock_slave.cpp
----------------------------------------------------------------------
diff --git a/src/tests/mock_slave.cpp b/src/tests/mock_slave.cpp
index 597d7ab..9d930cf 100644
--- a/src/tests/mock_slave.cpp
+++ b/src/tests/mock_slave.cpp
@@ -104,8 +104,14 @@ MockSlave::MockSlave(
     QoSController* qosController,
     SecretGenerator* secretGenerator,
     const Option<Authorizer*>& authorizer)
-  : slave::Slave(
-        process::ID::generate("slave"),
+  // It is necessary to explicitly call `ProcessBase` constructor here even
+  // though the direct parent `Slave` already does this. This is because
+  // `ProcessBase` being a virtual base class, if not being explicitly
+  // constructed here by passing `id`, will be constructed implicitly first 
with
+  // a default constructor, resulting in lost argument `id`.
+  : ProcessBase(id),
+    slave::Slave(
+        id,
         flags,
         detector,
         containerizer,

Reply via email to