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

Function TEST_P

src/tests/scheduler_tests.cpp:121–162  ·  view source on GitHub ↗

This test verifies that a scheduler can subscribe with the master.

Source from the content-addressed store, hash-verified

119
120// This test verifies that a scheduler can subscribe with the master.
121TEST_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

Callers

nothing calls this directly

Calls 15

FutureSatisfyFunction · 0.85
createCallSubscribeFunction · 0.85
errorFunction · 0.85
OKClass · 0.85
NothingClass · 0.85
shutdownFunction · 0.85
failureFunction · 0.85
createCallKillFunction · 0.85
createExecutorInfoFunction · 0.85
NoneClass · 0.85
LAUNCH_GROUPFunction · 0.85
createTaskGroupInfoFunction · 0.85

Tested by

no test coverage detected