> On Jan. 11, 2016, 8:09 p.m., Joseph Wu wrote: > > 3rdparty/libprocess/src/tests/metrics_tests.cpp, lines 280-283 > > <https://reviews.apache.org/r/42121/diff/1/?file=1190948#file1190948line280> > > > > Just some thoughts: > > > > The downstream event you're waiting for is a call to `Clock::timer` > > with a duration of 2 seconds. You can presumably access the private clock > > variables `timers` and `timers_mutex` by declaring them in the test. (We > > do with for `openssl::reinitialize`.) > > > > If you do this, you'll probably need to loop and check for a specific > > time to be added (`Timeout::in(duration)`). To make the check > > deterministic, the clock should be paused (so that `Clock::now` stays > > constant), which it already is in the test.
Yeah, that would work but it seems pretty kludgy and would be a layering violation. It would be nicer if we could mock the MetricsProcess and then use the existing `EXPECT_CALL` machinery to ensure that sufficient progress has been made, but that would require a bunch of refactoring. - Neil ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/42121/#review113827 ----------------------------------------------------------- On Jan. 10, 2016, 8:33 p.m., Neil Conway wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/42121/ > ----------------------------------------------------------- > > (Updated Jan. 10, 2016, 8:33 p.m.) > > > Review request for mesos, Ben Mahler and Joris Van Remoortere. > > > Repository: mesos > > > Description > ------- > > Using `Clock::settle()` does not provide the synchronization that > "MetricsTest.SnapshotTimeout" requires. Of course, using `os::sleep()` is not > right either, but at least it is more honest than using `Clock::settle()`. > > > Diffs > ----- > > 3rdparty/libprocess/src/tests/metrics_tests.cpp > b84dc8d858f58bc9f52b218b7153510417cf34c2 > > Diff: https://reviews.apache.org/r/42121/diff/ > > > Testing > ------- > > ./3rdparty/libprocess/libprocess-tests > --gtest_filter="MetricsTest.SnapshotTimeout" --gtest_repeat=2000 > --gtest_break_on_failure > > > Thanks, > > Neil Conway > >
