You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by an...@apache.org on 2018/05/23 02:26:30 UTC

[3/3] mesos git commit: Windows: Changed test image to custom nanoserver.

Windows: Changed test image to custom nanoserver.

The test docker images was based off of the official nanoserver
powershell image that hasn't been updated for 1803 yet. Since we don't
actually need powershell for the docker tests, the image has been
changed to a custom one based off the official nanoserver image, which
is updated for 1803.

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


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

Branch: refs/heads/master
Commit: 40177c893134870b8228babfc5eb40bd134f742a
Parents: 9dd3d43
Author: Akash Gupta <ak...@hotmail.com>
Authored: Tue May 22 15:59:29 2018 -0700
Committer: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Committed: Tue May 22 15:59:29 2018 -0700

----------------------------------------------------------------------
 src/tests/containerizer/docker_common.hpp | 14 +++-----------
 src/tests/containerizer/docker_tests.cpp  |  4 ++--
 src/tests/health_check_tests.cpp          | 19 +++++++++----------
 3 files changed, 14 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/40177c89/src/tests/containerizer/docker_common.hpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/docker_common.hpp b/src/tests/containerizer/docker_common.hpp
index 172eea3..191a5e7 100644
--- a/src/tests/containerizer/docker_common.hpp
+++ b/src/tests/containerizer/docker_common.hpp
@@ -43,18 +43,12 @@ namespace internal {
 namespace tests {
 
 #ifdef __WINDOWS__
-// The following image is the microsoft/powershell:nanoserver image with
+// The following image is the microsoft/nanoserver image with
 // ContainerAdministrator as the default user. There are some permission bugs
 // with accessing volume mounts in process (but not Hyper-V) isolation as
 // the regular ContainerUser user, but accesing them as ContainerAdministrator
-// works fine. Note that this image runs the 1709 version, so the host needs
-// to be 1709 if running on Windows Server. Running on a 1709 host is
-// recommended anyway since it fixes bugs that made these tests run slowly.
-static constexpr char DOCKER_TEST_IMAGE[] = "akagup/pwsh-nano-admin";
-
-// The powershell image uses Powershell Core, which calls the executable as
-// `pwsh` instead of `powershell`. So the regular sleep macro doesn't work.
-#define DOCKER_SLEEP_CMD(x) "pwsh -Command Start-Sleep -Seconds " #x
+// works fine.
+static constexpr char DOCKER_TEST_IMAGE[] = "akagup/nano-admin";
 
 // We use a custom HTTP(S) server here, because the official `microsoft/iis`
 // HTTP server image is ~20x larger than this one, so pulling it takes too
@@ -67,8 +61,6 @@ static constexpr char DOCKER_HTTPS_COMMAND[] = "http.exe";
 #else
 static constexpr char DOCKER_TEST_IMAGE[] = "alpine";
 
-#define DOCKER_SLEEP_CMD(x) SLEEP_COMMAND(x)
-
 // The HTTP server is netcat running on alpine.
 static constexpr char DOCKER_HTTP_IMAGE[] = "alpine";
 static constexpr char DOCKER_HTTP_COMMAND[] =

http://git-wip-us.apache.org/repos/asf/mesos/blob/40177c89/src/tests/containerizer/docker_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/docker_tests.cpp b/src/tests/containerizer/docker_tests.cpp
index e4660f7..622ffff 100644
--- a/src/tests/containerizer/docker_tests.cpp
+++ b/src/tests/containerizer/docker_tests.cpp
@@ -165,7 +165,7 @@ TEST_F(DockerTest, ROOT_DOCKER_interface)
   containerInfo.mutable_docker()->CopyFrom(dockerInfo);
 
   CommandInfo commandInfo;
-  commandInfo.set_value(DOCKER_SLEEP_CMD(120));
+  commandInfo.set_value(SLEEP_COMMAND(120));
 
   Try<Docker::RunOptions> runOptions = Docker::RunOptions::create(
       containerInfo,
@@ -326,7 +326,7 @@ TEST_F(DockerTest, ROOT_DOCKER_kill)
   containerInfo.mutable_docker()->CopyFrom(dockerInfo);
 
   CommandInfo commandInfo;
-  commandInfo.set_value(DOCKER_SLEEP_CMD(120));
+  commandInfo.set_value(SLEEP_COMMAND(120));
 
   Try<Docker::RunOptions> runOptions = Docker::RunOptions::create(
       containerInfo,

http://git-wip-us.apache.org/repos/asf/mesos/blob/40177c89/src/tests/health_check_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/health_check_tests.cpp b/src/tests/health_check_tests.cpp
index c4661b4..7e8f86c 100644
--- a/src/tests/health_check_tests.cpp
+++ b/src/tests/health_check_tests.cpp
@@ -2396,7 +2396,7 @@ TEST_F(DockerContainerizerHealthCheckTest, ROOT_DOCKER_DockerHealthyTask)
   AWAIT_READY(offers);
   ASSERT_FALSE(offers->empty());
 
-  TaskInfo task = createTask(offers.get()[0], DOCKER_SLEEP_CMD(120));
+  TaskInfo task = createTask(offers.get()[0], SLEEP_COMMAND(120));
 
   // TODO(tnachen): Use local image to test if possible.
   ContainerInfo containerInfo;
@@ -2526,7 +2526,7 @@ TEST_F(DockerContainerizerHealthCheckTest, ROOT_DOCKER_DockerHealthStatusChange)
   AWAIT_READY(offers);
   ASSERT_FALSE(offers->empty());
 
-  TaskInfo task = createTask(offers.get()[0], DOCKER_SLEEP_CMD(120));
+  TaskInfo task = createTask(offers.get()[0], SLEEP_COMMAND(120));
 
   // TODO(tnachen): Use local image to test if possible.
   ContainerInfo containerInfo;
@@ -2550,15 +2550,14 @@ TEST_F(DockerContainerizerHealthCheckTest, ROOT_DOCKER_DockerHealthStatusChange)
   //
   // Case 1:
   //   - Remove the temporary file.
+  //
+  // NOTE: On Windows, we delete a temporary directory instead since `del`
+  // doesn't return an error if it tries to delete a nonexistent file, but
+  // `rmdir` does.
 #ifdef __WINDOWS__
   const string healthCheckCmd =
-    "pwsh -Command "
-    "Remove-Item -ErrorAction SilentlyContinue \"" + tmpPath + "\"; "
-    "if (-Not $?) { "
-      "New-Item -ItemType Directory -Force \"" + os::getcwd() + "\"; "
-      "Set-Content -Path \"" + tmpPath + "\" -Value foo; "
-      "exit 1 "
-    "}";
+    "rmdir /s /q " + os::getcwd() + " || "
+    "(mkdir " + os::getcwd() + " && echo foo > " + tmpPath + " && exit 1)";
 #else
   const string healthCheckCmd =
     "rm " + tmpPath + " || "
@@ -2709,7 +2708,7 @@ TEST_F(
   AWAIT_READY(offers);
   ASSERT_FALSE(offers->empty());
 
-  TaskInfo task = createTask(offers.get()[0], DOCKER_SLEEP_CMD(120));
+  TaskInfo task = createTask(offers.get()[0], SLEEP_COMMAND(120));
 
   // TODO(akagup): Use local image to test if possible.
   ContainerInfo containerInfo;