mesos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andsc...@apache.org
Subject [08/11] mesos git commit: Ported `mesos-fetcher` to Windows.
Date Sat, 09 Dec 2017 02:36:10 GMT
Ported `mesos-fetcher` to Windows.

Tests for tar, gzip, and such won't be working on Windows for the time
being. Thoughts are to provide this capability to the Fetcher in a
cross-platform manner via a programmatic code library rather than
Linux-specific command line tools (tar, gzip, etc). See MESOS-8064 for
more details.

In the short term, zip and unzip will work since PowerShell supports
that natively.

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


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

Branch: refs/heads/master
Commit: d417cd98df18c8fbedd3d12f4c18cdfd5d04cce5
Parents: db89e72
Author: Jeff Coffler <jeff@taltos.com>
Authored: Mon Jul 3 11:59:26 2017 -0700
Committer: Andrew Schwartzmeyer <andrew@schwartzmeyer.com>
Committed: Fri Dec 8 16:35:40 2017 -0800

----------------------------------------------------------------------
 src/launcher/CMakeLists.txt         |  6 +-
 src/launcher/fetcher.cpp            | 39 ++++++++-----
 src/slave/CMakeLists.txt            |  2 +-
 src/slave/containerizer/fetcher.cpp | 14 ++---
 src/tests/fetcher_tests.cpp         | 98 +++++++++++++++++++++-----------
 5 files changed, 102 insertions(+), 57 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/d417cd98/src/launcher/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/launcher/CMakeLists.txt b/src/launcher/CMakeLists.txt
index c7a83d4..2ffa946 100644
--- a/src/launcher/CMakeLists.txt
+++ b/src/launcher/CMakeLists.txt
@@ -22,7 +22,5 @@ target_link_libraries(mesos-default-executor PRIVATE mesos)
 add_executable(mesos-executor executor.cpp)
 target_link_libraries(mesos-executor PRIVATE mesos)
 
-if (NOT WIN32)
-  add_executable(mesos-fetcher fetcher.cpp)
-  target_link_libraries(mesos-fetcher PRIVATE mesos)
-endif ()
+add_executable(mesos-fetcher fetcher.cpp)
+target_link_libraries(mesos-fetcher PRIVATE mesos)

http://git-wip-us.apache.org/repos/asf/mesos/blob/d417cd98/src/launcher/fetcher.cpp
----------------------------------------------------------------------
diff --git a/src/launcher/fetcher.cpp b/src/launcher/fetcher.cpp
index 5a9e93a..e2372a1 100644
--- a/src/launcher/fetcher.cpp
+++ b/src/launcher/fetcher.cpp
@@ -29,6 +29,7 @@
 #include <stout/strings.hpp>
 
 #include <stout/os/constants.hpp>
+#include <stout/os/copyfile.hpp>
 
 #include <mesos/mesos.hpp>
 
@@ -90,7 +91,17 @@ static Try<bool> extract(
     in = Subprocess::PATH(sourcePath);
     out = Subprocess::PATH(destinationPath);
   } else if (strings::endsWith(sourcePath, ".zip")) {
+#ifdef __WINDOWS__
+    command = {"powershell",
+               "-NoProfile",
+               "-Command",
+               "Expand-Archive",
+               "-Force",
+               sourcePath,
+               destinationDirectory};
+#else
     command = {"unzip", "-o", "-d", destinationDirectory, sourcePath};
+#endif // __WINDOWS__
   } else {
     return false;
   }
@@ -189,24 +200,16 @@ static Try<string> downloadWithNet(
 }
 
 
