Repository: mesos
Updated Branches:
  refs/heads/master c76ddee30 -> 701b24e89


Windows: Fixed `SlaveReregisterTaskExecutorIds` test.

Similar to the check tests, with the `cpu` hard cap enabled, the task in
this test failed with an OOM error because PowerShell requires more
resources than were being allocated. The `defaultTaskResourcesString`
was moved into the `MesosTests` base class so that any test creating a
task can use these default resources, instead of a hard-coded string.
Additionally, the resources allocated by default for an agent were
increased so that multiple tasks can be run simultaneously (as this test
does).

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


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

Branch: refs/heads/master
Commit: 701b24e8907ff796003aec62c5018371cb64952c
Parents: 062b5b4
Author: Andrew Schwartzmeyer <[email protected]>
Authored: Mon Nov 13 14:22:29 2017 -0800
Committer: Andrew Schwartzmeyer <[email protected]>
Committed: Thu Nov 30 15:54:53 2017 -0800

----------------------------------------------------------------------
 src/tests/check_tests.cpp                       | 16 ------------
 src/tests/master_slave_reconciliation_tests.cpp |  2 +-
 src/tests/mesos.hpp                             | 26 +++++++++++++++++++-
 3 files changed, 26 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/701b24e8/src/tests/check_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/check_tests.cpp b/src/tests/check_tests.cpp
index f14b81a..2a71f41 100644
--- a/src/tests/check_tests.cpp
+++ b/src/tests/check_tests.cpp
@@ -228,22 +228,6 @@ public:
 
     mesos->send(call);
   }
-
-  // NOTE: On Windows, most tasks are run under PowerShell, which uses ~150 MB
-  // of memory per-instance due to loading .NET. Realistically, PowerShell can
-  // be called more than once in a task, so 512 MB is the safe minimum.
-  // Furthermore, because the Windows `cpuset` isolator is a hard-cap, 0.1 CPUs
-  // will cause the task (or even a check command) to timeout, so 1 CPU is the
-  // safe minimum.
-  //
-  // On platforms where the shell is, e.g. Bash, the minimum is much lower.
-  const std::string defaultTaskResourcesString{
-#ifdef __WINDOWS__
-      "cpus:1;mem:512;disk:32"
-#else
-      "cpus:0.1;mem:32;disk:32"
-#endif // __WINDOWS__
-      };
 };
 
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/701b24e8/src/tests/master_slave_reconciliation_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_slave_reconciliation_tests.cpp 
b/src/tests/master_slave_reconciliation_tests.cpp
index d2501f5..1a9b40a 100644
--- a/src/tests/master_slave_reconciliation_tests.cpp
+++ b/src/tests/master_slave_reconciliation_tests.cpp
@@ -763,7 +763,7 @@ TEST_F(MasterSlaveReconciliationTest, 
SlaveReregisterTaskExecutorIds)
   const Offer& offer = offers->front();
   const SlaveID& slaveId = offer.slave_id();
 
-  Resources resources = Resources::parse("cpus:0.1;mem:32;disk:32").get();
+  Resources resources = Resources::parse(defaultTaskResourcesString).get();
 
   TaskInfo commandExecutorTask =
     createTask(slaveId, resources, SLEEP_COMMAND(1000));

http://git-wip-us.apache.org/repos/asf/mesos/blob/701b24e8/src/tests/mesos.hpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp
index c871878..99542c5 100644
--- a/src/tests/mesos.hpp
+++ b/src/tests/mesos.hpp
@@ -266,8 +266,32 @@ protected:
 
   Option<zookeeper::URL> zookeeperUrl;
 
+  // NOTE: On Windows, most tasks are run under PowerShell, which uses ~150 MB
+  // of memory per-instance due to loading .NET. Realistically, PowerShell can
+  // be called more than once in a task, so 512 MB is the safe minimum.
+  // Furthermore, because the Windows `cpu` isolator is a hard-cap, 0.1 CPUs
+  // will cause the task (or even a check command) to timeout, so 1 CPU is the
+  // safe minimum.
+  //
+  // Because multiple tasks can be run, the default agent resources needs to be
+  // at least a multiple of the default task resources: four times seems safe.
+  //
+  // On platforms where the shell is, e.g. Bash, the minimum is much lower.
   const std::string defaultAgentResourcesString{
-    "cpus:2;gpus:0;mem:1024;disk:1024;ports:[31000-32000]"};
+#ifdef __WINDOWS__
+      "cpus:4;gpus:0;mem:2048;disk:1024;ports:[31000-32000]"
+#else
+      "cpus:2;gpus:0;mem:1024;disk:1024;ports:[31000-32000]"
+#endif // __WINDOWS__
+      };
+
+  const std::string defaultTaskResourcesString{
+#ifdef __WINDOWS__
+      "cpus:1;mem:512;disk:32"
+#else
+      "cpus:0.1;mem:32;disk:32"
+#endif // __WINDOWS__
+      };
 };
 
 

Reply via email to