MCPcopy Create free account
hub / github.com/apache/mesos / TEST_P_TEMP_DISABLED_ON_WINDOWS

Function TEST_P_TEMP_DISABLED_ON_WINDOWS

src/tests/scheduler_tests.cpp:312–372  ·  view source on GitHub ↗

This test verifies that the scheduler can subscribe after a master failover.

Source from the content-addressed store, hash-verified

310
311// This test verifies that the scheduler can subscribe after a master failover.
312TEST_P_TEMP_DISABLED_ON_WINDOWS(SchedulerTest, MasterFailover)
313{
314 Try<Owned<cluster::Master>> master = StartMaster();
315 ASSERT_SOME(master);
316
317 auto scheduler = std::make_shared<v1::MockHTTPScheduler>();
318 auto detector = std::make_shared<StandaloneMasterDetector>(master.get()->pid);
319
320 EXPECT_CALL(*scheduler, connected(_))
321 .WillOnce(v1::scheduler::SendSubscribe(v1::DEFAULT_FRAMEWORK_INFO))
322 .WillRepeatedly(Return());
323
324 Future<Event::Subscribed> subscribed;
325 EXPECT_CALL(*scheduler, subscribed(_, _))
326 .WillOnce(FutureArg<1>(&subscribed))
327 .WillRepeatedly(Return());
328
329 EXPECT_CALL(*scheduler, heartbeat(_))
330 .WillRepeatedly(Return()); // Ignore heartbeats.
331
332 ContentType contentType = GetParam();
333
334 v1::scheduler::TestMesos mesos(
335 master.get()->pid, contentType, scheduler, detector);
336
337 AWAIT_READY(subscribed);
338
339 v1::FrameworkID frameworkId = subscribed->framework_id();
340
341 Future<Nothing> disconnected;
342 EXPECT_CALL(*scheduler, disconnected(_))
343 .WillOnce(FutureSatisfy(&disconnected))
344 .WillRepeatedly(Return()); // Ignore future invocations.
345
346 // Failover the master.
347 // Also wipe the leading master from the detector, so the scheduler
348 // does not try to reconnect while the master actor is not routable.
349 master->reset();
350 detector->appoint(None());
351
352 master = StartMaster();
353 ASSERT_SOME(master);
354
355 AWAIT_READY(disconnected);
356
357 EXPECT_CALL(*scheduler, connected(_))
358 .WillOnce(
359 v1::scheduler::SendSubscribe(v1::DEFAULT_FRAMEWORK_INFO, frameworkId));
360
361 Future<Event::Subscribed> subscribed2;
362 EXPECT_CALL(*scheduler, subscribed(_, _))
363 .WillOnce(FutureArg<1>(&subscribed2))
364 .WillRepeatedly(Return());
365
366 // Give the master leadership now that our scheduler expectations are set up.
367 detector->appoint(master.get()->pid);
368
369 AWAIT_READY(subscribed2);

Callers

nothing calls this directly

Calls 5

FutureSatisfyFunction · 0.85
NoneClass · 0.85
getMethod · 0.45
resetMethod · 0.45
appointMethod · 0.45

Tested by

no test coverage detected