+// TODO(coffler): Refactor code to eliminate redundant function.
 static Try<string> copyFile(
-    const string& sourcePath,
-    const string& destinationPath)
+    const string& sourcePath, const string& destinationPath)
 {
-  int status = os::spawn("cp", {"cp", sourcePath, destinationPath});
+  const Try<Nothing> result = os::copyfile(sourcePath, destinationPath);
 
-  if (status == -1) {
-    return ErrnoError("Failed to copy '" + sourcePath + "'");
-  }
-
-  if (!WSUCCEEDED(status)) {
-    return Error(
-        "Failed to copy '" + sourcePath + "': " + WSTRINGIFY(status));
+  if (result.isError()) {
+    return Error(result.error());
   }
 
-  LOG(INFO) << "Copied resource '" << sourcePath
-            << "' to '" << destinationPath << "'";
-
   return destinationPath;
 }
 
@@ -264,12 +267,15 @@ static Try<string> download(
 // so that someone can do: os::chmod(path, EXECUTABLE_CHMOD_FLAGS).
 static Try<string> chmodExecutable(const string& filePath)
 {
+  // TODO(coffler): Fix Windows chmod handling, see MESOS-3176.
+#ifndef __WINDOWS__
   Try<Nothing> chmod = os::chmod(
       filePath, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
   if (chmod.isError()) {
     return Error("Failed to chmod executable '" +
                  filePath + "': " + chmod.error());
   }
+#endif // __WINDOWS__
 
   return filePath;
 }
@@ -479,6 +485,9 @@ static Try<Nothing> createCacheDirectory(const FetcherInfo&
fetcherInfo)
       if (fetcherInfo.has_user()) {
         // Fetching is performed as the task's user,
         // so chown the cache directory.
+
+        // TODO(coffler): Fix Windows chown handling, see MESOS-8063.
+#ifndef __WINDOWS__
         Try<Nothing> chown = os::chown(
             fetcherInfo.user(),
             fetcherInfo.cache_directory(),
@@ -487,6 +496,7 @@ static Try<Nothing> createCacheDirectory(const FetcherInfo&
fetcherInfo)
         if (chown.isError()) {
           return chown;
         }
+#endif // __WINDOWS__
       }
 
       break;
@@ -561,12 +571,15 @@ int main(int argc, char* argv[])
   // If the `FetcherInfo` specifies a user, use `os::su()` to fetch files as the
   // task's user to ensure that filesystem permissions are enforced.
   if (fetcherInfo.get().has_user()) {
+    // TODO(coffler): No support for os::su on Windows, see MESOS-8063
+#ifndef __WINDOWS__
     result = os::su(fetcherInfo.get().user());
     if (result.isError()) {
       EXIT(EXIT_FAILURE)
         << "Fetcher could not execute `os::su()` for user '"
         << fetcherInfo.get().user() << "'";
     }
+#endif // __WINDOWS__
   }
 
   const Option<string> cacheDirectory =

http://git-wip-us.apache.org/repos/asf/mesos/blob/d417cd98/src/slave/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/slave/CMakeLists.txt b/src/slave/CMakeLists.txt
index 5782ddc..943e8f5 100644
--- a/src/slave/CMakeLists.txt
+++ b/src/slave/CMakeLists.txt
@@ -31,6 +31,7 @@ add_dependencies(
   mesos-default-executor
   mesos-docker-executor
   mesos-executor
+  mesos-fetcher
   mesos-tcp-connect
   mesos-usage)
 
@@ -43,6 +44,5 @@ else ()
   add_dependencies(
     mesos-agent
     mesos-cni-port-mapper
-    mesos-fetcher
     mesos-io-switchboard)
 endif ()

http://git-wip-us.apache.org/repos/asf/mesos/blob/d417cd98/src/slave/containerizer/fetcher.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/fetcher.cpp b/src/slave/containerizer/fetcher.cpp
index 89b73b7..3193923 100644
--- a/src/slave/containerizer/fetcher.cpp
+++ b/src/slave/containerizer/fetcher.cpp
@@ -202,15 +202,11 @@ Result<string> Fetcher::uriToLocalPath(
   if (strings::startsWith(path, FILE_URI_LOCALHOST)) {
     path = path.substr(FILE_URI_LOCALHOST.size());
     fileUri = true;
-  } else if (strings::startsWith(path, FILE_URI_PREFIX)) {
-    path = path.substr(FILE_URI_PREFIX.size());
-    fileUri = true;
   }
 
-#ifndef __WINDOWS__
-  const bool isRelativePath = !strings::startsWith(path, "/");
+  path = path::from_uri(path);
 
-  if (isRelativePath) {
+  if (!path::absolute(path)) {
     if (fileUri) {
       return Error("File URI only supports absolute paths");
     }
@@ -226,7 +222,6 @@ Result<string> Fetcher::uriToLocalPath(
                 << "making it: '" << path << "'";
     }
   }
-#endif // __WINDOWS__
 
   return path;
 }
@@ -817,7 +812,12 @@ Future<Nothing> FetcherProcess::run(
       return Nothing();
   }
 
+#ifdef __WINDOWS__
+  string fetcherPath = path::join(flags.launcher_dir, "mesos-fetcher.exe");
+#else
   string fetcherPath = path::join(flags.launcher_dir, "mesos-fetcher");
+#endif // __WINDOWS__
+
   Result<string> realpath = os::realpath(fetcherPath);
 
   if (!realpath.isSome()) {

http://git-wip-us.apache.org/repos/asf/mesos/blob/d417cd98/src/tests/fetcher_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/fetcher_tests.cpp b/src/tests/fetcher_tests.cpp
index b81b14b..967d256 100644
--- a/src/tests/fetcher_tests.cpp
+++ b/src/tests/fetcher_tests.cpp
@@ -97,7 +97,7 @@ public:
 };
 
 
-TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, FileURI)
+TEST_F(FetcherTest, FileURI)
 {
   string fromDir = path::join(os::getcwd(), "from");
   ASSERT_SOME(os::mkdir(fromDir));
@@ -129,11 +129,12 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, FileURI)
 }
 
 
-// TODO(hausdorff): `os::getuid` does not exist on Windows.
+// TODO(coffler): Test uses os::getuid(), which does not exist on Windows.
+//     Disable test until privilege model is worked out on Windows.
 #ifndef __WINDOWS__
 // Tests that non-root users are unable to fetch root-protected files on the
 // local filesystem.
-TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, ROOT_RootProtectedFileURI)
+TEST_F(FetcherTest, ROOT_RootProtectedFileURI)
 {
   const string user = "nobody";
   ASSERT_SOME(os::getuid(user));
@@ -154,7 +155,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, ROOT_RootProtectedFileURI)
   commandInfo.set_user(user);
 
   CommandInfo::URI* uri = commandInfo.add_uris();
-  uri->set_value("file://" + testFile);
+  uri->set_value(uri::from_path(testFile));
 
   Fetcher fetcher(flags);
 
@@ -167,12 +168,12 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, ROOT_RootProtectedFileURI)
 #endif // __WINDOWS__
 
 
-TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, CustomOutputFileSubdirectory)
+TEST_F(FetcherTest, CustomOutputFileSubdirectory)
 {
   string testFile = path::join(os::getcwd(), "test");
   EXPECT_SOME(os::write(testFile, "data"));
 
-  string customOutputFile = "subdir/custom.txt";
+  string customOutputFile = path::join("subdir", "custom.txt");
   string localFile = path::join(os::getcwd(), customOutputFile);
   EXPECT_FALSE(os::exists(localFile));
 
@@ -184,7 +185,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, CustomOutputFileSubdirectory)
 
   CommandInfo commandInfo;
   CommandInfo::URI* uri = commandInfo.add_uris();
