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

Function FetchAndStoreAndFetch

src/tests/state_tests.cpp:91–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89using mesos::internal::state::Operation;
90
91void FetchAndStoreAndFetch(State* state)
92{
93 Future<Variable<Slaves>> future1 = state->fetch<Slaves>("slaves");
94 AWAIT_READY(future1);
95
96 Variable<Slaves> variable = future1.get();
97
98 Slaves slaves1 = variable.get();
99 ASSERT_TRUE(slaves1.slaves().empty());
100
101 Slave* slave = slaves1.add_slaves();
102 slave->mutable_info()->set_hostname("localhost");
103
104 variable = variable.mutate(slaves1);
105
106 Future<Option<Variable<Slaves>>> future2 = state->store(variable);
107 AWAIT_READY(future2);
108 ASSERT_SOME(future2.get());
109
110 future1 = state->fetch<Slaves>("slaves");
111 AWAIT_READY(future1);
112
113 variable = future1.get();
114
115 Slaves slaves2 = variable.get();
116 ASSERT_EQ(1, slaves2.slaves().size());
117 EXPECT_EQ("localhost", slaves2.slaves(0).info().hostname());
118}
119
120
121void FetchAndStoreAndStoreAndFetch(State* state)

Callers 1

TEST_FFunction · 0.85

Calls 7

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

Tested by

no test coverage detected