This test checks that a scheduler gets a slave lost message for a partitioned slave.
| 88 | // This test checks that a scheduler gets a slave lost |
| 89 | // message for a partitioned slave. |
| 90 | TEST_F(PartitionTest, PartitionedSlave) |
| 91 | { |
| 92 | master::Flags masterFlags = CreateMasterFlags(); |
| 93 | Try<Owned<cluster::Master>> master = StartMaster(masterFlags); |
| 94 | ASSERT_SOME(master); |
| 95 | |
| 96 | // Set these expectations up before we spawn the slave so that we |
| 97 | // don't miss the first PING. |
| 98 | Future<Message> ping = FUTURE_MESSAGE( |
| 99 | Eq(PingSlaveMessage().GetTypeName()), _, _); |
| 100 | |
| 101 | // Drop all the PONGs to simulate slave partition. |
| 102 | DROP_PROTOBUFS(PongSlaveMessage(), _, _); |
| 103 | |
| 104 | Owned<MasterDetector> detector = master.get()->createDetector(); |
| 105 | Try<Owned<cluster::Slave>> slave = StartSlave(detector.get()); |
| 106 | ASSERT_SOME(slave); |
| 107 | |
| 108 | MockScheduler sched; |
| 109 | MesosSchedulerDriver driver( |
| 110 | &sched, DEFAULT_FRAMEWORK_INFO, master.get()->pid, DEFAULT_CREDENTIAL); |
| 111 | |
| 112 | EXPECT_CALL(sched, registered(&driver, _, _)); |
| 113 | |
| 114 | Future<Nothing> resourceOffers; |
| 115 | EXPECT_CALL(sched, resourceOffers(&driver, _)) |
| 116 | .WillOnce(FutureSatisfy(&resourceOffers)) |
| 117 | .WillRepeatedly(Return()); // Ignore subsequent offers. |
| 118 | |
| 119 | driver.start(); |
| 120 | |
| 121 | // Need to make sure the framework AND slave have registered with |
| 122 | // master. Waiting for resource offers should accomplish both. |
| 123 | AWAIT_READY(resourceOffers); |
| 124 | |
| 125 | Clock::pause(); |
| 126 | |
| 127 | EXPECT_CALL(sched, offerRescinded(&driver, _)) |
| 128 | .Times(AtMost(1)); |
| 129 | |
| 130 | Future<Nothing> slaveLost; |
| 131 | EXPECT_CALL(sched, slaveLost(&driver, _)) |
| 132 | .WillOnce(FutureSatisfy(&slaveLost)); |
| 133 | |
| 134 | // Now advance through the PINGs. |
| 135 | size_t pings = 0; |
| 136 | while (true) { |
| 137 | AWAIT_READY(ping); |
| 138 | pings++; |
| 139 | if (pings == masterFlags.max_agent_ping_timeouts) { |
| 140 | break; |
| 141 | } |
| 142 | ping = FUTURE_MESSAGE(Eq(PingSlaveMessage().GetTypeName()), _, _); |
| 143 | Clock::advance(masterFlags.agent_ping_timeout); |
| 144 | } |
| 145 | |
| 146 | Clock::advance(masterFlags.agent_ping_timeout); |
| 147 |
nothing calls this directly
no test coverage detected