]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- |
2 | // vim: ts=8 sw=2 smarttab | |
3 | ||
4 | #include <errno.h> | |
5 | #include "test/librados/test.h" | |
6 | #include "test/librados/TestCase.h" | |
7 | #include "include/scope_guard.h" | |
8 | ||
9 | using namespace librados; | |
10 | ||
11 | std::string RadosTestNS::pool_name; | |
12 | rados_t RadosTestNS::s_cluster = NULL; | |
13 | ||
14 | namespace { | |
15 | ||
16 | void init_rand() { | |
17 | static bool seeded = false; | |
18 | if (!seeded) { | |
19 | seeded = true; | |
20 | int seed = getpid(); | |
21 | std::cout << "seed " << seed << std::endl; | |
22 | srand(seed); | |
23 | } | |
24 | } | |
25 | ||
26 | } // anonymous namespace | |
27 | ||
28 | void RadosTestNS::SetUpTestCase() | |
29 | { | |
30 | pool_name = get_temp_pool_name(); | |
31 | ASSERT_EQ("", create_one_pool(pool_name, &s_cluster)); | |
32 | } | |
33 | ||
34 | void RadosTestNS::TearDownTestCase() | |
35 | { | |
36 | ASSERT_EQ(0, destroy_one_pool(pool_name, &s_cluster)); | |
37 | } | |
38 | ||
39 | void RadosTestNS::SetUp() | |
40 | { | |
41 | cluster = RadosTestNS::s_cluster; | |
42 | ASSERT_EQ(0, rados_ioctx_create(cluster, pool_name.c_str(), &ioctx)); | |
43 | int requires; | |
44 | ASSERT_EQ(0, rados_ioctx_pool_requires_alignment2(ioctx, &requires)); | |
45 | ASSERT_FALSE(requires); | |
46 | } | |
47 | ||
48 | void RadosTestNS::TearDown() | |
49 | { | |
50 | if (cleanup) | |
51 | cleanup_all_objects(ioctx); | |
52 | rados_ioctx_destroy(ioctx); | |
53 | } | |
54 | ||
55 | void RadosTestNS::cleanup_all_objects(rados_ioctx_t ioctx) | |
56 | { | |
57 | // remove all objects to avoid polluting other tests | |
58 | rados_ioctx_snap_set_read(ioctx, LIBRADOS_SNAP_HEAD); | |
59 | rados_ioctx_set_namespace(ioctx, LIBRADOS_ALL_NSPACES); | |
60 | rados_list_ctx_t list_ctx; | |
61 | ||
62 | ASSERT_EQ(0, rados_nobjects_list_open(ioctx, &list_ctx)); | |
63 | auto sg = make_scope_guard([&] { rados_nobjects_list_close(list_ctx); }); | |
64 | ||
65 | int r; | |
66 | const char *entry = NULL; | |
67 | const char *key = NULL; | |
68 | const char *nspace = NULL; | |
69 | while ((r = rados_nobjects_list_next(list_ctx, &entry, &key, &nspace)) != -ENOENT) { | |
70 | ASSERT_EQ(0, r); | |
71 | rados_ioctx_locator_set_key(ioctx, key); | |
72 | rados_ioctx_set_namespace(ioctx, nspace); | |
73 | ASSERT_EQ(0, rados_remove(ioctx, entry)); | |
74 | } | |
75 | } | |
76 | ||
77 | std::string RadosTestPPNS::pool_name; | |
78 | Rados RadosTestPPNS::s_cluster; | |
79 | ||
80 | void RadosTestPPNS::SetUpTestCase() | |
81 | { | |
82 | pool_name = get_temp_pool_name(); | |
83 | ASSERT_EQ("", create_one_pool_pp(pool_name, s_cluster)); | |
84 | } | |
85 | ||
86 | void RadosTestPPNS::TearDownTestCase() | |
87 | { | |
88 | ASSERT_EQ(0, destroy_one_pool_pp(pool_name, s_cluster)); | |
89 | } | |
90 | ||
91 | void RadosTestPPNS::SetUp() | |
92 | { | |
93 | ASSERT_EQ(0, cluster.ioctx_create(pool_name.c_str(), ioctx)); | |
94 | bool requires; | |
95 | ASSERT_EQ(0, ioctx.pool_requires_alignment2(&requires)); | |
96 | ASSERT_FALSE(requires); | |
97 | } | |
98 | ||
99 | void RadosTestPPNS::TearDown() | |
100 | { | |
101 | if (cleanup) | |
102 | cleanup_all_objects(ioctx); | |
103 | ioctx.close(); | |
104 | } | |
105 | ||
106 | void RadosTestPPNS::cleanup_all_objects(librados::IoCtx ioctx) | |
107 | { | |
108 | // remove all objects to avoid polluting other tests | |
109 | ioctx.snap_set_read(librados::SNAP_HEAD); | |
110 | ioctx.set_namespace(all_nspaces); | |
111 | for (NObjectIterator it = ioctx.nobjects_begin(); | |
112 | it != ioctx.nobjects_end(); ++it) { | |
113 | ioctx.locator_set_key(it->get_locator()); | |
114 | ioctx.set_namespace(it->get_nspace()); | |
115 | ASSERT_EQ(0, ioctx.remove(it->get_oid())); | |
116 | } | |
117 | } | |
118 | ||
119 | std::string RadosTestParamPPNS::pool_name; | |
120 | std::string RadosTestParamPPNS::cache_pool_name; | |
121 | Rados RadosTestParamPPNS::s_cluster; | |
122 | ||
123 | void RadosTestParamPPNS::SetUpTestCase() | |
124 | { | |
125 | pool_name = get_temp_pool_name(); | |
126 | ASSERT_EQ("", create_one_pool_pp(pool_name, s_cluster)); | |
127 | } | |
128 | ||
129 | void RadosTestParamPPNS::TearDownTestCase() | |
130 | { | |
131 | if (cache_pool_name.length()) { | |
132 | // tear down tiers | |
133 | bufferlist inbl; | |
134 | ASSERT_EQ(0, s_cluster.mon_command( | |
135 | "{\"prefix\": \"osd tier remove-overlay\", \"pool\": \"" + pool_name + | |
136 | "\"}", | |
137 | inbl, NULL, NULL)); | |
138 | ASSERT_EQ(0, s_cluster.mon_command( | |
139 | "{\"prefix\": \"osd tier remove\", \"pool\": \"" + pool_name + | |
140 | "\", \"tierpool\": \"" + cache_pool_name + "\"}", | |
141 | inbl, NULL, NULL)); | |
142 | ASSERT_EQ(0, s_cluster.mon_command( | |
143 | "{\"prefix\": \"osd pool delete\", \"pool\": \"" + cache_pool_name + | |
144 | "\", \"pool2\": \"" + cache_pool_name + "\", \"sure\": \"--yes-i-really-really-mean-it\"}", | |
145 | inbl, NULL, NULL)); | |
146 | cache_pool_name = ""; | |
147 | } | |
148 | ASSERT_EQ(0, destroy_one_pool_pp(pool_name, s_cluster)); | |
149 | } | |
150 | ||
151 | void RadosTestParamPPNS::SetUp() | |
152 | { | |
153 | if (strcmp(GetParam(), "cache") == 0 && cache_pool_name.empty()) { | |
154 | cache_pool_name = get_temp_pool_name(); | |
155 | bufferlist inbl; | |
156 | ASSERT_EQ(0, cluster.mon_command( | |
157 | "{\"prefix\": \"osd pool create\", \"pool\": \"" + cache_pool_name + | |
158 | "\", \"pg_num\": 4}", | |
159 | inbl, NULL, NULL)); | |
160 | ASSERT_EQ(0, cluster.mon_command( | |
161 | "{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name + | |
162 | "\", \"tierpool\": \"" + cache_pool_name + | |
163 | "\", \"force_nonempty\": \"--force-nonempty\" }", | |
164 | inbl, NULL, NULL)); | |
165 | ASSERT_EQ(0, cluster.mon_command( | |
166 | "{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name + | |
167 | "\", \"overlaypool\": \"" + cache_pool_name + "\"}", | |
168 | inbl, NULL, NULL)); | |
169 | ASSERT_EQ(0, cluster.mon_command( | |
170 | "{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name + | |
171 | "\", \"mode\": \"writeback\"}", | |
172 | inbl, NULL, NULL)); | |
173 | cluster.wait_for_latest_osdmap(); | |
174 | } | |
175 | ||
176 | ASSERT_EQ(0, cluster.ioctx_create(pool_name.c_str(), ioctx)); | |
177 | bool requires; | |
178 | ASSERT_EQ(0, ioctx.pool_requires_alignment2(&requires)); | |
179 | ASSERT_FALSE(requires); | |
180 | } | |
181 | ||
182 | void RadosTestParamPPNS::TearDown() | |
183 | { | |
184 | if (cleanup) | |
185 | cleanup_all_objects(ioctx); | |
186 | ioctx.close(); | |
187 | } | |
188 | ||
189 | void RadosTestParamPPNS::cleanup_all_objects(librados::IoCtx ioctx) | |
190 | { | |
191 | // remove all objects to avoid polluting other tests | |
192 | ioctx.snap_set_read(librados::SNAP_HEAD); | |
193 | ioctx.set_namespace(all_nspaces); | |
194 | for (NObjectIterator it = ioctx.nobjects_begin(); | |
195 | it != ioctx.nobjects_end(); ++it) { | |
196 | ioctx.locator_set_key(it->get_locator()); | |
197 | ioctx.set_namespace(it->get_nspace()); | |
198 | ASSERT_EQ(0, ioctx.remove(it->get_oid())); | |
199 | } | |
200 | } | |
201 | ||
202 | std::string RadosTestECNS::pool_name; | |
203 | rados_t RadosTestECNS::s_cluster = NULL; | |
204 | ||
205 | void RadosTestECNS::SetUpTestCase() | |
206 | { | |
207 | pool_name = get_temp_pool_name(); | |
208 | ASSERT_EQ("", create_one_ec_pool(pool_name, &s_cluster)); | |
209 | } | |
210 | ||
211 | void RadosTestECNS::TearDownTestCase() | |
212 | { | |
213 | ASSERT_EQ(0, destroy_one_ec_pool(pool_name, &s_cluster)); | |
214 | } | |
215 | ||
216 | void RadosTestECNS::SetUp() | |
217 | { | |
218 | cluster = RadosTestECNS::s_cluster; | |
219 | ASSERT_EQ(0, rados_ioctx_create(cluster, pool_name.c_str(), &ioctx)); | |
220 | int requires; | |
221 | ASSERT_EQ(0, rados_ioctx_pool_requires_alignment2(ioctx, &requires)); | |
222 | ASSERT_TRUE(requires); | |
223 | ASSERT_EQ(0, rados_ioctx_pool_required_alignment2(ioctx, &alignment)); | |
224 | ASSERT_NE(0U, alignment); | |
225 | } | |
226 | ||
227 | void RadosTestECNS::TearDown() | |
228 | { | |
229 | if (cleanup) | |
230 | cleanup_all_objects(ioctx); | |
231 | rados_ioctx_destroy(ioctx); | |
232 | } | |
233 | ||
234 | std::string RadosTestECPPNS::pool_name; | |
235 | Rados RadosTestECPPNS::s_cluster; | |
236 | ||
237 | void RadosTestECPPNS::SetUpTestCase() | |
238 | { | |
239 | pool_name = get_temp_pool_name(); | |
240 | ASSERT_EQ("", create_one_ec_pool_pp(pool_name, s_cluster)); | |
241 | } | |
242 | ||
243 | void RadosTestECPPNS::TearDownTestCase() | |
244 | { | |
245 | ASSERT_EQ(0, destroy_one_ec_pool_pp(pool_name, s_cluster)); | |
246 | } | |
247 | ||
248 | void RadosTestECPPNS::SetUp() | |
249 | { | |
250 | ASSERT_EQ(0, cluster.ioctx_create(pool_name.c_str(), ioctx)); | |
251 | bool requires; | |
252 | ASSERT_EQ(0, ioctx.pool_requires_alignment2(&requires)); | |
253 | ASSERT_TRUE(requires); | |
254 | ASSERT_EQ(0, ioctx.pool_required_alignment2(&alignment)); | |
255 | ASSERT_NE(0U, alignment); | |
256 | } | |
257 | ||
258 | void RadosTestECPPNS::TearDown() | |
259 | { | |
260 | if (cleanup) | |
261 | cleanup_all_objects(ioctx); | |
262 | ioctx.close(); | |
263 | } | |
264 | ||
265 | std::string RadosTest::pool_name; | |
266 | rados_t RadosTest::s_cluster = NULL; | |
267 | ||
268 | void RadosTest::SetUpTestCase() | |
269 | { | |
270 | pool_name = get_temp_pool_name(); | |
271 | ASSERT_EQ("", create_one_pool(pool_name, &s_cluster)); | |
272 | } | |
273 | ||
274 | void RadosTest::TearDownTestCase() | |
275 | { | |
276 | ASSERT_EQ(0, destroy_one_pool(pool_name, &s_cluster)); | |
277 | } | |
278 | ||
279 | void RadosTest::SetUp() | |
280 | { | |
281 | cluster = RadosTest::s_cluster; | |
282 | ASSERT_EQ(0, rados_ioctx_create(cluster, pool_name.c_str(), &ioctx)); | |
283 | nspace = get_temp_pool_name(); | |
284 | rados_ioctx_set_namespace(ioctx, nspace.c_str()); | |
285 | int requires; | |
286 | ASSERT_EQ(0, rados_ioctx_pool_requires_alignment2(ioctx, &requires)); | |
287 | ASSERT_FALSE(requires); | |
288 | } | |
289 | ||
290 | void RadosTest::TearDown() | |
291 | { | |
292 | if (cleanup) { | |
293 | cleanup_default_namespace(ioctx); | |
294 | cleanup_namespace(ioctx, nspace); | |
295 | } | |
296 | rados_ioctx_destroy(ioctx); | |
297 | } | |
298 | ||
299 | void RadosTest::cleanup_default_namespace(rados_ioctx_t ioctx) | |
300 | { | |
301 | // remove all objects from the default namespace to avoid polluting | |
302 | // other tests | |
303 | cleanup_namespace(ioctx, ""); | |
304 | } | |
305 | ||
306 | void RadosTest::cleanup_namespace(rados_ioctx_t ioctx, std::string ns) | |
307 | { | |
308 | rados_ioctx_snap_set_read(ioctx, LIBRADOS_SNAP_HEAD); | |
309 | rados_ioctx_set_namespace(ioctx, ns.c_str()); | |
310 | rados_list_ctx_t list_ctx; | |
311 | ||
312 | ASSERT_EQ(0, rados_nobjects_list_open(ioctx, &list_ctx)); | |
313 | auto sg = make_scope_guard([&] { rados_nobjects_list_close(list_ctx); }); | |
314 | ||
315 | int r; | |
316 | const char *entry = NULL; | |
317 | const char *key = NULL; | |
318 | while ((r = rados_nobjects_list_next(list_ctx, &entry, &key, NULL)) != -ENOENT) { | |
319 | ASSERT_EQ(0, r); | |
320 | rados_ioctx_locator_set_key(ioctx, key); | |
321 | ASSERT_EQ(0, rados_remove(ioctx, entry)); | |
322 | } | |
323 | } | |
324 | ||
325 | std::string RadosTestPP::pool_name; | |
326 | Rados RadosTestPP::s_cluster; | |
327 | ||
328 | void RadosTestPP::SetUpTestCase() | |
329 | { | |
330 | init_rand(); | |
331 | ||
332 | pool_name = get_temp_pool_name(); | |
333 | ASSERT_EQ("", create_one_pool_pp(pool_name, s_cluster)); | |
334 | } | |
335 | ||
336 | void RadosTestPP::TearDownTestCase() | |
337 | { | |
338 | ASSERT_EQ(0, destroy_one_pool_pp(pool_name, s_cluster)); | |
339 | } | |
340 | ||
341 | void RadosTestPP::SetUp() | |
342 | { | |
343 | ASSERT_EQ(0, cluster.ioctx_create(pool_name.c_str(), ioctx)); | |
344 | nspace = get_temp_pool_name(); | |
345 | ioctx.set_namespace(nspace); | |
346 | bool requires; | |
347 | ASSERT_EQ(0, ioctx.pool_requires_alignment2(&requires)); | |
348 | ASSERT_FALSE(requires); | |
349 | } | |
350 | ||
351 | void RadosTestPP::TearDown() | |
352 | { | |
353 | if (cleanup) { | |
354 | cleanup_default_namespace(ioctx); | |
355 | cleanup_namespace(ioctx, nspace); | |
356 | } | |
357 | ioctx.close(); | |
358 | } | |
359 | ||
360 | void RadosTestPP::cleanup_default_namespace(librados::IoCtx ioctx) | |
361 | { | |
362 | // remove all objects from the default namespace to avoid polluting | |
363 | // other tests | |
364 | cleanup_namespace(ioctx, ""); | |
365 | } | |
366 | ||
367 | void RadosTestPP::cleanup_namespace(librados::IoCtx ioctx, std::string ns) | |
368 | { | |
369 | ioctx.snap_set_read(librados::SNAP_HEAD); | |
370 | ioctx.set_namespace(ns); | |
371 | for (NObjectIterator it = ioctx.nobjects_begin(); | |
372 | it != ioctx.nobjects_end(); ++it) { | |
373 | ioctx.locator_set_key(it->get_locator()); | |
374 | ObjectWriteOperation op; | |
375 | op.remove(); | |
376 | ||
377 | librados::AioCompletion *completion = s_cluster.aio_create_completion(); | |
378 | auto sg = make_scope_guard([&] { completion->release(); }); | |
379 | ||
380 | ASSERT_EQ(0, ioctx.aio_operate(it->get_oid(), completion, &op, | |
381 | librados::OPERATION_IGNORE_CACHE)); | |
382 | completion->wait_for_safe(); | |
383 | ASSERT_EQ(0, completion->get_return_value()); | |
384 | } | |
385 | } | |
386 | ||
387 | std::string RadosTestParamPP::pool_name; | |
388 | std::string RadosTestParamPP::cache_pool_name; | |
389 | Rados RadosTestParamPP::s_cluster; | |
390 | ||
391 | void RadosTestParamPP::SetUpTestCase() | |
392 | { | |
393 | pool_name = get_temp_pool_name(); | |
394 | ASSERT_EQ("", create_one_pool_pp(pool_name, s_cluster)); | |
395 | } | |
396 | ||
397 | void RadosTestParamPP::TearDownTestCase() | |
398 | { | |
399 | if (cache_pool_name.length()) { | |
400 | // tear down tiers | |
401 | bufferlist inbl; | |
402 | ASSERT_EQ(0, s_cluster.mon_command( | |
403 | "{\"prefix\": \"osd tier remove-overlay\", \"pool\": \"" + pool_name + | |
404 | "\"}", | |
405 | inbl, NULL, NULL)); | |
406 | ASSERT_EQ(0, s_cluster.mon_command( | |
407 | "{\"prefix\": \"osd tier remove\", \"pool\": \"" + pool_name + | |
408 | "\", \"tierpool\": \"" + cache_pool_name + "\"}", | |
409 | inbl, NULL, NULL)); | |
410 | ASSERT_EQ(0, s_cluster.mon_command( | |
411 | "{\"prefix\": \"osd pool delete\", \"pool\": \"" + cache_pool_name + | |
412 | "\", \"pool2\": \"" + cache_pool_name + "\", \"sure\": \"--yes-i-really-really-mean-it\"}", | |
413 | inbl, NULL, NULL)); | |
414 | cache_pool_name = ""; | |
415 | } | |
416 | ASSERT_EQ(0, destroy_one_pool_pp(pool_name, s_cluster)); | |
417 | } | |
418 | ||
419 | void RadosTestParamPP::SetUp() | |
420 | { | |
421 | if (strcmp(GetParam(), "cache") == 0 && cache_pool_name.empty()) { | |
422 | cache_pool_name = get_temp_pool_name(); | |
423 | bufferlist inbl; | |
424 | ASSERT_EQ(0, cluster.mon_command( | |
425 | "{\"prefix\": \"osd pool create\", \"pool\": \"" + cache_pool_name + | |
426 | "\", \"pg_num\": 4}", | |
427 | inbl, NULL, NULL)); | |
428 | ASSERT_EQ(0, cluster.mon_command( | |
429 | "{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name + | |
430 | "\", \"tierpool\": \"" + cache_pool_name + | |
431 | "\", \"force_nonempty\": \"--force-nonempty\" }", | |
432 | inbl, NULL, NULL)); | |
433 | ASSERT_EQ(0, cluster.mon_command( | |
434 | "{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name + | |
435 | "\", \"overlaypool\": \"" + cache_pool_name + "\"}", | |
436 | inbl, NULL, NULL)); | |
437 | ASSERT_EQ(0, cluster.mon_command( | |
438 | "{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name + | |
439 | "\", \"mode\": \"writeback\"}", | |
440 | inbl, NULL, NULL)); | |
441 | cluster.wait_for_latest_osdmap(); | |
442 | } | |
443 | ||
444 | ASSERT_EQ(0, cluster.ioctx_create(pool_name.c_str(), ioctx)); | |
445 | nspace = get_temp_pool_name(); | |
446 | ioctx.set_namespace(nspace); | |
447 | bool requires; | |
448 | ASSERT_EQ(0, ioctx.pool_requires_alignment2(&requires)); | |
449 | ASSERT_FALSE(requires); | |
450 | } | |
451 | ||
452 | void RadosTestParamPP::TearDown() | |
453 | { | |
454 | if (cleanup) { | |
455 | cleanup_default_namespace(ioctx); | |
456 | cleanup_namespace(ioctx, nspace); | |
457 | } | |
458 | ioctx.close(); | |
459 | } | |
460 | ||
461 | void RadosTestParamPP::cleanup_default_namespace(librados::IoCtx ioctx) | |
462 | { | |
463 | // remove all objects from the default namespace to avoid polluting | |
464 | // other tests | |
465 | cleanup_namespace(ioctx, ""); | |
466 | } | |
467 | ||
468 | void RadosTestParamPP::cleanup_namespace(librados::IoCtx ioctx, std::string ns) | |
469 | { | |
470 | ioctx.snap_set_read(librados::SNAP_HEAD); | |
471 | ioctx.set_namespace(ns); | |
472 | for (NObjectIterator it = ioctx.nobjects_begin(); | |
473 | it != ioctx.nobjects_end(); ++it) { | |
474 | ioctx.locator_set_key(it->get_locator()); | |
475 | ASSERT_EQ(0, ioctx.remove(it->get_oid())); | |
476 | } | |
477 | } | |
478 | ||
479 | std::string RadosTestEC::pool_name; | |
480 | rados_t RadosTestEC::s_cluster = NULL; | |
481 | ||
482 | void RadosTestEC::SetUpTestCase() | |
483 | { | |
484 | pool_name = get_temp_pool_name(); | |
485 | ASSERT_EQ("", create_one_ec_pool(pool_name, &s_cluster)); | |
486 | } | |
487 | ||
488 | void RadosTestEC::TearDownTestCase() | |
489 | { | |
490 | ASSERT_EQ(0, destroy_one_ec_pool(pool_name, &s_cluster)); | |
491 | } | |
492 | ||
493 | void RadosTestEC::SetUp() | |
494 | { | |
495 | cluster = RadosTestEC::s_cluster; | |
496 | ASSERT_EQ(0, rados_ioctx_create(cluster, pool_name.c_str(), &ioctx)); | |
497 | nspace = get_temp_pool_name(); | |
498 | rados_ioctx_set_namespace(ioctx, nspace.c_str()); | |
499 | int requires; | |
500 | ASSERT_EQ(0, rados_ioctx_pool_requires_alignment2(ioctx, &requires)); | |
501 | ASSERT_TRUE(requires); | |
502 | ASSERT_EQ(0, rados_ioctx_pool_required_alignment2(ioctx, &alignment)); | |
503 | ASSERT_NE(0U, alignment); | |
504 | } | |
505 | ||
506 | void RadosTestEC::TearDown() | |
507 | { | |
508 | if (cleanup) { | |
509 | cleanup_default_namespace(ioctx); | |
510 | cleanup_namespace(ioctx, nspace); | |
511 | } | |
512 | rados_ioctx_destroy(ioctx); | |
513 | } | |
514 | ||
515 | std::string RadosTestECPP::pool_name; | |
516 | Rados RadosTestECPP::s_cluster; | |
517 | ||
518 | void RadosTestECPP::SetUpTestCase() | |
519 | { | |
520 | pool_name = get_temp_pool_name(); | |
521 | ASSERT_EQ("", create_one_ec_pool_pp(pool_name, s_cluster)); | |
522 | } | |
523 | ||
524 | void RadosTestECPP::TearDownTestCase() | |
525 | { | |
526 | ASSERT_EQ(0, destroy_one_ec_pool_pp(pool_name, s_cluster)); | |
527 | } | |
528 | ||
529 | void RadosTestECPP::SetUp() | |
530 | { | |
531 | ASSERT_EQ(0, cluster.ioctx_create(pool_name.c_str(), ioctx)); | |
532 | nspace = get_temp_pool_name(); | |
533 | ioctx.set_namespace(nspace); | |
534 | bool requires; | |
535 | ASSERT_EQ(0, ioctx.pool_requires_alignment2(&requires)); | |
536 | ASSERT_TRUE(requires); | |
537 | ASSERT_EQ(0, ioctx.pool_required_alignment2(&alignment)); | |
538 | ASSERT_NE(0U, alignment); | |
539 | } | |
540 | ||
541 | void RadosTestECPP::TearDown() | |
542 | { | |
543 | if (cleanup) { | |
544 | cleanup_default_namespace(ioctx); | |
545 | cleanup_namespace(ioctx, nspace); | |
546 | } | |
547 | ioctx.close(); | |
548 | } | |
549 |