You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2016/03/18 00:11:40 UTC
mesos git commit: Fix the broken ProvisionerDockerPullerTest on
Centos7.
Repository: mesos
Updated Branches:
refs/heads/master 388da2919 -> 23bd1c680
Fix the broken ProvisionerDockerPullerTest on Centos7.
Review: https://reviews.apache.org/r/44985
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/23bd1c68
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/23bd1c68
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/23bd1c68
Branch: refs/heads/master
Commit: 23bd1c6808eac831da0b11c48ed86d9833cc8209
Parents: 388da29
Author: Jie Yu <yu...@gmail.com>
Authored: Thu Mar 17 09:36:32 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Thu Mar 17 16:11:20 2016 -0700
----------------------------------------------------------------------
.../containerizer/provisioner_docker_tests.cpp | 16 ++++++++--
src/tests/mesos.hpp | 31 +++++++++++++++++---
2 files changed, 40 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/23bd1c68/src/tests/containerizer/provisioner_docker_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/provisioner_docker_tests.cpp b/src/tests/containerizer/provisioner_docker_tests.cpp
index 72d4c3e..e4b30b9 100644
--- a/src/tests/containerizer/provisioner_docker_tests.cpp
+++ b/src/tests/containerizer/provisioner_docker_tests.cpp
@@ -321,7 +321,7 @@ class ProvisionerDockerPullerTest : public MesosTest {};
// This test verifies that local docker image can be pulled and
// provisioned correctly, and shell command should be executed.
-TEST_F(ProvisionerDockerPullerTest, ROOT_LocalPullerShellCommand)
+TEST_F(ProvisionerDockerPullerTest, ROOT_LocalPullerSimpleCommand)
{
Try<Owned<cluster::Master>> master = StartMaster();
ASSERT_SOME(master);
@@ -398,7 +398,7 @@ TEST_F(ProvisionerDockerPullerTest, ROOT_LocalPullerShellCommand)
// TODO(jieyu): This is a ROOT test because of MESOS-4757. Remove the
// ROOT restriction after MESOS-4757 is resolved.
-TEST_F(ProvisionerDockerPullerTest, ROOT_INTERNET_CURL_ShellCommand)
+TEST_F(ProvisionerDockerPullerTest, ROOT_INTERNET_CURL_SimpleCommand)
{
Try<Owned<cluster::Master>> master = StartMaster();
ASSERT_SOME(master);
@@ -430,10 +430,20 @@ TEST_F(ProvisionerDockerPullerTest, ROOT_INTERNET_CURL_ShellCommand)
const Offer& offer = offers.get()[0];
+ // NOTE: We use a non-shell command here because 'sh' might not be
+ // in the PATH. 'alpine' does not specify env PATH in the image. On
+ // some linux distribution, '/bin' is not in the PATH by default.
+ CommandInfo command;
+ command.set_shell(false);
+ command.set_value("/bin/ls");
+ command.add_arguments("ls");
+ command.add_arguments("-al");
+ command.add_arguments("/");
+
TaskInfo task = createTask(
offer.slave_id(),
Resources::parse("cpus:1;mem:128").get(),
- "ls -al /");
+ command);
Image image;
image.set_type(Image::DOCKER);
http://git-wip-us.apache.org/repos/asf/mesos/blob/23bd1c68/src/tests/mesos.hpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp
index 93b9340..aaef158 100644
--- a/src/tests/mesos.hpp
+++ b/src/tests/mesos.hpp
@@ -410,7 +410,7 @@ protected:
inline TaskInfo createTask(
const SlaveID& slaveId,
const Resources& resources,
- const std::string& command,
+ const CommandInfo& command,
const Option<mesos::ExecutorID>& executorId = None(),
const std::string& name = "test-task",
const std::string& id = UUID::random().toString())
@@ -423,10 +423,10 @@ inline TaskInfo createTask(
if (executorId.isSome()) {
ExecutorInfo executor;
executor.mutable_executor_id()->CopyFrom(executorId.get());
- executor.mutable_command()->set_value(command);
+ executor.mutable_command()->CopyFrom(command);
task.mutable_executor()->CopyFrom(executor);
} else {
- task.mutable_command()->set_value(command);
+ task.mutable_command()->CopyFrom(command);
}
return task;
@@ -434,6 +434,24 @@ inline TaskInfo createTask(
inline TaskInfo createTask(
+ const SlaveID& slaveId,
+ const Resources& resources,
+ const std::string& command,
+ const Option<mesos::ExecutorID>& executorId = None(),
+ const std::string& name = "test-task",
+ const std::string& id = UUID::random().toString())
+{
+ return createTask(
+ slaveId,
+ resources,
+ CREATE_COMMAND_INFO(command),
+ executorId,
+ name,
+ id);
+}
+
+
+inline TaskInfo createTask(
const Offer& offer,
const std::string& command,
const Option<mesos::ExecutorID>& executorId = None(),
@@ -441,7 +459,12 @@ inline TaskInfo createTask(
const std::string& id = UUID::random().toString())
{
return createTask(
- offer.slave_id(), offer.resources(), command, executorId, name, id);
+ offer.slave_id(),
+ offer.resources(),
+ command,
+ executorId,
+ name,
+ id);
}