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

Function TEST_F

src/tests/fault_tolerance_tests.cpp:164–427  ·  view source on GitHub ↗

This test ensures that a failed over master recovers completed tasks from a slave's re-registration when the slave thinks the framework has completed (but the framework has not actually completed yet from master's point of view).

Source from the content-addressed store, hash-verified

162// completed (but the framework has not actually completed yet from master's
163// point of view).
164TEST_F(FaultToleranceTest, ReregisterCompletedFrameworks)
165{
166 // Step 1. Start Master and Slave.
167 Try<Owned<cluster::Master>> master = StartMaster();
168 ASSERT_SOME(master);
169
170 MockExecutor executor(DEFAULT_EXECUTOR_ID);
171
172 TestContainerizer containerizer(&executor);
173
174 StandaloneMasterDetector slaveDetector(master.get()->pid);
175
176 Try<Owned<cluster::Slave>> slave = StartSlave(&slaveDetector, &containerizer);
177 ASSERT_SOME(slave);
178
179 // Verify master/slave have 0 completed/running frameworks.
180 Future<Response> masterState = process::http::get(
181 master.get()->pid,
182 "state",
183 None(),
184 createBasicAuthHeaders(DEFAULT_CREDENTIAL));
185
186 AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, masterState);
187 AWAIT_EXPECT_RESPONSE_HEADER_EQ(
188 APPLICATION_JSON,
189 "Content-Type",
190 masterState);
191
192 Try<JSON::Object> parse = JSON::parse<JSON::Object>(masterState->body);
193 ASSERT_SOME(parse);
194 JSON::Object masterJSON = parse.get();
195
196 EXPECT_EQ(
197 0u,
198 masterJSON.values["completed_frameworks"]
199 .as<JSON::Array>().values.size());
200 EXPECT_EQ(
201 0u,
202 masterJSON.values["frameworks"].as<JSON::Array>().values.size());
203
204 // Step 2. Create/start framework.
205 StandaloneMasterDetector schedDetector(master.get()->pid);
206
207 MockScheduler sched;
208 TestingMesosSchedulerDriver driver(&sched, &schedDetector);
209
210 Future<FrameworkID> frameworkId;
211 EXPECT_CALL(sched, registered(&driver, _, _))
212 .WillOnce(FutureArg<1>(&frameworkId));
213
214 Future<vector<Offer>> offers;
215 EXPECT_CALL(sched, resourceOffers(&driver, _))
216 .WillOnce(FutureArg<1>(&offers))
217 .WillRepeatedly(Return()); // Ignore subsequent offers.
218
219 driver.start();
220
221 AWAIT_READY(frameworkId);

Callers

nothing calls this directly

Calls 15

NoneClass · 0.85
createBasicAuthHeadersFunction · 0.85
OKClass · 0.85
FutureSatisfyFunction · 0.85
errorFunction · 0.85
exitedFunction · 0.85
shutdownFunction · 0.85
createStatusUpdateFunction · 0.85
randomFunction · 0.85
createLabelFunction · 0.85
protobufFunction · 0.85
createDetectorMethod · 0.80

Tested by

no test coverage detected