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/11/28 23:27:04 UTC

[mesos] 02/09: Made the `createTask` helper work for both v0 and v1 API.

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

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

commit 9f268d255ccd785d9c69904df4827cfa8a44225e
Author: Chun-Hung Hsiao <ch...@mesosphere.io>
AuthorDate: Tue Nov 27 13:50:37 2018 -0800

    Made the `createTask` helper work for both v0 and v1 API.
    
    The patched `createTask` helper originally uses the `slave_id` accessor,
    which does not apply to the v1 API. This patch fixes this problem.
    
    Review: https://reviews.apache.org/r/69464
---
 src/tests/mesos.hpp | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp
index 576f4bd..b181f73 100644
--- a/src/tests/mesos.hpp
+++ b/src/tests/mesos.hpp
@@ -798,6 +798,18 @@ inline TContainerInfo createContainerInfo(
 }
 
 
+inline SlaveID getAgentID(const Offer& offer)
+{
+  return offer.slave_id();
+}
+
+
+inline mesos::v1::AgentID getAgentID(const mesos::v1::Offer& offer)
+{
+  return offer.agent_id();
+}
+
+
 inline void setAgentID(TaskInfo* task, const SlaveID& slaveId)
 {
   task->mutable_slave_id()->CopyFrom(slaveId);
@@ -904,7 +916,7 @@ inline TTaskInfo createTask(
       TExecutorInfo,
       TCommandInfo,
       TOffer>(
-          offer.slave_id(),
+          getAgentID(offer),
           offer.resources(),
           command,
           executorId,