This test verifies that a scheduler can subscribe with the master.
| 119 | |
| 120 | // This test verifies that a scheduler can subscribe with the master. |
| 121 | TEST_P(SchedulerTest, Subscribe) |
| 122 | { |
| 123 | Try<Owned<cluster::Master>> master = StartMaster(); |
| 124 | ASSERT_SOME(master); |
| 125 | |
| 126 | auto scheduler = std::make_shared<v1::MockHTTPScheduler>(); |
| 127 | |
| 128 | Future<Nothing> connected; |
| 129 | EXPECT_CALL(*scheduler, connected(_)) |
| 130 | .WillOnce(FutureSatisfy(&connected)); |
| 131 | |
| 132 | ContentType contentType = GetParam(); |
| 133 | |
| 134 | v1::scheduler::TestMesos mesos( |
| 135 | master.get()->pid, |
| 136 | contentType, |
| 137 | scheduler); |
| 138 | |
| 139 | AWAIT_READY(connected); |
| 140 | |
| 141 | Future<Event::Subscribed> subscribed; |
| 142 | EXPECT_CALL(*scheduler, subscribed(_, _)) |
| 143 | .WillOnce(FutureArg<1>(&subscribed)); |
| 144 | |
| 145 | EXPECT_CALL(*scheduler, heartbeat(_)) |
| 146 | .WillRepeatedly(Return()); // Ignore heartbeats. |
| 147 | |
| 148 | { |
| 149 | Call call; |
| 150 | call.set_type(Call::SUBSCRIBE); |
| 151 | Call::Subscribe* subscribe = call.mutable_subscribe(); |
| 152 | subscribe->mutable_framework_info()->CopyFrom(v1::DEFAULT_FRAMEWORK_INFO); |
| 153 | |
| 154 | mesos.send(call); |
| 155 | } |
| 156 | |
| 157 | AWAIT_READY(subscribed); |
| 158 | |
| 159 | ASSERT_EQ(master::DEFAULT_HEARTBEAT_INTERVAL.secs(), |
| 160 | subscribed->heartbeat_interval_seconds()); |
| 161 | ASSERT_EQ(evolve(master.get()->getMasterInfo()), subscribed->master_info()); |
| 162 | } |
| 163 | |
| 164 | |
| 165 | // Test validates that the scheduler library will not allow multiple |
nothing calls this directly
no test coverage detected