-  uri->set_value("file://" + testFile);
+  uri->set_value(uri::from_path(testFile));
   uri->set_output_file(customOutputFile);
 
   Fetcher fetcher(flags);
@@ -202,7 +203,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, CustomOutputFileSubdirectory)
 // Negative test: invalid custom URI output file. If the user specifies a
 // path for the file saved in the sandbox that has a directory component,
 // it must be a relative path.
-TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, AbsoluteCustomSubdirectoryFails)
+TEST_F(FetcherTest, AbsoluteCustomSubdirectoryFails)
 {
   string fromDir = path::join(os::getcwd(), "from");
   ASSERT_SOME(os::mkdir(fromDir));
@@ -221,7 +222,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, AbsoluteCustomSubdirectoryFails)
 
   CommandInfo commandInfo;
   CommandInfo::URI* uri = commandInfo.add_uris();
-  uri->set_value("file://" + testFile);
+  uri->set_value(uri::from_path(testFile));
   uri->set_output_file(customOutputFile);
 
   Fetcher fetcher(flags);
@@ -239,6 +240,9 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, AbsoluteCustomSubdirectoryFails)
 // Negative test: invalid user name. Copied from FileTest, so this
 // normally would succeed, but here a bogus user name is specified.
 // So we check for fetch failure.
+//
+// This won't work on Windows because file ownership and permissions
+// support isn't implemented, see MESOS-3176.
 TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, InvalidUser)
 {
   string fromDir = path::join(os::getcwd(), "from");
@@ -260,7 +264,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, InvalidUser)
   commandInfo.set_user(UUID::random().toString());
 
   CommandInfo::URI* uri = commandInfo.add_uris();
-  uri->set_value("file://" + testFile);
+  uri->set_value(uri::from_path(testFile));
 
   Fetcher fetcher(flags);
 
@@ -280,7 +284,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, InvalidUser)
 
 // Negative test: URI leading to non-existing file. Copied from FileTest,
 // but here the resource is missing. So we check for fetch failure.
-TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, NonExistingFile)
+TEST_F(FetcherTest, NonExistingFile)
 {
   string fromDir = path::join(os::getcwd(), "from");
   ASSERT_SOME(os::mkdir(fromDir));
@@ -295,7 +299,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, NonExistingFile)
 
   CommandInfo commandInfo;
   CommandInfo::URI* uri = commandInfo.add_uris();
