| 119 | |
| 120 | |
| 121 | void FetchAndStoreAndStoreAndFetch(State* state) |
| 122 | { |
| 123 | Future<Variable<Slaves>> future1 = state->fetch<Slaves>("slaves"); |
| 124 | AWAIT_READY(future1); |
| 125 | |
| 126 | Variable<Slaves> variable = future1.get(); |
| 127 | |
| 128 | Slaves slaves1 = variable.get(); |
| 129 | ASSERT_TRUE(slaves1.slaves().empty()); |
| 130 | |
| 131 | Slave* slave = slaves1.add_slaves(); |
| 132 | slave->mutable_info()->set_hostname("localhost"); |
| 133 | |
| 134 | variable = variable.mutate(slaves1); |
| 135 | |
| 136 | Future<Option<Variable<Slaves>>> future2 = state->store(variable); |
| 137 | AWAIT_READY(future2); |
| 138 | ASSERT_SOME(future2.get()); |
| 139 | |
| 140 | variable = future2->get(); |
| 141 | |
| 142 | future2 = state->store(variable); |
| 143 | AWAIT_READY(future2); |
| 144 | ASSERT_SOME(future2.get()); |
| 145 | |
| 146 | future1 = state->fetch<Slaves>("slaves"); |
| 147 | AWAIT_READY(future1); |
| 148 | |
| 149 | variable = future1.get(); |
| 150 | |
| 151 | Slaves slaves2 = variable.get(); |
| 152 | ASSERT_EQ(1, slaves2.slaves().size()); |
| 153 | EXPECT_EQ("localhost", slaves2.slaves(0).info().hostname()); |
| 154 | } |
| 155 | |
| 156 | |
| 157 | void FetchAndStoreAndStoreFailAndFetch(State* state) |