You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by as...@apache.org on 2020/09/01 13:31:31 UTC
[mesos] 02/02: Made UpdateFramework tests not rely on redundant
FRAMEWORK_UPDATED.
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
commit 40c66fefec028fd0d24fa9398e55a88d48095108
Author: Andrei Sekretenko <as...@mesosphere.com>
AuthorDate: Mon Aug 31 18:34:44 2020 +0200
Made UpdateFramework tests not rely on redundant FRAMEWORK_UPDATED.
This patch adjusts UpdateFramework tests so that they do not rely on
an API subscriber receiving the FRAMEWORK_UPDATED event when the
UPDATE_FRAMEWORK call does not change the `FrameworkInfo`.
This is a prerequisite for removing redundant updates and broadcasts
when UPDATE_FRAMEWORK leaves `FrameworkInfo` the same (which typically
happens when the call is used to change suppressed roles set or/and
offer constraints, neither of which is a part of `FrameworkInfo`).
Review: https://reviews.apache.org/r/72823
---
src/tests/master/update_framework_tests.cpp | 24 ++++++------------------
1 file changed, 6 insertions(+), 18 deletions(-)
diff --git a/src/tests/master/update_framework_tests.cpp b/src/tests/master/update_framework_tests.cpp
index 6346a4e..d2a63b6 100644
--- a/src/tests/master/update_framework_tests.cpp
+++ b/src/tests/master/update_framework_tests.cpp
@@ -1176,11 +1176,6 @@ TEST_F(UpdateFrameworkV0Test, SuppressedRoles)
v1::MockMasterAPISubscriber masterAPISubscriber;
AWAIT_READY(masterAPISubscriber.subscribe(master.get()->pid));
- // Expect FRAMEWORK_UPDATED event after update.
- Future<v1::master::Event::FrameworkUpdated> frameworkUpdated;
- EXPECT_CALL(masterAPISubscriber, frameworkUpdated(_))
- .WillOnce(FutureArg<0>(&frameworkUpdated));
-
Future<Nothing> secondAgentAdded;
EXPECT_CALL(masterAPISubscriber, agentAdded(_))
.WillOnce(Return())
@@ -1221,7 +1216,12 @@ TEST_F(UpdateFrameworkV0Test, SuppressedRoles)
driver.updateFramework(update, suppressedRoles);
- AWAIT_READY(frameworkUpdated);
+ // Ensure that the allocator processes the update, so that this test
+ // does not rely on Master maintaining an ordering between scheduler API calls
+ // processing and agent registration.
+ Clock::pause();
+ Clock::settle();
+ Clock::resume();
Try<Owned<cluster::Slave>> newSlave = StartSlave(detector.get());
ASSERT_SOME(newSlave);
@@ -1252,15 +1252,6 @@ TEST_F(UpdateFrameworkV0Test, UnsuppressClearsFilters)
Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
ASSERT_SOME(master);
- v1::MockMasterAPISubscriber masterAPISubscriber;
- AWAIT_READY(masterAPISubscriber.subscribe(master.get()->pid));
-
- Future<v1::master::Event::FrameworkUpdated> frameworkUpdated1;
- Future<v1::master::Event::FrameworkUpdated> frameworkUpdated2;
- EXPECT_CALL(masterAPISubscriber, frameworkUpdated(_))
- .WillOnce(FutureArg<0>(&frameworkUpdated1))
- .WillOnce(FutureArg<0>(&frameworkUpdated2));
-
Owned<MasterDetector> detector = master->get()->createDetector();
Try<Owned<cluster::Slave>> slave = StartSlave(detector.get());
@@ -1300,10 +1291,7 @@ TEST_F(UpdateFrameworkV0Test, UnsuppressClearsFilters)
update.roles().begin(), update.roles().end());
driver.updateFramework(update, suppressedRoles);
- AWAIT_READY(frameworkUpdated1);
-
driver.updateFramework(update, {});
- AWAIT_READY(frameworkUpdated2);
// Now the previously declined agent should be re-offered.
Clock::pause();