You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by al...@apache.org on 2016/11/22 13:49:12 UTC
[2/2] mesos git commit: Made
`CommandExecutorTest.NoTransitionFromKillingToRunning` more robust.
Made `CommandExecutorTest.NoTransitionFromKillingToRunning` more robust.
This patch makes the test use the newly introduced test helper, instead
of the more fragile `trap` shell built-in.
Review: https://reviews.apache.org/r/53574/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/71c82a1b
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/71c82a1b
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/71c82a1b
Branch: refs/heads/master
Commit: 71c82a1bc80df41040e58e9adf428e5fbcc5613b
Parents: 4811ae0
Author: Gast�n Kleiman <ga...@mesosphere.com>
Authored: Tue Nov 22 14:45:28 2016 +0100
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Tue Nov 22 14:49:00 2016 +0100
----------------------------------------------------------------------
src/tests/command_executor_tests.cpp | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/71c82a1b/src/tests/command_executor_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/command_executor_tests.cpp b/src/tests/command_executor_tests.cpp
index 62a09bd..6352786 100644
--- a/src/tests/command_executor_tests.cpp
+++ b/src/tests/command_executor_tests.cpp
@@ -39,8 +39,10 @@
#include "slave/containerizer/mesos/containerizer.hpp"
+#include "tests/kill_policy_test_helper.hpp"
#include "tests/mesos.hpp"
#include "tests/mock_slave.hpp"
+#include "tests/utils.hpp"
using mesos::internal::master::Master;
@@ -256,13 +258,12 @@ TEST_P(CommandExecutorTest, NoTransitionFromKillingToRunning)
AWAIT_READY(offers);
EXPECT_EQ(1u, offers->size());
- // Use "15" instead of SIGTERM to workaround a bug in ash's implementation of
- // trap.
- //
- // TODO(gkleiman): Replace this fragile workaround with a test helper.
- TaskInfo task = createTask(
- offers->front(),
- "trap \"sleep 15\" 15 && sleep 120");
+ const string command = strings::format(
+ "%s %s --sleep_duration=15",
+ getTestHelperPath("test-helper"),
+ KillPolicyTestHelper::NAME).get();
+
+ TaskInfo task = createTask(offers->front(), command);
// Create a health check that succeeds until a temporary file is removed.
Try<string> temporaryPath = os::mktemp(path::join(os::getcwd(), "XXXXXX"));