@@ -132,7 +132,8 @@ CASE("Remote protocol: the basics") {
132132 keys = write_data (fdb, data_string, {" 20000101" , " 20000102" }, {" fc" , " pf" }, {" 1" , " 2" });
133133 }
134134 EXPECT_EQUAL (keys.size (), Nfields);
135-
135+ std::this_thread::sleep_for (std::chrono::seconds (2 )); // Ensure server has time to flush consolidated indexes.
136+
136137 // -- list all fields -
137138 size_t count = 0 ;
138139 {
@@ -144,11 +145,11 @@ CASE("Remote protocol: the basics") {
144145 }
145146 EXPECT_EQUAL (count, Nfields);
146147 }
147-
148+
148149 // -- list all fields - use a temporary FDB instance to test if the RemoteFDb life is extended
149150 {
150151
151- count = 0 ;
152+ count = 0 ;
152153 auto it = FDB{}.list (FDBToolRequest{make_request (keys)}, true );
153154 ListElement elem;
154155 while (it.next (elem)) {
@@ -161,7 +162,7 @@ CASE("Remote protocol: the basics") {
161162 // -- retrieve all fields -
162163 {
163164 std::unique_ptr<eckit::DataHandle> dh (FDB{}.retrieve (make_request (keys)));
164-
165+
165166 eckit::AutoClose closer (*dh);
166167 dh->openForRead ();
167168 for (int i = 0 ; i < Nfields; ++i) {
@@ -171,7 +172,7 @@ CASE("Remote protocol: the basics") {
171172 EXPECT_EQUAL (retrieved_string, data_string);
172173 }
173174 }
174-
175+
175176 // -- wipe (doit=false) --
176177 {
177178 auto wipeit = FDB{}.wipe (FDBToolRequest::requestsFromString (" date=20000101" )[0 ]);
@@ -190,7 +191,7 @@ CASE("Remote protocol: the basics") {
190191
191192 // -- list all fields again, expect same number as before
192193 {
193- count = 0 ;
194+ count = 0 ;
194195 auto it = FDB{}.list (FDBToolRequest{{}, true , {}}, true );
195196 ListElement elem;
196197 while (it.next (elem)) {
@@ -199,12 +200,12 @@ CASE("Remote protocol: the basics") {
199200 }
200201 EXPECT_EQUAL (count, Nfields);
201202 }
202-
203+
203204 // -- list fields, expect same number. --
204205 {
205206
206207 auto it = FDB{}.list (FDBToolRequest{make_request (keys)}, true );
207- ListElement elem;
208+ ListElement elem;
208209 count = 0 ;
209210 while (it.next (elem)) {
210211 eckit::Log::info () << " [CLIENT]" << elem << " " << elem.location () << std::endl;
@@ -223,7 +224,7 @@ CASE("Remote protocol: the basics") {
223224 eckit::Log::info () << " [CLIENT]" << wipeElem;
224225 element_counts[wipeElem.type ()] += wipeElem.uris ().size ();
225226 }
226-
227+
227228 // Expect: 2 store .data, 2 catalogue .index, 3 catalogue files (schema, toc, subtoc)
228229 EXPECT_EQUAL (element_counts[WipeElementType::STORE], 2 );
229230 EXPECT_EQUAL (element_counts[WipeElementType::CATALOGUE_INDEX], 4 );
@@ -233,7 +234,7 @@ CASE("Remote protocol: the basics") {
233234
234235 // -- list all remaining fields
235236 {
236- count = 0 ;
237+ count = 0 ;
237238 auto it = FDB{}.list (FDBToolRequest{{}, true , {}}, true );
238239 ListElement elem;
239240 while (it.next (elem)) {
@@ -247,7 +248,7 @@ CASE("Remote protocol: the basics") {
247248 {
248249 auto wipeit = FDB{}.wipe (FDBToolRequest::requestsFromString (" class=od" )[0 ], true );
249250 WipeElement wipeElem;
250- count = 0 ;
251+ count = 0 ;
251252 while (wipeit.next (wipeElem)) {
252253 eckit::Log::info () << " [CLIENT]" << wipeElem;
253254 count++;
@@ -276,7 +277,6 @@ CASE("Remote protocol: more wipe testing") {
276277 }
277278
278279
279-
280280 // -- write a few fields. 2 databases. Each with 1 index and 1 data file
281281 const size_t Nfields = 8 ;
282282 const std::string data_string = " It's gonna be a bright, sunshiny day!" ;
@@ -286,6 +286,8 @@ CASE("Remote protocol: more wipe testing") {
286286 keys = write_data (fdb, data_string, {" 20000101" , " 20000102" }, {" fc" , " pf" }, {" 1" , " 2" });
287287 }
288288 EXPECT_EQUAL (keys.size (), Nfields);
289+ std::this_thread::sleep_for (std::chrono::seconds (2 )); // Ensure server has time to flush consolidated indexes.
290+
289291 // wipe a single date
290292 {
291293 auto wipeit = FDB{}.wipe (FDBToolRequest::requestsFromString (" class=od,expver=xxxx,date=20000101" )[0 ]);
@@ -307,6 +309,7 @@ CASE("Remote protocol: more wipe testing") {
307309 FDB fdb{};
308310 write_data (fdb, data_string, {" 20000101" , " 20000102" }, {" fc" , " pf" }, {" 1" , " 2" });
309311 }
312+ std::this_thread::sleep_for (std::chrono::seconds (2 )); // Ensure server has time to flush consolidated indexes.
310313
311314 // Wipe just one DB (date=20000101)
312315 std::vector<eckit::URI> data_uris;
0 commit comments