From 61cc28851e054e66dfe9dbd9b7a8e4bb4c5ac99a Mon Sep 17 00:00:00 2001 From: Dmitry Platon Date: Wed, 29 Jun 2016 16:00:45 +0300 Subject: [PATCH] Add utils --- .../src/erl_mesos_test_executor.erl | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/test/erl_mesos_test_executor/src/erl_mesos_test_executor.erl b/test/erl_mesos_test_executor/src/erl_mesos_test_executor.erl index d28ef65..ce78a49 100644 --- a/test/erl_mesos_test_executor/src/erl_mesos_test_executor.erl +++ b/test/erl_mesos_test_executor/src/erl_mesos_test_executor.erl @@ -70,11 +70,11 @@ reregistered(ExecutorInfo, #state{disconnected_executor_info = launch_task(ExecutorInfo, #'Event.Launch'{task = TaskInfo}, State) -> #'TaskInfo'{task_id = TaskId, agent_id = AgentId} = TaskInfo, - TaskStatus = #'TaskStatus'{task_id = TaskId, - state = 'TASK_RUNNING', - source = 'SOURCE_EXECUTOR', - agent_id = AgentId, - uuid = uuid()}, + Uuid = erl_mesos_utils:uuid(), + TaskStatus = erl_mesos_utils:task_status(TaskId, 'TASK_RUNNING', + 'SOURCE_EXECUTOR', AgentId, + undefined, undefined, undefined, + undefined, Uuid), Update = erl_mesos_executor:update(ExecutorInfo, TaskStatus), reply(ExecutorInfo, launch_task, {Update, ExecutorInfo}), {ok, State#state{task_id = TaskId}}. @@ -124,10 +124,6 @@ terminate(ExecutorInfo, Reason, _State) -> reply(ExecutorInfo, Name, Data) -> erl_mesos_executor:message(ExecutorInfo, term_to_binary({Name, Data})). -uuid() -> - <> = crypto:rand_bytes(16), - <>. - response_pid() -> [{ClientRef, _Request} | _] = ets:tab2list(hackney_manager), {ok, Pid} = hackney_manager:async_response_pid(ClientRef),