Repository: mesos Updated Branches: refs/heads/master 3945454da -> b4bd08693
Fixed two flaky tests in AllocatorTest. Review: https://reviews.apache.org/r/24418 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/b4bd0869 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/b4bd0869 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/b4bd0869 Branch: refs/heads/master Commit: b4bd08693f394a196e0310955b1afdfbe3c2de36 Parents: 3945454 Author: Jie Yu <[email protected]> Authored: Wed Aug 6 12:44:34 2014 -0700 Committer: Jie Yu <[email protected]> Committed: Wed Aug 6 14:25:13 2014 -0700 ---------------------------------------------------------------------- src/tests/allocator_tests.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/b4bd0869/src/tests/allocator_tests.cpp ---------------------------------------------------------------------- diff --git a/src/tests/allocator_tests.cpp b/src/tests/allocator_tests.cpp index 9ff4dfd..f0226cb 100644 --- a/src/tests/allocator_tests.cpp +++ b/src/tests/allocator_tests.cpp @@ -752,21 +752,13 @@ template <typename T> class AllocatorTest : public MesosTest { protected: - virtual void SetUp() + void StopAllocator() { - MesosTest::SetUp(); - a = new Allocator(&allocator); - } - - - virtual void TearDown() - { - delete a; - MesosTest::TearDown(); + process::terminate(allocator.real); + process::wait(allocator.real); } MockAllocatorProcess<T> allocator; - Allocator* a; }; @@ -1020,7 +1012,11 @@ TYPED_TEST(AllocatorTest, OutOfOrderDispatch) // Re-dispatch the resourcesRecovered call which we "caught" // earlier now that the framework has been removed, to test // that recovering resources from a removed framework works. - this->a->resourcesRecovered(frameworkId, slaveId, savedResources, None()); + this->allocator.resourcesRecovered( + frameworkId, + slaveId, + savedResources, + None()); // TODO(benh): Seems like we should wait for the above // resourcesRecovered to be executed. @@ -1913,6 +1909,7 @@ TYPED_TEST(AllocatorTest, FrameworkReregistersFirst) .WillRepeatedly(DoDefault()); this->ShutdownMasters(); + this->StopAllocator(); MockAllocatorProcess<TypeParam> allocator2; @@ -2037,6 +2034,7 @@ TYPED_TEST(AllocatorTest, SlaveReregistersFirst) .WillRepeatedly(DoDefault()); this->ShutdownMasters(); + this->StopAllocator(); MockAllocatorProcess<TypeParam> allocator2;
