Windows: Enabled more agent tests.
These tests "just worked" once the isolators and command was fixed to be
Windows-compatible. Particularly, `/bin/echo --author` was replaced with
an equivalent PowerShell command, and `posix/cpu,posix/mem` was replaced
with `windows/cpu`.
Review: https://reviews.apache.org/r/63817
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/453d631c
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/453d631c
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/453d631c
Branch: refs/heads/master
Commit: 453d631cf116275f567e222c54481b614d1bb965
Parents: 0dee8b1
Author: Andrew Schwartzmeyer
Authored: Fri Nov 3 12:42:35 2017 -0700
Committer: Andrew Schwartzmeyer
Committed: Wed Nov 29 19:24:11 2017 -0800
--
src/tests/slave_tests.cpp | 85 ++
1 file changed, 45 insertions(+), 40 deletions(-)
--
http://git-wip-us.apache.org/repos/asf/mesos/blob/453d631c/src/tests/slave_tests.cpp
--
diff --git a/src/tests/slave_tests.cpp b/src/tests/slave_tests.cpp
index 6e4a860..823bd44 100644
--- a/src/tests/slave_tests.cpp
+++ b/src/tests/slave_tests.cpp
@@ -151,7 +151,35 @@ namespace tests {
// that seem vaguely more slave than master-related are in this file.
// The others are in "master_tests.cpp".
-class SlaveTest : public MesosTest {};
+class SlaveTest : public MesosTest
+{
+public:
+ const std::string defaultIsolators{
+#ifdef __WINDOWS__
+ "windows/cpu"
+#else
+ "posix/cpu,posix/mem"
+#endif // __WINDOWS__
+ };
+
+ CommandInfo echoAuthorCommand()
+ {
+CommandInfo command;
+command.set_shell(false);
+#ifdef __WINDOWS__
+command.set_value("powershell.exe");
+command.add_arguments("powershell.exe");
+command.add_arguments("-NoProfile");
+command.add_arguments("-Command");
+command.add_arguments("echo --author");
+#else
+command.set_value("/bin/echo");
+command.add_arguments("/bin/echo");
+command.add_arguments("--author");
+#endif // __WINDOWS__
+return command;
+ };
+};
// This test ensures that when a slave shuts itself down, it
@@ -327,7 +355,7 @@ TEST_F(SlaveTest, DuplicateTerminalUpdateBeforeAck)
}
-TEST_F_TEMP_DISABLED_ON_WINDOWS(SlaveTest, ShutdownUnregisteredExecutor)
+TEST_F(SlaveTest, ShutdownUnregisteredExecutor)
{
Try master = StartMaster();
ASSERT_SOME(master);
@@ -336,7 +364,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(SlaveTest,
ShutdownUnregisteredExecutor)
slave::Flags flags = CreateSlaveFlags();
// Set the isolation flag so we know a MesosContainerizer will
// be created.
- flags.isolation = "posix/cpu,posix/mem";
+ flags.isolation = defaultIsolators;
Fetcher fetcher(flags);
@@ -616,14 +644,14 @@ TEST_F(SlaveTest, RemoveUnregisteredTerminatedExecutor)
// mesos-executor args. For more details of this see MESOS-1873.
//
// This assumes the ability to execute '/bin/echo --author'.
-TEST_F_TEMP_DISABLED_ON_WINDOWS(SlaveTest, CommandTaskWithArguments)
+TEST_F(SlaveTest, CommandTaskWithArguments)
{
Try master = StartMaster();
ASSERT_SOME(master);
// Need flags for 'executor_registration_timeout'.
slave::Flags flags = CreateSlaveFlags();
- flags.isolation = "posix/cpu,posix/mem";
+ flags.isolation = defaultIsolators;
Fetcher fetcher(flags);
@@ -663,13 +691,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(SlaveTest,
CommandTaskWithArguments)
task.mutable_resources()->MergeFrom(offers.get()[0].resources());
// Command executor will run as user running test.
- CommandInfo command;
- command.set_shell(false);
- command.set_value("/bin/echo");
- command.add_arguments("/bin/echo");
- command.add_arguments("--author");
-
- task.mutable_command()->MergeFrom(command);
+ task.mutable_command()->MergeFrom(echoAuthorCommand());
Future statusStarting;
Future statusRunning;
@@ -783,7 +805,7 @@ TEST_F(SlaveTest, CommandTaskWithKillPolicy)
// Don't let args from the CommandInfo struct bleed over into
// mesos-executor forking. For more details of this see MESOS-1873.
-TEST_F_TEMP_DISABLED_ON_WINDOWS(SlaveTest, GetExecutorInfo)
+TEST_F(SlaveTest, GetExecutorInfo)
{
TestContainerizer containerizer;
StandaloneMasterDetector detector;
@@ -813,14 +835,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(SlaveTest, GetExecutorInfo)
task.mutable_slave_id()->set_value(
"20141010-221431-251662764-60288-32120-0001");
task.mutable_resources()->MergeFrom(taskResources);
-
- CommandInfo command;
- command.set_shell(false);
- command.set_value("/bin/echo");
- command.add_arguments("/bin/echo");
- command.add_arguments("--author");
-
- task.mutable_command()->MergeFrom(command);
+