| 263 | |
| 264 | |
| 265 | void 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 | |
| 305 | void Names(State* state) |