-  uri->set_value("file://" + testFile);
+  uri->set_value(uri::from_path(testFile));
 
   Fetcher fetcher(flags);
 
@@ -337,7 +341,7 @@ TEST_F(FetcherTest, MalformedURI)
 }
 
 
-TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, AbsoluteFilePath)
+TEST_F(FetcherTest, AbsoluteFilePath)
 {
   string fromDir = path::join(os::getcwd(), "from");
   ASSERT_SOME(os::mkdir(fromDir));
@@ -355,7 +359,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, AbsoluteFilePath)
 
   CommandInfo commandInfo;
   CommandInfo::URI* uri = commandInfo.add_uris();
-  uri->set_value(testPath);
+  uri->set_value(uri::from_path(testPath));
 
   Fetcher fetcher(flags);
 
@@ -369,7 +373,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, AbsoluteFilePath)
 }
 
 
-TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, RelativeFilePath)
+TEST_F(FetcherTest, RelativeFilePath)
 {
   string fromDir = path::join(os::getcwd(), "from");
   ASSERT_SOME(os::mkdir(fromDir));
@@ -456,7 +460,7 @@ public:
 };
 
 
-TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, OSNetUriTest)
+TEST_F(FetcherTest, OSNetUriTest)
 {
   Http http;
 
@@ -466,7 +470,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, OSNetUriTest)
       "http",
       address.ip,
       address.port,
-      path::join(http.process->self().id, "test"));
+      strings::join("/", http.process->self().id, "test"));
 
   string localFile = path::join(os::getcwd(), "test");
   EXPECT_FALSE(os::exists(localFile));
@@ -502,7 +506,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, OSNetUriTest)
 // characters. This was added as a verification for MESOS-2862.
 //
 // TODO(hartem): This test case should be merged with the previous one.
-TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, OSNetUriSpaceTest)
+TEST_F(FetcherTest, OSNetUriSpaceTest)
 {
   Http http;
 
@@ -512,7 +516,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, OSNetUriSpaceTest)
       "http",
       address.ip,
       address.port,
-      path::join(http.process->self().id, "test"));
+      strings::join("/", http.process->self().id, "test"));
 
   string localFile = path::join(os::getcwd(), "test");
   EXPECT_FALSE(os::exists(localFile));
@@ -547,7 +551,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, OSNetUriSpaceTest)
 }
 
 
-TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, FileLocalhostURI)
+TEST_F(FetcherTest, FileLocalhostURI)
 {
   string fromDir = path::join(os::getcwd(), "from");
   ASSERT_SOME(os::mkdir(fromDir));
@@ -565,7 +569,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, FileLocalhostURI)
 
   CommandInfo commandInfo;
   CommandInfo::URI* uri = commandInfo.add_uris();
-  uri->set_value(path::join("file://localhost", testFile));
+  uri->set_value(uri::from_path(testFile));
 
   Fetcher fetcher(flags);
 
@@ -579,6 +583,8 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, FileLocalhostURI)
 }
 
 
+// Test disabled on Windows until permissions handling is worked out,
+// see MESOS-3176.
 TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, NoExtractNotExecutable)
 {
   // First construct a temporary file that can be fetched.
@@ -619,6 +625,8 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, NoExtractNotExecutable)
 }
 
 
+// Test disabled on Windows until permissions handling is worked out,
+// see MESOS-3176.
 TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, NoExtractExecutable)
 {
   // First construct a temporary file that can be fetched.
@@ -661,6 +669,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, NoExtractExecutable)
 
 
 // NOTE: This is disabled on Windows because `os::shell()` is deleted.
