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

Function FetchAndStoreAndStoreFailAndFetch

src/tests/state_tests.cpp:157–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155
156
157void FetchAndStoreAndStoreFailAndFetch(State* state)
158{
159 Future<Variable<Slaves>> future1 = state->fetch<Slaves>("slaves");
160 AWAIT_READY(future1);
161
162 Variable<Slaves> variable1 = future1.get();
163
164 Slaves slaves1 = variable1.get();
165 ASSERT_TRUE(slaves1.slaves().empty());
166
167 Slave* slave1 = slaves1.add_slaves();
168 slave1->mutable_info()->set_hostname("localhost1");
169
170 Variable<Slaves> variable2 = variable1.mutate(slaves1);
171
172 Future<Option<Variable<Slaves>>> future2 = state->store(variable2);
173 AWAIT_READY(future2);
174 ASSERT_SOME(future2.get());
175
176 Slaves slaves2 = variable1.get();
177 ASSERT_TRUE(slaves2.slaves().empty());
178
179 Slave* slave2 = slaves2.add_slaves();
180 slave2->mutable_info()->set_hostname("localhost2");
181
182 variable2 = variable1.mutate(slaves2);
183
184 future2 = state->store(variable2);
185 AWAIT_READY(future2);
186 EXPECT_NONE(future2.get());
187
188 future1 = state->fetch<Slaves>("slaves");
189 AWAIT_READY(future1);
190
191 variable1 = future1.get();
192
193 slaves1 = variable1.get();
194 ASSERT_EQ(1, slaves1.slaves().size());
195 EXPECT_EQ("localhost1", slaves1.slaves(0).info().hostname());
196}
197
198
199void FetchAndStoreAndExpungeAndFetch(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