Repository: mesos Updated Branches: refs/heads/master 1a8cdfa50 -> 3dcd225db
Fixed flaky `ROOT_IsolatorFlags` test. Starting more than one agent simultaneously in tests leads to a race condition between a linux launcher which calls `cgroups::prepare()` for the first slave and `LinuxLauncherProcess::recover()` which iterates over cgroups hierarchy for the second slave. Therefore, `mesos/test` cgroup that is created to check if the kernel supports nested cgroups can be detected by a recovery process as they use same cgroup hierarchy path by default. That leads to orphan containers and causes flakiness of `ROOT_IsolatorFlags` test. To fix the issue, this patch adds termination of an agent before starting a new one. Review: https://reviews.apache.org/r/66449/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/1f20119a Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/1f20119a Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/1f20119a Branch: refs/heads/master Commit: 1f20119a576f05b4b1d45f02250446a663dcaf69 Parents: 1a8cdfa Author: Andrei Budnik <abud...@mesosphere.com> Authored: Tue Apr 10 23:40:29 2018 -0700 Committer: Gilbert Song <songzihao1...@gmail.com> Committed: Tue Apr 10 23:43:57 2018 -0700 ---------------------------------------------------------------------- .../containerizer/linux_capabilities_isolator_tests.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/1f20119a/src/tests/containerizer/linux_capabilities_isolator_tests.cpp ---------------------------------------------------------------------- diff --git a/src/tests/containerizer/linux_capabilities_isolator_tests.cpp b/src/tests/containerizer/linux_capabilities_isolator_tests.cpp index 147f2cc..74b7b0f 100644 --- a/src/tests/containerizer/linux_capabilities_isolator_tests.cpp +++ b/src/tests/containerizer/linux_capabilities_isolator_tests.cpp @@ -744,24 +744,32 @@ TEST_F(LinuxCapabilitiesIsolatorFlagsTest, ROOT_IsolatorFlags) slave = StartSlave(&detector, flags); ASSERT_SOME(slave); + slave->reset(); + // Allowed is a subset of bounding, which is OK. flags.effective_capabilities = convert(set<Capability>({NET_RAW})); flags.bounding_capabilities = convert(set<Capability>({NET_RAW, NET_ADMIN})); slave = StartSlave(&detector, flags); ASSERT_SOME(slave); + slave->reset(); + // Both sets are allowed to be missing. flags.effective_capabilities = None(); flags.bounding_capabilities = None(); slave = StartSlave(&detector, flags); ASSERT_SOME(slave); + slave->reset(); + // Bounding capabilities are allowed to be missing. flags.effective_capabilities = convert(set<Capability>({NET_RAW})); flags.bounding_capabilities = None(); slave = StartSlave(&detector, flags); ASSERT_SOME(slave); + slave->reset(); + // Effective capabilities are allowed to be missing. flags.effective_capabilities = None(); flags.bounding_capabilities = convert(set<Capability>({NET_RAW}));