+// Also, permissions handling needs to be worked out, see MESOS-3176.
 #ifndef __WINDOWS__
 TEST_F(FetcherTest, ExtractNotExecutable)
 {
@@ -719,6 +728,10 @@ TEST_F(FetcherTest, ExtractNotExecutable)
 
 // Tests extracting tar file with extension .tar.
 // NOTE: This is disabled on Windows because `os::shell()` is deleted.
+//
+// Won't be supported on Windows for now; long term thoughts are to perhaps
+// use a code library to provide 'tar' functionality programmatically,
+// see MESOS-8064.
 #ifndef __WINDOWS__
 TEST_F(FetcherTest, ExtractTar)
 {
@@ -744,7 +757,7 @@ TEST_F(FetcherTest, ExtractTar)
 
   CommandInfo commandInfo;
   CommandInfo::URI* uri = commandInfo.add_uris();
-  uri->set_value(path.get() + ".tar");
+  uri->set_value(uri::from_path(path.get() + ".tar"));
   uri->set_extract(true);
 
   slave::Flags flags;
@@ -767,6 +780,10 @@ TEST_F(FetcherTest, ExtractTar)
 
 
 // NOTE: This is disabled on Windows because `os::shell()` is deleted.
+//
+// Won't be supported on Windows for now; long term thoughts are to perhaps
+// use a code library to provide 'gzip' functionality programmatically,
+// see MESOS-8064.
 #ifndef __WINDOWS__
 TEST_F(FetcherTest, ExtractGzipFile)
 {
@@ -809,7 +826,7 @@ TEST_F(FetcherTest, ExtractGzipFile)
 #endif // __WINDOWS__
 
 
-TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, UNZIP_ExtractFile)
+TEST_F(FetcherTest, Unzip_ExtractFile)
 {
   // Construct a tmp file that can be fetched and archived with zip.
   string fromDir = path::join(os::getcwd(), "from");
@@ -836,7 +853,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, UNZIP_ExtractFile)
 
   CommandInfo commandInfo;
   CommandInfo::URI* uri = commandInfo.add_uris();
-  uri->set_value(path.get() + ".zip");
+  uri->set_value(uri::from_path(path.get() + ".zip"));
   uri->set_extract(true);
 
   slave::Flags flags;
@@ -861,7 +878,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, UNZIP_ExtractFile)
 }
 
 
-TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, UNZIP_ExtractInvalidFile)
+TEST_F(FetcherTest, Unzip_ExtractInvalidFile)
 {
   // Construct a tmp file that can be filled with broken zip.
   string fromDir = path::join(os::getcwd(), "from");
@@ -889,7 +906,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, UNZIP_ExtractInvalidFile)
 
   CommandInfo commandInfo;
   CommandInfo::URI* uri = commandInfo.add_uris();
-  uri->set_value(path.get() + ".zip");
+  uri->set_value(uri::from_path(path.get() + ".zip"));
   uri->set_extract(true);
 
   slave::Flags flags;
@@ -903,20 +920,37 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, UNZIP_ExtractInvalidFile)
       os::getcwd(),
       None());
 
+#ifdef __WINDOWS__
+  // On Windows, PowerShell doesn't consider a CRC error to be an error,
+  // so it succeeds, whereas the zip utility errors.
+  //
+  // TODO(coffler): When we move to programmatically dealing with various
+  // data files (tar, gzip, zip, etc), we should be able to resolve this.
+  // See MESOS-7740 for further details.
+  AWAIT_READY(fetch);
+#else
   AWAIT_FAILED(fetch);
+#endif // __WINDOWS__
 
   string extractedFile = path::join(os::getcwd(), "world");
   ASSERT_TRUE(os::exists(extractedFile));
 
   ASSERT_SOME_EQ("hello hello\n", os::read(extractedFile));
 
+#ifdef __WINDOWS__
+  // TODO(coffler): Eliminate with programmatic decoding of container files.
+  // See MESOS-7740 for further details.
+  //
+  // On Windows, PowerShell doesn't consider a CRC error to be an error.
+  // Adjust metrics appropriately to not expect an error back.
+  verifyMetrics(1, 0);
+#else
   verifyMetrics(0, 1);
+#endif // __WINDOWS__
 }
 
 
-TEST_F_TEMP_DISABLED_ON_WINDOWS(
-    FetcherTest,
-    UNZIP_ExtractFileWithDuplicatedEntries)
+TEST_F(FetcherTest, Unzip_ExtractFileWithDuplicatedEntries)
 {
   // Construct a tmp file that can be filled with zip containing
   // duplicates.
@@ -946,7 +980,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(
 
   CommandInfo commandInfo;
   CommandInfo::URI* uri = commandInfo.add_uris();
-  uri->set_value(path.get() + ".zip");
+  uri->set_value(uri::from_path(path.get() + ".zip"));
   uri->set_extract(true);
 
   slave::Flags flags;
@@ -971,7 +1005,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(
 }
 
 
-TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, UseCustomOutputFile)
+TEST_F(FetcherTest, UseCustomOutputFile)
 {
   // First construct a temporary file that can be fetched.
   Try<string> dir = os::mkdtemp(path::join(os::getcwd(), "XXXXXX"));
@@ -988,7 +1022,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(FetcherTest, UseCustomOutputFile)
   const string customOutputFile = "custom.txt";
   CommandInfo commandInfo;
   CommandInfo::URI* uri = commandInfo.add_uris();
-  uri->set_value(path.get());
+  uri->set_value(uri::from_path(path.get()));
   uri->set_extract(true);
   uri->set_output_file(customOutputFile);
 


Mime
View raw message