Preemptively fail tests if previous invocations failed. Review: https://reviews.apache.org/r/36604
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/b1a23d6a Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/b1a23d6a Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/b1a23d6a Branch: refs/heads/master Commit: b1a23d6a52c31b8c5c840ab01902dbe00cb1feef Parents: ec6f9f8 Author: Benjamin Hindman <[email protected]> Authored: Sun Jul 19 06:15:46 2015 +0000 Committer: Benjamin Hindman <[email protected]> Committed: Sun Jul 19 11:13:16 2015 -0700 ---------------------------------------------------------------------- src/tests/mesos.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/b1a23d6a/src/tests/mesos.cpp ---------------------------------------------------------------------- diff --git a/src/tests/mesos.cpp b/src/tests/mesos.cpp index 5eab6de..f45069c 100644 --- a/src/tests/mesos.cpp +++ b/src/tests/mesos.cpp @@ -731,6 +731,29 @@ void ContainerizerTest<slave::MesosContainerizer>::SetUp() ->current_test_info() ->test_case_name() << ".*).\n" << "-------------------------------------------------------------"; + } else { + // If the subsystem is already mounted in the hierarchy make + // sure that we don't have any existing cgroups that have + // persisted that match our TEST_CGROUPS_ROOT (because + // otherwise our tests will fail when we try and clean them up + // later). + Try<std::vector<string>> cgroups = cgroups::get(hierarchy); + CHECK_SOME(cgroups); + + foreach (const string& cgroup, cgroups.get()) { + // Remove any cgroups that start with TEST_CGROUPS_ROOT. + if (strings::startsWith(cgroup, TEST_CGROUPS_ROOT)) { + AWAIT_READY(cgroups::destroy(hierarchy, cgroup)) + << "-------------------------------------------------------------\n" + << "We're very sorry but we can't seem to destroy existing\n" + << "cgroups that we likely created as part of an earlier\n" + << "invocation of the tests. Please manually destroy the cgroup\n" + << "at '" << path::join(hierarchy, cgroup) << "' by first manually\n" + << "killing all the processes found in the file at '" + << path::join(hierarchy, cgroup, "tasks") << "'\n" + << "-------------------------------------------------------------"; + } + } } } }
