You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2019/07/10 03:37:48 UTC

[mesos] 05/06: Updated LaunchTask test action to use a unique TaskID across runs.

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

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

commit 5bb3dcd4f8662857b234761e2e35fd08fa87b5d6
Author: Benjamin Mahler <bm...@apache.org>
AuthorDate: Mon Jul 8 13:34:32 2019 -0400

    Updated LaunchTask test action to use a unique TaskID across runs.
    
    The existing incremented counter is problematic if the action is
    used multiple times in a test, as the task id will clash across
    usages.
    
    No tests appear to rely on the existing task id assignment scheme,
    so this updates it to be randomly unique via UUID.
    
    Review: https://reviews.apache.org/r/71031
---
 src/tests/mesos.hpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp
index d0c82fa..4612e2e 100644
--- a/src/tests/mesos.hpp
+++ b/src/tests/mesos.hpp
@@ -2418,7 +2418,6 @@ ACTION_P5(LaunchTasks, executor, tasks, cpus, mem, role)
       taskResources.allocate(role);
     }
 
-    int nextTaskId = 0;
     std::vector<TaskInfo> tasks;
     Resources remaining = offer.resources();
 
@@ -2426,7 +2425,7 @@ ACTION_P5(LaunchTasks, executor, tasks, cpus, mem, role)
            launched < numTasks) {
       TaskInfo task;
       task.set_name("TestTask");
-      task.mutable_task_id()->set_value(stringify(nextTaskId++));
+      task.mutable_task_id()->set_value(id::UUID::random().toString());
       task.mutable_slave_id()->MergeFrom(offer.slave_id());
       task.mutable_executor()->MergeFrom(executor);