You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by tn...@apache.org on 2015/12/10 16:31:20 UTC

[3/3] mesos git commit: Changed RegistryClientTest to use instance work directory.

Changed RegistryClientTest to use instance work directory.

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


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

Branch: refs/heads/master
Commit: 21b5bbdba5c30fd6d73856f544b23a524994f131
Parents: 388dd5f
Author: Jojy Varghese <jo...@mesosphere.io>
Authored: Thu Dec 10 16:41:57 2015 +0800
Committer: Timothy Chen <tn...@apache.org>
Committed: Thu Dec 10 23:31:01 2015 +0800

----------------------------------------------------------------------
 .../containerizer/provisioner_docker_tests.cpp  | 25 ++++++--------------
 1 file changed, 7 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/21b5bbdb/src/tests/containerizer/provisioner_docker_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/provisioner_docker_tests.cpp b/src/tests/containerizer/provisioner_docker_tests.cpp
index c63bf53..d562d47 100644
--- a/src/tests/containerizer/provisioner_docker_tests.cpp
+++ b/src/tests/containerizer/provisioner_docker_tests.cpp
@@ -522,25 +522,14 @@ protected:
         {"SSL_CERT_FILE", certificate_path().value}});
   }
 
-  static void SetUpTestCase()
+  // Abstracts the concept of the directory the tests would be sandboxed to.
+  // TODO(jojy): Have uuid based unique working directory.
+  string working_directory()
   {
-    if (os::mkdir(RegistryClientTest::OUTPUT_DIR).isError()) {
-      ABORT("Could not create temporary directory: " +
-          RegistryClientTest::OUTPUT_DIR);
-    }
+    return os::getcwd();
   }
-
-  static void TearDownTestCase()
-  {
-    SSLTest::TearDownTestCase();
-
-    os::rmdir(RegistryClientTest::OUTPUT_DIR);
-  }
-
-  static const string OUTPUT_DIR;
 };
 
-const string RegistryClientTest::OUTPUT_DIR = "output_dir";
 
 // Tests TokenManager for a simple token request.
 TEST_F(RegistryClientTest, SimpleGetToken)
@@ -855,7 +844,7 @@ TEST_F(RegistryClientTest, SimpleGetBlob)
 
   ASSERT_SOME(registryClient);
 
-  const Path blobPath(RegistryClientTest::OUTPUT_DIR + "/blob");
+  const Path blobPath(path::join(working_directory(), "blob"));
 
   Future<size_t> result =
     registryClient.get()->getBlob(
@@ -960,7 +949,7 @@ TEST_F(RegistryClientTest, BadRequest)
 
   ASSERT_SOME(registryClient);
 
-  const Path blobPath(RegistryClientTest::OUTPUT_DIR + "/blob");
+  const Path blobPath(path::join(working_directory(), "blob"));
 
   Future<size_t> result =
     registryClient.get()->getBlob(
@@ -1013,7 +1002,7 @@ TEST_F(RegistryClientTest, SimpleRegistryPuller)
 
   ASSERT_SOME(registryPuller);
 
-  const Path registryPullerPath(RegistryClientTest::OUTPUT_DIR);
+  const Path registryPullerPath(working_directory());
 
   Try<slave::docker::Image::Name> imageName =
     parseImageName("busybox");