This is an automated email from the ASF dual-hosted git repository.
asekretenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
The following commit(s) were added to refs/heads/master by this push:
new ebf4cc1 Ensured that MasterAPITest.ReservationUpdate waits for
changes on agent.
ebf4cc1 is described below
commit ebf4cc17d5d191699c9b4b8cf4b7066ca3575723
Author: Andrei Sekretenko <[email protected]>
AuthorDate: Fri Mar 6 19:33:12 2020 +0100
Ensured that MasterAPITest.ReservationUpdate waits for changes on agent.
This patch fixes flakiness in this test by making sure that,
before checking agent state via agent API, not only RESERVE_RESOURCES
call of master V1 API returns, but also the agent completes processing
messages from master.
Review: https://reviews.apache.org/r/72208
---
src/tests/api_tests.cpp | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/tests/api_tests.cpp b/src/tests/api_tests.cpp
index d1368a7..f222b43 100644
--- a/src/tests/api_tests.cpp
+++ b/src/tests/api_tests.cpp
@@ -1495,6 +1495,10 @@ TEST_P(MasterAPITest, ReservationUpdate)
// Helper function to attempt a reservation update from a given `source`
// to a given reservation using an operator API call.
+ //
+ // Note that RESERVE_RESOURCES call does not wait for the agent to apply
+ // the operation, hence this function might return before the agent changes
+ // its state!
auto attemptReservation = [&master, &slaveId, &contentType](
const Resources& source,
const Resources& resources,
@@ -1566,6 +1570,11 @@ TEST_P(MasterAPITest, ReservationUpdate)
dynamicallyReservedToFoo,
accepted);
+ // Wait for the agent to apply operation.
+ Clock::pause();
+ Clock::settle();
+ Clock::resume();
+
verifyReservation("role/foo");
// Should fail again, since there are still no resources that are
@@ -1581,6 +1590,11 @@ TEST_P(MasterAPITest, ReservationUpdate)
dynamicallyReservedToBar,
accepted);
+ // Wait for the agent to apply operation.
+ Clock::pause();
+ Clock::settle();
+ Clock::resume();
+
verifyReservation("role/bar");
}