You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by gi...@apache.org on 2019/01/25 00:00:27 UTC

[mesos] 01/02: Fixed flakiness by adding per agent config dir for mesos test.

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

gilbert pushed a commit to branch 1.7.x
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit 2c912ca08f6e57315bf9b7b69f4956a08a79d044
Author: Gilbert Song <so...@gmail.com>
AuthorDate: Wed Jan 16 14:02:07 2019 -0800

    Fixed flakiness by adding per agent config dir for mesos test.
    
    In mesos tests, there are some cases that multiple agents are
    running simultanuously. From commit 07bccc63, we start to have
    agents share the same config dir in the test sandbox. Unit
    tests that use the same credicial file dir may fail if there
    are agents read and write to the same credential file
    simultanuously. We should set unique dir per agent.
    
    Review: https://reviews.apache.org/r/69776
    (cherry picked from commit 68ee08d1ed1bcb3130937ce503b6c9961687c53b)
---
 src/tests/mesos.cpp | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/tests/mesos.cpp b/src/tests/mesos.cpp
index 791ec16..b712e63 100644
--- a/src/tests/mesos.cpp
+++ b/src/tests/mesos.cpp
@@ -170,17 +170,20 @@ slave::Flags MesosTest::CreateSlaveFlags()
   CHECK_SOME(runtimeDir) << "Failed to create temporary directory";
   flags.runtime_dir = runtimeDir.get();
 
-  flags.fetcher_cache_dir = path::join(sandbox.get(), "fetch");
+  Try<string> agentDir = os::mkdtemp(path::join(sandbox.get(), "XXXXXX"));
+  CHECK_SOME(agentDir) << "Failed to create temporary directory";
+
+  flags.fetcher_cache_dir = path::join(agentDir.get(), "fetch");
 
   flags.launcher_dir = getLauncherDir();
 
-  flags.appc_store_dir = path::join(sandbox.get(), "store", "appc");
+  flags.appc_store_dir = path::join(agentDir.get(), "store", "appc");
 
-  flags.docker_store_dir = path::join(sandbox.get(), "store", "docker");
+  flags.docker_store_dir = path::join(agentDir.get(), "store", "docker");
 
   {
     // Create a default credential file for master/agent authentication.
-    const string& path = path::join(sandbox.get(), "credential");
+    const string& path = path::join(agentDir.get(), "credential");
 
     Try<int_fd> fd = os::open(
         path,
@@ -214,7 +217,7 @@ slave::Flags MesosTest::CreateSlaveFlags()
 
   {
     // Create a secret key for executor authentication.
-    const string path = path::join(sandbox.get(), "jwt_secret_key");
+    const string path = path::join(agentDir.get(), "jwt_secret_key");
 
     Try<int_fd> fd = os::open(
         path,
@@ -240,7 +243,7 @@ slave::Flags MesosTest::CreateSlaveFlags()
 
   {
     // Create a default HTTP credentials file.
-    const string& path = path::join(sandbox.get(), "http_credentials");
+    const string& path = path::join(agentDir.get(), "http_credentials");
 
     Try<int_fd> fd = os::open(
         path,