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

Function FetchAndStoreAndExpungeAndStoreAndFetch

src/tests/state_tests.cpp:265–302  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

263
264
265void FetchAndStoreAndExpungeAndStoreAndFetch(State* state)
266{
267 Future<Variable<Slaves>> future1 = state->fetch<Slaves>("slaves");
268 AWAIT_READY(future1);
269
270 Variable<Slaves> variable = future1.get();
271
272 Slaves slaves1 = variable.get();
273 ASSERT_TRUE(slaves1.slaves().empty());
274
275 Slave* slave = slaves1.add_slaves();
276 slave->mutable_info()->set_hostname("localhost");
277
278 variable = variable.mutate(slaves1);
279
280 Future<Option<Variable<Slaves>>> future2 = state->store(variable);
281 AWAIT_READY(future2);
282 ASSERT_SOME(future2.get());
283
284 variable = future2->get();
285
286 Future<bool> future3 = state->expunge(variable);
287 AWAIT_READY(future3);
288 ASSERT_TRUE(future3.get());
289
290 future2 = state->store(variable);
291 AWAIT_READY(future2);
292 ASSERT_SOME(future2.get());
293
294 future1 = state->fetch<Slaves>("slaves");
295 AWAIT_READY(future1);
296
297 variable = future1.get();
298
299 Slaves slaves2 = variable.get();
300 ASSERT_EQ(1, slaves2.slaves().size());
301 EXPECT_EQ("localhost", slaves2.slaves(0).info().hostname());
302}
303
304
305void Names(State* state)

Callers 1

TEST_FFunction · 0.85

Calls 8

infoMethod · 0.80
storeMethod · 0.65
expungeMethod · 0.65
getMethod · 0.45
emptyMethod · 0.45
slavesMethod · 0.45
mutateMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected