This is an automated email from the ASF dual-hosted git repository. bennoe pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mesos.git
commit 188c83af78d0357523d53f75b6e1b05b59f461c2 Author: Benno Evers <[email protected]> AuthorDate: Tue Aug 13 17:26:02 2019 +0200 Fixed a flaky operation reconciliation test. The FrameworkReconciliationRaceWithUpdateSlave test from the operation reconciliation tests was flaky since we did not wait for the scheduler to reconnect before attempting to send a subscribe call. Review: https://reviews.apache.org/r/71297 --- src/tests/operation_reconciliation_tests.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/tests/operation_reconciliation_tests.cpp b/src/tests/operation_reconciliation_tests.cpp index 9d084c0..12552d3 100644 --- a/src/tests/operation_reconciliation_tests.cpp +++ b/src/tests/operation_reconciliation_tests.cpp @@ -1833,11 +1833,15 @@ TEST_P( EXPECT_EQ(OPERATION_FINISHED, finishedUpdate->status().state()); EXPECT_TRUE(finishedUpdate->status().has_uuid()); + Future<mesos::v1::scheduler::Mesos*> disconnected; EXPECT_CALL(*scheduler, disconnected(_)) - .Times(2); + .Times(1) + .WillOnce(FutureArg<0>(&disconnected)); + Future<mesos::v1::scheduler::Mesos*> connected; EXPECT_CALL(*scheduler, connected(_)) - .Times(2); + .Times(1) + .WillOnce(FutureArg<0>(&connected)); // Drop the `UpdateSlaveMessage` which contains the resubscribed resource // provider in order to simulate a race between this message and the @@ -1845,8 +1849,12 @@ TEST_P( updateSlaveMessage = DROP_PROTOBUF(UpdateSlaveMessage(), _, _); // Restart the master to clear out the master's operation state and force - // an agent reregistration. + // an agent reregistration. Also appoint `None()` to avoid a spurious + // detection of the master since it reuses the same `UPID`. + detector->appoint(None()); master->reset(); + AWAIT_READY(disconnected); + master = StartMaster(); ASSERT_SOME(master); @@ -1866,6 +1874,7 @@ TEST_P( frameworkInfo.mutable_id()->CopyFrom(frameworkId); + AWAIT_READY(connected); mesos.send(createCallSubscribe(frameworkInfo, frameworkId)); AWAIT_READY(resubscribed);
