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

Function FetchAndStoreAndStoreAndFetch

src/tests/state_tests.cpp:121–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119
120
121void 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
157void FetchAndStoreAndStoreFailAndFetch(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