| 89 | using mesos::internal::state::Operation; |
| 90 | |
| 91 | void 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 | |
| 121 | void FetchAndStoreAndStoreAndFetch(State* state) |