You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2016/03/29 22:03:52 UTC
mesos git commit: Fixed flakiness in
ContainerLoggerTest.LOGROTATE_RotateInSandbox.
Repository: mesos
Updated Branches:
refs/heads/master 34b22ec8c -> e8a1a578f
Fixed flakiness in ContainerLoggerTest.LOGROTATE_RotateInSandbox.
This removes a race between the test and the global `ReapProcess`, which were
originally both calling `waitpid` on the logger subprocesses. The test now
defers the reaping to the `ReapProcess` and just waits for all logger
subprocesses to exit naturally via `os::exists(pid)`.
Since the `ReapProcess` reaps on an interval, a `Clock::advance` was inserted to
skip the reap delay.
Review: https://reviews.apache.org/r/45051/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/e8a1a578
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/e8a1a578
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/e8a1a578
Branch: refs/heads/master
Commit: e8a1a578fdf85f9edf90eb7af30e55fe957c8eba
Parents: 34b22ec
Author: Joseph Wu <jo...@mesosphere.io>
Authored: Tue Mar 29 13:03:23 2016 -0700
Committer: Vinod Kone <vi...@gmail.com>
Committed: Tue Mar 29 13:03:23 2016 -0700
----------------------------------------------------------------------
src/tests/container_logger_tests.cpp | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/e8a1a578/src/tests/container_logger_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/container_logger_tests.cpp b/src/tests/container_logger_tests.cpp
index 71101c3..eff19c8 100644
--- a/src/tests/container_logger_tests.cpp
+++ b/src/tests/container_logger_tests.cpp
@@ -20,6 +20,7 @@
#include <gmock/gmock.h>
+#include <process/clock.hpp>
#include <process/future.hpp>
#include <process/gtest.hpp>
#include <process/owned.hpp>
@@ -458,7 +459,24 @@ TEST_F(ContainerLoggerTest, LOGROTATE_RotateInSandbox)
Try<os::ProcessTree> pstrees = os::pstree(0);
ASSERT_SOME(pstrees);
foreach (const os::ProcessTree& pstree, pstrees.get().children) {
- ASSERT_EQ(pstree.process.pid, waitpid(pstree.process.pid, NULL, 0));
+ // Wait for the logger subprocesses to exit, for up to 5 seconds each.
+ Duration waited = Duration::zero();
+ do {
+ if (!os::exists(pstree.process.pid)) {
+ break;
+ }
+
+ // Push the clock ahead to speed up the reaping of subprocesses.
+ Clock::pause();
+ Clock::settle();
+ Clock::advance(Seconds(1));
+ Clock::resume();
+
+ os::sleep(Milliseconds(100));
+ waited += Milliseconds(100);
+ } while (waited < Seconds(5));
+
+ EXPECT_LE(waited, Seconds(5));
}
// Check for the expected log rotation.