You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by al...@apache.org on 2017/10/17 00:44:28 UTC

[09/14] mesos git commit: Avoided periodic allocations in EventAuthorizationFiltering test.

Avoided periodic allocations in EventAuthorizationFiltering test.

Prior to this patch, the second, still unexpected allocation, can fire
before an appropriate expectation is set. We trigger the second
allocation via `REVIVE` call.

Review: https://reviews.apache.org/r/63013


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/3cd907af
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/3cd907af
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/3cd907af

Branch: refs/heads/master
Commit: 3cd907afcc637748f31f0ed783e4a9e6cf2a8d9e
Parents: 4a39d12
Author: Alexander Rukletsov <al...@apache.org>
Authored: Sat Oct 14 17:14:05 2017 -0700
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Mon Oct 16 17:42:43 2017 -0700

----------------------------------------------------------------------
 src/tests/api_tests.cpp | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/3cd907af/src/tests/api_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/api_tests.cpp b/src/tests/api_tests.cpp
index 6fa49d7..0e99e7b 100644
--- a/src/tests/api_tests.cpp
+++ b/src/tests/api_tests.cpp
@@ -2212,12 +2212,9 @@ TEST_P(MasterAPITest, EventAuthorizationFiltering)
     acl->mutable_users()->set_type(mesos::ACL::Entity::NONE);
   }
 
-  master::Flags masterFlags = CreateMasterFlags();
-  masterFlags.allocation_interval = Milliseconds(50);
   Result<Authorizer*> authorizer = Authorizer::create(acls);
 
-  Try<Owned<cluster::Master>> master =
-    StartMaster(authorizer.get(), masterFlags);
+  Try<Owned<cluster::Master>> master = StartMaster(authorizer.get());
 
   ASSERT_SOME(master);
 
@@ -2389,11 +2386,6 @@ TEST_P(MasterAPITest, EventAuthorizationFiltering)
     v1::scheduler::Call::Accept* accept = call.mutable_accept();
     accept->add_offer_ids()->CopyFrom(offer1.id());
 
-    // Set 0s filter to immediately get another offer.
-    v1::Filters filters;
-    filters.set_refuse_seconds(0);
-    accept->mutable_filters()->CopyFrom(filters);
-
     v1::Offer::Operation* operation = accept->add_operations();
     operation->set_type(v1::Offer::Operation::LAUNCH);
 
@@ -2435,14 +2427,19 @@ TEST_P(MasterAPITest, EventAuthorizationFiltering)
   ASSERT_EQ(task1.task_id(),
             event->get().task_updated().status().task_id());
 
+  // Summon an offer.
   Future<v1::scheduler::Event::Offers> offers2;
   EXPECT_CALL(*scheduler, offers(_, _))
     .WillOnce(FutureArg<1>(&offers2))
     .WillRepeatedly(Return()); // Ignore further offers.
 
-  Clock::pause();
-  Clock::advance(masterFlags.allocation_interval);
-  Clock::resume();
+  {
+    v1::scheduler::Call call;
+    call.mutable_framework_id()->CopyFrom(frameworkId);
+    call.set_type(v1::scheduler::Call::REVIVE);
+
+    mesos.send(call);
+  }
 
   AWAIT_READY(offers2);
   ASSERT_FALSE(offers2->offers().empty());