You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jo...@apache.org on 2019/09/18 23:15:23 UTC

[mesos] 02/03: Windows: Fixed AllocationRoleEnvironmentVariable tests.

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

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

commit 0691449bbaaee36c8ea7dbebc71bcea278f7630a
Author: Joseph Wu <jo...@apache.org>
AuthorDate: Thu Sep 12 18:08:43 2019 -0700

    Windows: Fixed AllocationRoleEnvironmentVariable tests.
    
    These tests were using a shell script, which can easily be
    converted to a batch script on Windows.
    
    Review: https://reviews.apache.org/r/71509
---
 src/tests/command_executor_tests.cpp                   | 4 ++++
 src/tests/containerizer/docker_containerizer_tests.cpp | 4 ++++
 src/tests/default_executor_tests.cpp                   | 4 ++++
 3 files changed, 12 insertions(+)

diff --git a/src/tests/command_executor_tests.cpp b/src/tests/command_executor_tests.cpp
index e9726b0..c7f7711 100644
--- a/src/tests/command_executor_tests.cpp
+++ b/src/tests/command_executor_tests.cpp
@@ -466,7 +466,11 @@ TEST_P(CommandExecutorTest, AllocationRoleEnvironmentVariable)
   TaskInfo task = createTask(
       offers->front().slave_id(),
       offers->front().resources(),
+#ifdef __WINDOWS__
+      "if %MESOS_ALLOCATION_ROLE% == \"role1\" (exit 1)");
+#else
       "if [ \"$MESOS_ALLOCATION_ROLE\" != \"role1\" ]; then exit 1; fi");
+#endif // __WINDOWS__
 
   Future<TaskStatus> statusStarting;
   Future<TaskStatus> statusRunning;
diff --git a/src/tests/containerizer/docker_containerizer_tests.cpp b/src/tests/containerizer/docker_containerizer_tests.cpp
index 5e31a95..689a722 100644
--- a/src/tests/containerizer/docker_containerizer_tests.cpp
+++ b/src/tests/containerizer/docker_containerizer_tests.cpp
@@ -4697,7 +4697,11 @@ TEST_F(DockerContainerizerTest, ROOT_DOCKER_AllocationRoleEnvironmentVariable)
   TaskInfo task = createTask(
       offers->front().slave_id(),
       offers->front().resources(),
+#ifdef __WINDOWS__
+      "if %MESOS_ALLOCATION_ROLE% == \"role1\" (exit 1)");
+#else
       "if [ \"$MESOS_ALLOCATION_ROLE\" != \"role1\" ]; then exit 1; fi");
+#endif // __WINDOWS__
 
   // TODO(tnachen): Use local image to test if possible.
   task.mutable_container()->CopyFrom(createDockerInfo(DOCKER_TEST_IMAGE));
diff --git a/src/tests/default_executor_tests.cpp b/src/tests/default_executor_tests.cpp
index e5c0bf2..49c4e3b 100644
--- a/src/tests/default_executor_tests.cpp
+++ b/src/tests/default_executor_tests.cpp
@@ -4391,7 +4391,11 @@ TEST_P(DefaultExecutorTest, AllocationRoleEnvironmentVariable)
   v1::TaskInfo taskInfo = v1::createTask(
       agentId,
       resources,
+#ifdef __WINDOWS__
+      "if %MESOS_ALLOCATION_ROLE% == \"role1\" (exit 1)");
+#else
       "if [ \"$MESOS_ALLOCATION_ROLE\" != \"role1\" ]; then exit 1; fi");
+#endif // __WINDOWS__
 
   mesos.send(
       v1::createCallAccept(