You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2016/04/25 23:15:38 UTC
[22/24] mesos git commit: Fix the broken ProvisionerDockerPullerTest
on Centos7.
Fix the broken ProvisionerDockerPullerTest on Centos7.
*** Modified for 0.28.1 release ***
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/d7eac40d
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/d7eac40d
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/d7eac40d
Branch: refs/heads/0.28.x
Commit: d7eac40d4122eee66f6a7bc9849d185414a515f3
Parents: cf8c704
Author: Jie Yu <yu...@gmail.com>
Authored: Thu Mar 17 09:36:32 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Tue Apr 5 16:32:40 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/d7eac40d/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 5b685bf..9639263 100644
--- a/src/tests/containerizer/provisioner_docker_tests.cpp
+++ b/src/tests/containerizer/provisioner_docker_tests.cpp
@@ -313,12 +313,12 @@ TEST_F(ProvisionerDockerLocalStoreTest, PullingSameImageSimutanuously)
#ifdef __linux__
-class ProvisionerDockerRegistryPullerTest : public MesosTest {};
+class ProvisionerDockerPullerTest : public MesosTest {};
// TODO(jieyu): This is a ROOT test because of MESOS-4757. Remove the
// ROOT restriction after MESOS-4757 is resolved.
-TEST_F(ProvisionerDockerRegistryPullerTest, ROOT_INTERNET_CURL_ShellCommand)
+TEST_F(ProvisionerDockerPullerTest, ROOT_INTERNET_CURL_SimpleCommand)
{
Try<PID<Master>> master = StartMaster();
ASSERT_SOME(master);
@@ -349,10 +349,20 @@ TEST_F(ProvisionerDockerRegistryPullerTest, 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/d7eac40d/src/tests/mesos.hpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp
index d36840f..0570cc8 100644
--- a/src/tests/mesos.hpp
+++ b/src/tests/mesos.hpp
@@ -455,7 +455,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())
@@ -468,10 +468,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;
@@ -479,6 +479,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(),
@@ -486,7 +504,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);
}