diff --git a/qa/suites/rados/verify/tasks/rados_api_tests.yaml b/qa/suites/rados/verify/tasks/rados_api_tests.yaml index 3c0d229e004..e5a54e69e01 100644 --- a/qa/suites/rados/verify/tasks/rados_api_tests.yaml +++ b/qa/suites/rados/verify/tasks/rados_api_tests.yaml @@ -23,6 +23,7 @@ overrides: osd: osd class load list: "*" osd class default list: "*" + osd client watch timeout: 120 tasks: - workunit: timeout: 6h diff --git a/src/test/librados/TestCase.cc b/src/test/librados/TestCase.cc index 8e380a251fa..d16fb8599d5 100644 --- a/src/test/librados/TestCase.cc +++ b/src/test/librados/TestCase.cc @@ -2,6 +2,7 @@ // vim: ts=8 sw=2 smarttab #include +#include #include "test/librados/test.h" #include "test/librados/TestCase.h" #include "include/scope_guard.h" @@ -13,7 +14,8 @@ rados_t RadosTestNS::s_cluster = NULL; void RadosTestNS::SetUpTestCase() { - pool_name = get_temp_pool_name(); + auto pool_prefix = fmt::format("{}_", ::testing::UnitTest::GetInstance()->current_test_case()->name()); + pool_name = get_temp_pool_name(pool_prefix); ASSERT_EQ("", create_one_pool(pool_name, &s_cluster)); } @@ -65,7 +67,8 @@ rados_t RadosTestECNS::s_cluster = NULL; void RadosTestECNS::SetUpTestCase() { - pool_name = get_temp_pool_name(); + auto pool_prefix = fmt::format("{}_", ::testing::UnitTest::GetInstance()->current_test_case()->name()); + pool_name = get_temp_pool_name(pool_prefix); ASSERT_EQ("", create_one_ec_pool(pool_name, &s_cluster)); } @@ -99,7 +102,8 @@ rados_t RadosTest::s_cluster = NULL; void RadosTest::SetUpTestCase() { - pool_name = get_temp_pool_name(); + auto pool_prefix = fmt::format("{}_", ::testing::UnitTest::GetInstance()->current_test_case()->name()); + pool_name = get_temp_pool_name(pool_prefix); ASSERT_EQ("", create_one_pool(pool_name, &s_cluster)); } @@ -159,7 +163,8 @@ rados_t RadosTestEC::s_cluster = NULL; void RadosTestEC::SetUpTestCase() { - pool_name = get_temp_pool_name(); + auto pool_prefix = fmt::format("{}_", ::testing::UnitTest::GetInstance()->current_test_case()->name()); + pool_name = get_temp_pool_name(pool_prefix); ASSERT_EQ("", create_one_ec_pool(pool_name, &s_cluster)); } diff --git a/src/test/librados/aio.cc b/src/test/librados/aio.cc index 4227b042ee1..5a50bf9a2ce 100644 --- a/src/test/librados/aio.cc +++ b/src/test/librados/aio.cc @@ -4,6 +4,7 @@ #include #include #include +#include #include "include/err.h" #include "include/rados/librados.h" @@ -41,7 +42,8 @@ public: std::string init() { int ret; - m_pool_name = get_temp_pool_name(); + auto pool_prefix = fmt::format("{}_", ::testing::UnitTest::GetInstance()->current_test_info()->name()); + m_pool_name = get_temp_pool_name(pool_prefix); std::string err = create_one_pool(m_pool_name, &m_cluster); if (!err.empty()) { ostringstream oss; @@ -1007,7 +1009,8 @@ public: std::string init() { int ret; - m_pool_name = get_temp_pool_name(); + auto pool_prefix = fmt::format("{}_", ::testing::UnitTest::GetInstance()->current_test_info()->name()); + m_pool_name = get_temp_pool_name(pool_prefix); std::string err = create_one_ec_pool(m_pool_name, &m_cluster); if (!err.empty()) { ostringstream oss; diff --git a/src/test/librados/aio_cxx.cc b/src/test/librados/aio_cxx.cc index 6f6e79b203f..27ff76b1e5b 100644 --- a/src/test/librados/aio_cxx.cc +++ b/src/test/librados/aio_cxx.cc @@ -4,6 +4,7 @@ #include #include #include +#include #include "gtest/gtest.h" @@ -26,7 +27,8 @@ class AioTestDataPP { public: AioTestDataPP() - : m_init(false) + : m_init(false), + m_oid("foo") { } @@ -46,8 +48,8 @@ public: std::string init(const std::map &config) { int ret; - - m_pool_name = get_temp_pool_name(); + auto pool_prefix = fmt::format("{}_", ::testing::UnitTest::GetInstance()->current_test_info()->name()); + m_pool_name = get_temp_pool_name(pool_prefix); std::string err = create_one_pool_pp(m_pool_name, m_cluster, config); if (!err.empty()) { ostringstream oss; @@ -61,6 +63,7 @@ public: oss << "rados_ioctx_create failed: error " << ret; return oss.str(); } + m_oid = fmt::format("oid_{}_", ::testing::UnitTest::GetInstance()->current_test_info()->name()); m_init = true; return ""; } @@ -69,6 +72,7 @@ public: IoCtx m_ioctx; std::string m_pool_name; bool m_init; + std::string m_oid; }; TEST(LibRadosAio, TooBigPP) { @@ -77,15 +81,16 @@ TEST(LibRadosAio, TooBigPP) { bufferlist bl; auto aio_completion = std::unique_ptr{Rados::aio_create_completion()}; - ASSERT_EQ(-E2BIG, test_data.m_ioctx.aio_write("foo", aio_completion.get(), bl, UINT_MAX, 0)); - ASSERT_EQ(-E2BIG, test_data.m_ioctx.aio_append("foo", aio_completion.get(), bl, UINT_MAX)); + ASSERT_EQ(-E2BIG, test_data.m_ioctx.aio_write(test_data.m_oid, aio_completion.get(), bl, UINT_MAX, 0)); + ASSERT_EQ(-E2BIG, test_data.m_ioctx.aio_append(test_data.m_oid, aio_completion.get(), bl, UINT_MAX)); // ioctx.aio_write_full no way to overflow bl.length() } TEST(LibRadosAio, PoolQuotaPP) { AioTestDataPP test_data; ASSERT_EQ("", test_data.init()); - string p = get_temp_pool_name(); + auto pool_prefix = fmt::format("{}_", ::testing::UnitTest::GetInstance()->current_test_info()->name()); + string p = get_temp_pool_name(pool_prefix); ASSERT_EQ(0, test_data.m_cluster.pool_create(p.c_str())); IoCtx ioctx; ASSERT_EQ(0, test_data.m_cluster.ioctx_create(p.c_str(), ioctx)); @@ -105,7 +110,7 @@ TEST(LibRadosAio, PoolQuotaPP) { ObjectWriteOperation op; op.write_full(bl); auto completion = std::unique_ptr{Rados::aio_create_completion()}; - ASSERT_EQ(0, ioctx.aio_operate("foo" + stringify(n), + ASSERT_EQ(0, ioctx.aio_operate(test_data.m_oid + stringify(n), completion.get(), &op, librados::OPERATION_FULL_TRY)); completion->wait_for_complete(); @@ -144,7 +149,7 @@ TEST(LibRadosAio, SimpleWritePP) { ASSERT_EQ("", test_data.init()); auto my_completion = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(buf), 0)); { TestAlarm alarm; @@ -158,7 +163,7 @@ TEST(LibRadosAio, SimpleWritePP) { ASSERT_EQ("", test_data.init()); test_data.m_ioctx.set_namespace("nspace"); auto my_completion = std::unique_ptr{Rados::aio_create_completion()}; - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(buf), 0)); { TestAlarm alarm; @@ -177,7 +182,7 @@ TEST(LibRadosAio, WaitForSafePP) { memset(buf, 0xcc, sizeof(buf)); bufferlist bl1; bl1.append(buf, sizeof(buf)); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(buf), 0)); TestAlarm alarm; ASSERT_EQ(0, my_completion->wait_for_complete()); @@ -193,7 +198,7 @@ TEST(LibRadosAio, RoundTripPP) { memset(buf, 0xcc, sizeof(buf)); bufferlist bl1; bl1.append(buf, sizeof(buf)); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(buf), 0)); { TestAlarm alarm; @@ -203,7 +208,7 @@ TEST(LibRadosAio, RoundTripPP) { bufferlist bl2; auto my_completion2 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion2); - ASSERT_EQ(0, test_data.m_ioctx.aio_read("foo", my_completion2.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_read(test_data.m_oid, my_completion2.get(), &bl2, sizeof(buf), 0)); { TestAlarm alarm; @@ -223,7 +228,7 @@ TEST(LibRadosAio, RoundTripPP2) { memset(buf, 0xcc, sizeof(buf)); bufferlist bl1; bl1.append(buf, sizeof(buf)); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(buf), 0)); { TestAlarm alarm; @@ -233,7 +238,7 @@ TEST(LibRadosAio, RoundTripPP2) { bufferlist bl2; auto my_completion2 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion2); - ASSERT_EQ(0, test_data.m_ioctx.aio_read("foo", my_completion2.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_read(test_data.m_oid, my_completion2.get(), &bl2, sizeof(buf), 0)); { TestAlarm alarm; @@ -248,7 +253,8 @@ TEST(LibRadosAio, RoundTripPP2) { TEST(LibRadosAio, RoundTripPP3) { Rados cluster; - std::string pool_name = get_temp_pool_name(); + auto pool_prefix = fmt::format("{}_", ::testing::UnitTest::GetInstance()->current_test_info()->name()); + std::string pool_name = get_temp_pool_name(pool_prefix); ASSERT_EQ("", create_one_pool_pp(pool_name, cluster)); IoCtx ioctx; cluster.ioctx_create(pool_name.c_str(), ioctx); @@ -308,7 +314,7 @@ TEST(LibRadosAio, RoundTripSparseReadPP) { memset(buf, 0xcc, sizeof(buf)); bufferlist bl1; bl1.append(buf, sizeof(buf)); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(buf), 0)); { TestAlarm alarm; @@ -319,7 +325,7 @@ TEST(LibRadosAio, RoundTripSparseReadPP) { bufferlist bl2; auto my_completion2 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion2); - ASSERT_EQ(0, test_data.m_ioctx.aio_sparse_read("foo", my_completion2.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_sparse_read(test_data.m_oid, my_completion2.get(), &extents, &bl2, sizeof(buf), 0)); { TestAlarm alarm; @@ -342,7 +348,7 @@ TEST(LibRadosAioPP, ReadIntoBufferlist) { memset(buf, 0xcc, sizeof(buf)); bufferlist bl1; bl1.append(buf, sizeof(buf)); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(buf), 0)); { TestAlarm alarm; @@ -356,7 +362,7 @@ TEST(LibRadosAioPP, ReadIntoBufferlist) { bl2.append(buffer::create_static(sizeof(buf2), buf2)); auto my_completion2 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion2); - ASSERT_EQ(0, test_data.m_ioctx.aio_read("foo", my_completion2.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_read(test_data.m_oid, my_completion2.get(), &bl2, sizeof(buf), 0)); { TestAlarm alarm; @@ -375,11 +381,11 @@ TEST(LibRadosAioPP, XattrsRoundTripPP) { bl1.append(buf, sizeof(buf)); AioTestDataPP test_data; ASSERT_EQ("", test_data.init()); - ASSERT_EQ(0, test_data.m_ioctx.append("foo", bl1, sizeof(buf))); + ASSERT_EQ(0, test_data.m_ioctx.append(test_data.m_oid, bl1, sizeof(buf))); bufferlist bl2; // async getxattr auto my_completion = std::unique_ptr{Rados::aio_create_completion()}; - ASSERT_EQ(0, test_data.m_ioctx.aio_getxattr("foo", my_completion.get(), attr1, bl2)); + ASSERT_EQ(0, test_data.m_ioctx.aio_getxattr(test_data.m_oid, my_completion.get(), attr1, bl2)); { TestAlarm alarm; ASSERT_EQ(0, my_completion->wait_for_complete()); @@ -392,7 +398,7 @@ TEST(LibRadosAioPP, XattrsRoundTripPP) { AioTestDataPP test_data2; ASSERT_EQ("", test_data2.init()); auto my_completion2 = std::unique_ptr{Rados::aio_create_completion()}; - ASSERT_EQ(0, test_data.m_ioctx.aio_setxattr("foo", my_completion2.get(), attr1, bl3)); + ASSERT_EQ(0, test_data.m_ioctx.aio_setxattr(test_data.m_oid, my_completion2.get(), attr1, bl3)); { TestAlarm alarm; ASSERT_EQ(0, my_completion2->wait_for_complete()); @@ -403,7 +409,7 @@ TEST(LibRadosAioPP, XattrsRoundTripPP) { AioTestDataPP test_data3; ASSERT_EQ("", test_data3.init()); auto my_completion3 = std::unique_ptr{Rados::aio_create_completion()}; - ASSERT_EQ(0, test_data.m_ioctx.aio_getxattr("foo", my_completion3.get(), attr1, bl4)); + ASSERT_EQ(0, test_data.m_ioctx.aio_getxattr(test_data.m_oid, my_completion3.get(), attr1, bl4)); { TestAlarm alarm; ASSERT_EQ(0, my_completion3->wait_for_complete()); @@ -422,12 +428,12 @@ TEST(LibRadosAioPP, RmXattrPP) { bl1.append(buf, sizeof(buf)); AioTestDataPP test_data; ASSERT_EQ("", test_data.init()); - ASSERT_EQ(0, test_data.m_ioctx.append("foo", bl1, sizeof(buf))); + ASSERT_EQ(0, test_data.m_ioctx.append(test_data.m_oid, bl1, sizeof(buf))); // async setxattr bufferlist bl2; bl2.append(attr1_buf, sizeof(attr1_buf)); auto my_completion = std::unique_ptr{Rados::aio_create_completion()}; - ASSERT_EQ(0, test_data.m_ioctx.aio_setxattr("foo", my_completion.get(), attr1, bl2)); + ASSERT_EQ(0, test_data.m_ioctx.aio_setxattr(test_data.m_oid, my_completion.get(), attr1, bl2)); { TestAlarm alarm; ASSERT_EQ(0, my_completion->wait_for_complete()); @@ -437,7 +443,7 @@ TEST(LibRadosAioPP, RmXattrPP) { AioTestDataPP test_data2; ASSERT_EQ("", test_data2.init()); auto my_completion2 = std::unique_ptr{Rados::aio_create_completion()}; - ASSERT_EQ(0, test_data.m_ioctx.aio_rmxattr("foo", my_completion2.get(), attr1)); + ASSERT_EQ(0, test_data.m_ioctx.aio_rmxattr(test_data.m_oid, my_completion2.get(), attr1)); { TestAlarm alarm; ASSERT_EQ(0, my_completion2->wait_for_complete()); @@ -448,7 +454,7 @@ TEST(LibRadosAioPP, RmXattrPP) { ASSERT_EQ("", test_data3.init()); auto my_completion3 = std::unique_ptr{Rados::aio_create_completion()}; bufferlist bl3; - ASSERT_EQ(0, test_data.m_ioctx.aio_getxattr("foo", my_completion3.get(), attr1, bl3)); + ASSERT_EQ(0, test_data.m_ioctx.aio_getxattr(test_data.m_oid, my_completion3.get(), attr1, bl3)); { TestAlarm alarm; ASSERT_EQ(0, my_completion3->wait_for_complete()); @@ -503,17 +509,17 @@ TEST(LibRadosIoPP, XattrListPP) { memset(buf, 0xaa, sizeof(buf)); bufferlist bl1; bl1.append(buf, sizeof(buf)); - ASSERT_EQ(0, test_data.m_ioctx.append("foo", bl1, sizeof(buf))); + ASSERT_EQ(0, test_data.m_ioctx.append(test_data.m_oid, bl1, sizeof(buf))); bufferlist bl2; bl2.append(attr1_buf, sizeof(attr1_buf)); - ASSERT_EQ(0, test_data.m_ioctx.setxattr("foo", attr1, bl2)); + ASSERT_EQ(0, test_data.m_ioctx.setxattr(test_data.m_oid, attr1, bl2)); bufferlist bl3; bl3.append(attr2_buf, sizeof(attr2_buf)); - ASSERT_EQ(0, test_data.m_ioctx.setxattr("foo", attr2, bl3)); + ASSERT_EQ(0, test_data.m_ioctx.setxattr(test_data.m_oid, attr2, bl3)); // call async version of getxattrs auto my_completion = std::unique_ptr{Rados::aio_create_completion()}; std::map attrset; - ASSERT_EQ(0, test_data.m_ioctx.aio_getxattrs("foo", my_completion.get(), attrset)); + ASSERT_EQ(0, test_data.m_ioctx.aio_getxattrs(test_data.m_oid, my_completion.get(), attrset)); { TestAlarm alarm; ASSERT_EQ(0, my_completion->wait_for_complete()); @@ -542,7 +548,7 @@ TEST(LibRadosAio, IsCompletePP) { memset(buf, 0xcc, sizeof(buf)); bufferlist bl1; bl1.append(buf, sizeof(buf)); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(buf), 0)); { TestAlarm alarm; @@ -552,7 +558,7 @@ TEST(LibRadosAio, IsCompletePP) { bufferlist bl2; auto my_completion2 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion2); - ASSERT_EQ(0, test_data.m_ioctx.aio_read("foo", my_completion2.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_read(test_data.m_oid, my_completion2.get(), &bl2, sizeof(buf), 0)); { TestAlarm alarm; @@ -579,7 +585,7 @@ TEST(LibRadosAio, IsSafePP) { memset(buf, 0xcc, sizeof(buf)); bufferlist bl1; bl1.append(buf, sizeof(buf)); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(buf), 0)); { TestAlarm alarm; @@ -596,7 +602,7 @@ TEST(LibRadosAio, IsSafePP) { auto my_completion2 = std::unique_ptr{Rados::aio_create_completion()}; bufferlist bl2; ASSERT_TRUE(my_completion2); - ASSERT_EQ(0, test_data.m_ioctx.aio_read("foo", my_completion2.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_read(test_data.m_oid, my_completion2.get(), &bl2, sizeof(buf), 0)); { TestAlarm alarm; @@ -631,14 +637,14 @@ TEST(LibRadosAio, FlushPP) { memset(buf, 0xee, sizeof(buf)); bufferlist bl1; bl1.append(buf, sizeof(buf)); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(buf), 0)); ASSERT_EQ(0, test_data.m_ioctx.aio_flush()); ASSERT_EQ(0, my_completion->get_return_value()); bufferlist bl2; auto my_completion2 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion2); - ASSERT_EQ(0, test_data.m_ioctx.aio_read("foo", my_completion2.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_read(test_data.m_oid, my_completion2.get(), &bl2, sizeof(buf), 0)); { TestAlarm alarm; @@ -659,7 +665,7 @@ TEST(LibRadosAio, FlushAsyncPP) { memset(buf, 0xee, sizeof(buf)); bufferlist bl1; bl1.append(buf, sizeof(buf)); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(buf), 0)); ASSERT_EQ(0, test_data.m_ioctx.aio_flush_async(flush_completion.get())); { @@ -672,7 +678,7 @@ TEST(LibRadosAio, FlushAsyncPP) { bufferlist bl2; auto my_completion2 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion2); - ASSERT_EQ(0, test_data.m_ioctx.aio_read("foo", my_completion2.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_read(test_data.m_oid, my_completion2.get(), &bl2, sizeof(buf), 0)); { TestAlarm alarm; @@ -692,7 +698,7 @@ TEST(LibRadosAio, RoundTripWriteFullPP) { memset(buf, 0xcc, sizeof(buf)); bufferlist bl1; bl1.append(buf, sizeof(buf)); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(buf), 0)); { TestAlarm alarm; @@ -705,7 +711,7 @@ TEST(LibRadosAio, RoundTripWriteFullPP) { bl2.append(buf2, sizeof(buf2)); auto my_completion2 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion2); - ASSERT_EQ(0, test_data.m_ioctx.aio_write_full("foo", my_completion2.get(), bl2)); + ASSERT_EQ(0, test_data.m_ioctx.aio_write_full(test_data.m_oid, my_completion2.get(), bl2)); { TestAlarm alarm; ASSERT_EQ(0, my_completion2->wait_for_complete()); @@ -714,7 +720,7 @@ TEST(LibRadosAio, RoundTripWriteFullPP) { bufferlist bl3; auto my_completion3 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion3); - ASSERT_EQ(0, test_data.m_ioctx.aio_read("foo", my_completion3.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_read(test_data.m_oid, my_completion3.get(), &bl3, sizeof(buf), 0)); { TestAlarm alarm; @@ -729,7 +735,8 @@ TEST(LibRadosAio, RoundTripWriteFullPP) { TEST(LibRadosAio, RoundTripWriteFullPP2) { Rados cluster; - std::string pool_name = get_temp_pool_name(); + auto pool_prefix = fmt::format("{}_", ::testing::UnitTest::GetInstance()->current_test_info()->name()); + std::string pool_name = get_temp_pool_name(pool_prefix); ASSERT_EQ("", create_one_pool_pp(pool_name, cluster)); IoCtx ioctx; cluster.ioctx_create(pool_name.c_str(), ioctx); @@ -776,7 +783,7 @@ TEST(LibRadosAio, RoundTripWriteSamePP) { memset(full, 0xcc, sizeof(full)); bufferlist bl1; bl1.append(full, sizeof(full)); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(full), 0)); { TestAlarm alarm; @@ -791,7 +798,7 @@ TEST(LibRadosAio, RoundTripWriteSamePP) { bl2.append(buf, sizeof(buf)); auto my_completion2 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion2); - ASSERT_EQ(0, test_data.m_ioctx.aio_writesame("foo", my_completion2.get(), bl2, + ASSERT_EQ(0, test_data.m_ioctx.aio_writesame(test_data.m_oid, my_completion2.get(), bl2, ws_write_len, 0)); { TestAlarm alarm; @@ -801,7 +808,7 @@ TEST(LibRadosAio, RoundTripWriteSamePP) { bufferlist bl3; auto my_completion3 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion3); - ASSERT_EQ(0, test_data.m_ioctx.aio_read("foo", my_completion3.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_read(test_data.m_oid, my_completion3.get(), &bl3, sizeof(full), 0)); { TestAlarm alarm; @@ -818,7 +825,8 @@ TEST(LibRadosAio, RoundTripWriteSamePP) { TEST(LibRadosAio, RoundTripWriteSamePP2) { Rados cluster; - std::string pool_name = get_temp_pool_name(); + auto pool_prefix = fmt::format("{}_", ::testing::UnitTest::GetInstance()->current_test_info()->name()); + std::string pool_name = get_temp_pool_name(pool_prefix); ASSERT_EQ("", create_one_pool_pp(pool_name, cluster)); IoCtx ioctx; cluster.ioctx_create(pool_name.c_str(), ioctx); @@ -872,7 +880,7 @@ TEST(LibRadosAio, SimpleStatPPNS) { memset(buf, 0xcc, sizeof(buf)); bufferlist bl1; bl1.append(buf, sizeof(buf)); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(buf), 0)); { TestAlarm alarm; @@ -883,7 +891,7 @@ TEST(LibRadosAio, SimpleStatPPNS) { time_t pmtime; auto my_completion2 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion2); - ASSERT_EQ(0, test_data.m_ioctx.aio_stat("foo", my_completion2.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_stat(test_data.m_oid, my_completion2.get(), &psize, &pmtime)); { TestAlarm alarm; @@ -902,7 +910,7 @@ TEST(LibRadosAio, SimpleStatPP) { memset(buf, 0xcc, sizeof(buf)); bufferlist bl1; bl1.append(buf, sizeof(buf)); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(buf), 0)); { TestAlarm alarm; @@ -913,7 +921,7 @@ TEST(LibRadosAio, SimpleStatPP) { time_t pmtime; auto my_completion2 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion2); - ASSERT_EQ(0, test_data.m_ioctx.aio_stat("foo", my_completion2.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_stat(test_data.m_oid, my_completion2.get(), &psize, &pmtime)); { TestAlarm alarm; @@ -932,7 +940,7 @@ TEST(LibRadosAio, StatRemovePP) { memset(buf, 0xcc, sizeof(buf)); bufferlist bl1; bl1.append(buf, sizeof(buf)); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(buf), 0)); { TestAlarm alarm; @@ -943,7 +951,7 @@ TEST(LibRadosAio, StatRemovePP) { time_t pmtime; auto my_completion2 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion2); - ASSERT_EQ(0, test_data.m_ioctx.aio_stat("foo", my_completion2.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_stat(test_data.m_oid, my_completion2.get(), &psize, &pmtime)); { TestAlarm alarm; @@ -955,7 +963,7 @@ TEST(LibRadosAio, StatRemovePP) { time_t pmtime2; auto my_completion3 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion3); - ASSERT_EQ(0, test_data.m_ioctx.aio_remove("foo", my_completion3.get())); + ASSERT_EQ(0, test_data.m_ioctx.aio_remove(test_data.m_oid, my_completion3.get())); { TestAlarm alarm; ASSERT_EQ(0, my_completion3->wait_for_complete()); @@ -964,7 +972,7 @@ TEST(LibRadosAio, StatRemovePP) { auto my_completion4 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion4); - ASSERT_EQ(0, test_data.m_ioctx.aio_stat("foo", my_completion4.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_stat(test_data.m_oid, my_completion4.get(), &psize2, &pmtime2)); { TestAlarm alarm; @@ -982,7 +990,7 @@ TEST(LibRadosAio, ExecuteClassPP) { memset(buf, 0xcc, sizeof(buf)); bufferlist bl1; bl1.append(buf, sizeof(buf)); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(buf), 0)); { TestAlarm alarm; @@ -992,7 +1000,7 @@ TEST(LibRadosAio, ExecuteClassPP) { auto my_completion2 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion2); bufferlist in, out; - ASSERT_EQ(0, test_data.m_ioctx.aio_exec("foo", my_completion2.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_exec(test_data.m_oid, my_completion2.get(), "hello", "say_hello", in, &out)); { TestAlarm alarm; @@ -1008,7 +1016,8 @@ using std::set; TEST(LibRadosAio, OmapPP) { Rados cluster; - std::string pool_name = get_temp_pool_name(); + auto pool_prefix = fmt::format("{}_", ::testing::UnitTest::GetInstance()->current_test_info()->name()); + std::string pool_name = get_temp_pool_name(pool_prefix); ASSERT_EQ("", create_one_pool_pp(pool_name, cluster)); IoCtx ioctx; cluster.ioctx_create(pool_name.c_str(), ioctx); @@ -1216,7 +1225,7 @@ TEST(LibRadosAio, MultiWritePP) { memset(buf, 0xcc, sizeof(buf)); bufferlist bl1; bl1.append(buf, sizeof(buf)); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(buf), 0)); { TestAlarm alarm; @@ -1230,7 +1239,7 @@ TEST(LibRadosAio, MultiWritePP) { bl2.append(buf2, sizeof(buf2)); auto my_completion2 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion2); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion2.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion2.get(), bl2, sizeof(buf2), sizeof(buf))); { TestAlarm alarm; @@ -1241,7 +1250,7 @@ TEST(LibRadosAio, MultiWritePP) { bufferlist bl3; auto my_completion3 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion3); - ASSERT_EQ(0, test_data.m_ioctx.aio_read("foo", my_completion3.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_read(test_data.m_oid, my_completion3.get(), &bl3, (sizeof(buf) + sizeof(buf2) * 3), 0)); { TestAlarm alarm; @@ -1256,23 +1265,24 @@ TEST(LibRadosAio, MultiWritePP) { TEST(LibRadosAio, AioUnlockPP) { AioTestDataPP test_data; ASSERT_EQ("", test_data.init()); - ASSERT_EQ(0, test_data.m_ioctx.lock_exclusive("foo", "TestLock", "Cookie", "", NULL, 0)); + ASSERT_EQ(0, test_data.m_ioctx.lock_exclusive(test_data.m_oid, "TestLock", "Cookie", "", NULL, 0)); auto my_completion = std::unique_ptr{Rados::aio_create_completion()}; - ASSERT_EQ(0, test_data.m_ioctx.aio_unlock("foo", "TestLock", "Cookie", my_completion.get())); + ASSERT_EQ(0, test_data.m_ioctx.aio_unlock(test_data.m_oid, "TestLock", "Cookie", my_completion.get())); { TestAlarm alarm; ASSERT_EQ(0, my_completion->wait_for_complete()); } ASSERT_EQ(0, my_completion->get_return_value()); bufferlist bl2; - ASSERT_EQ(0, test_data.m_ioctx.lock_exclusive("foo", "TestLock", "Cookie", "", NULL, 0)); + ASSERT_EQ(0, test_data.m_ioctx.lock_exclusive(test_data.m_oid, "TestLock", "Cookie", "", NULL, 0)); } class AioTestDataECPP { public: AioTestDataECPP() - : m_init(false) + : m_init(false), + m_oid("foo") {} ~AioTestDataECPP() @@ -1286,7 +1296,8 @@ public: std::string init() { int ret; - m_pool_name = get_temp_pool_name(); + auto pool_prefix = fmt::format("{}_", ::testing::UnitTest::GetInstance()->current_test_info()->name()); + m_pool_name = get_temp_pool_name(pool_prefix); std::string err = create_one_ec_pool_pp(m_pool_name, m_cluster); if (!err.empty()) { ostringstream oss; @@ -1300,6 +1311,7 @@ public: oss << "rados_ioctx_create failed: error " << ret; return oss.str(); } + m_oid = fmt::format("oid_{}_", ::testing::UnitTest::GetInstance()->current_test_info()->name()); m_init = true; return ""; } @@ -1308,6 +1320,7 @@ public: IoCtx m_ioctx; std::string m_pool_name; bool m_init; + std::string m_oid; }; // EC test cases @@ -1322,7 +1335,7 @@ TEST(LibRadosAioEC, SimpleWritePP) { ASSERT_EQ("", test_data.init()); auto my_completion = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(buf), 0)); { TestAlarm alarm; @@ -1336,7 +1349,7 @@ TEST(LibRadosAioEC, SimpleWritePP) { ASSERT_EQ("", test_data.init()); test_data.m_ioctx.set_namespace("nspace"); auto my_completion = std::unique_ptr{Rados::aio_create_completion()}; - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(buf), 0)); { TestAlarm alarm; @@ -1356,7 +1369,7 @@ TEST(LibRadosAioEC, WaitForSafePP) { memset(buf, 0xcc, sizeof(buf)); bufferlist bl1; bl1.append(buf, sizeof(buf)); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(buf), 0)); TestAlarm alarm; ASSERT_EQ(0, my_completion->wait_for_complete()); @@ -1373,7 +1386,7 @@ TEST(LibRadosAioEC, RoundTripPP) { memset(buf, 0xcc, sizeof(buf)); bufferlist bl1; bl1.append(buf, sizeof(buf)); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(buf), 0)); { TestAlarm alarm; @@ -1383,7 +1396,7 @@ TEST(LibRadosAioEC, RoundTripPP) { bufferlist bl2; auto my_completion2 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion2); - ASSERT_EQ(0, test_data.m_ioctx.aio_read("foo", my_completion2.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_read(test_data.m_oid, my_completion2.get(), &bl2, sizeof(buf), 0)); { TestAlarm alarm; @@ -1404,7 +1417,7 @@ TEST(LibRadosAioEC, RoundTripPP2) { memset(buf, 0xcc, sizeof(buf)); bufferlist bl1; bl1.append(buf, sizeof(buf)); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(buf), 0)); { TestAlarm alarm; @@ -1414,7 +1427,7 @@ TEST(LibRadosAioEC, RoundTripPP2) { bufferlist bl2; auto my_completion2 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion2); - ASSERT_EQ(0, test_data.m_ioctx.aio_read("foo", my_completion2.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_read(test_data.m_oid, my_completion2.get(), &bl2, sizeof(buf), 0)); { TestAlarm alarm; @@ -1430,7 +1443,8 @@ TEST(LibRadosAioEC, RoundTripPP3) { SKIP_IF_CRIMSON(); Rados cluster; - std::string pool_name = get_temp_pool_name(); + auto pool_prefix = fmt::format("{}_", ::testing::UnitTest::GetInstance()->current_test_info()->name()); + std::string pool_name = get_temp_pool_name(pool_prefix); ASSERT_EQ("", create_one_pool_pp(pool_name, cluster)); IoCtx ioctx; cluster.ioctx_create(pool_name.c_str(), ioctx); @@ -1477,7 +1491,7 @@ TEST(LibRadosAio, RoundTripAppendPP) { memset(buf, 0xcc, sizeof(buf)); bufferlist bl1; bl1.append(buf, sizeof(buf)); - ASSERT_EQ(0, test_data.m_ioctx.aio_append("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_append(test_data.m_oid, my_completion.get(), bl1, sizeof(buf))); { TestAlarm alarm; @@ -1490,7 +1504,7 @@ TEST(LibRadosAio, RoundTripAppendPP) { bl2.append(buf2, sizeof(buf2)); auto my_completion2 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion2); - ASSERT_EQ(0, test_data.m_ioctx.aio_append("foo", my_completion2.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_append(test_data.m_oid, my_completion2.get(), bl2, sizeof(buf2))); { TestAlarm alarm; @@ -1500,7 +1514,7 @@ TEST(LibRadosAio, RoundTripAppendPP) { bufferlist bl3; auto my_completion3 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion3); - ASSERT_EQ(0, test_data.m_ioctx.aio_read("foo", my_completion3.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_read(test_data.m_oid, my_completion3.get(), &bl3, 2 * sizeof(buf), 0)); { TestAlarm alarm; @@ -1519,16 +1533,16 @@ TEST(LibRadosAioPP, RemoveTestPP) { bl1.append(buf, sizeof(buf)); AioTestDataPP test_data; ASSERT_EQ("", test_data.init()); - ASSERT_EQ(0, test_data.m_ioctx.append("foo", bl1, sizeof(buf))); + ASSERT_EQ(0, test_data.m_ioctx.append(test_data.m_oid, bl1, sizeof(buf))); auto my_completion = std::unique_ptr{Rados::aio_create_completion()}; - ASSERT_EQ(0, test_data.m_ioctx.aio_remove("foo", my_completion.get())); + ASSERT_EQ(0, test_data.m_ioctx.aio_remove(test_data.m_oid, my_completion.get())); { TestAlarm alarm; ASSERT_EQ(0, my_completion->wait_for_complete()); } ASSERT_EQ(0, my_completion->get_return_value()); bufferlist bl2; - ASSERT_EQ(-ENOENT, test_data.m_ioctx.read("foo", bl2, sizeof(buf), 0)); + ASSERT_EQ(-ENOENT, test_data.m_ioctx.read(test_data.m_oid, bl2, sizeof(buf), 0)); } TEST(LibRadosAioEC, RoundTripSparseReadPP) { @@ -1541,7 +1555,7 @@ TEST(LibRadosAioEC, RoundTripSparseReadPP) { memset(buf, 0xcc, sizeof(buf)); bufferlist bl1; bl1.append(buf, sizeof(buf)); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(buf), 0)); { TestAlarm alarm; @@ -1553,7 +1567,7 @@ TEST(LibRadosAioEC, RoundTripSparseReadPP) { bufferlist bl2; auto my_completion2 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion2); - ASSERT_EQ(0, test_data.m_ioctx.aio_sparse_read("foo", my_completion2.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_sparse_read(test_data.m_oid, my_completion2.get(), &extents, &bl2, sizeof(buf), 0)); { TestAlarm alarm; @@ -1580,7 +1594,7 @@ TEST(LibRadosAioEC, RoundTripAppendPP) { memset(buf, 0xcc, bsize); bufferlist bl1; bl1.append(buf, bsize); - ASSERT_EQ(0, test_data.m_ioctx.aio_append("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_append(test_data.m_oid, my_completion.get(), bl1, bsize)); { TestAlarm alarm; @@ -1595,7 +1609,7 @@ TEST(LibRadosAioEC, RoundTripAppendPP) { bl2.append(buf2, hbsize); auto my_completion2 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion2); - ASSERT_EQ(0, test_data.m_ioctx.aio_append("foo", my_completion2.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_append(test_data.m_oid, my_completion2.get(), bl2, hbsize)); { TestAlarm alarm; @@ -1605,7 +1619,7 @@ TEST(LibRadosAioEC, RoundTripAppendPP) { auto my_completion3 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion3); - ASSERT_EQ(0, test_data.m_ioctx.aio_append("foo", my_completion3.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_append(test_data.m_oid, my_completion3.get(), bl2, hbsize)); { TestAlarm alarm; @@ -1616,7 +1630,7 @@ TEST(LibRadosAioEC, RoundTripAppendPP) { bufferlist bl3; auto my_completion4 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion4); - ASSERT_EQ(0, test_data.m_ioctx.aio_read("foo", my_completion4.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_read(test_data.m_oid, my_completion4.get(), &bl3, bsize * 3, 0)); { TestAlarm alarm; @@ -1641,7 +1655,7 @@ TEST(LibRadosAioEC, IsCompletePP) { memset(buf, 0xcc, sizeof(buf)); bufferlist bl1; bl1.append(buf, sizeof(buf)); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(buf), 0)); { TestAlarm alarm; @@ -1651,7 +1665,7 @@ TEST(LibRadosAioEC, IsCompletePP) { bufferlist bl2; auto my_completion2 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion2); - ASSERT_EQ(0, test_data.m_ioctx.aio_read("foo", my_completion2.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_read(test_data.m_oid, my_completion2.get(), &bl2, sizeof(buf), 0)); { TestAlarm alarm; @@ -1678,7 +1692,7 @@ TEST(LibRadosAioEC, IsSafePP) { memset(buf, 0xcc, sizeof(buf)); bufferlist bl1; bl1.append(buf, sizeof(buf)); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(buf), 0)); { TestAlarm alarm; @@ -1695,7 +1709,7 @@ TEST(LibRadosAioEC, IsSafePP) { auto my_completion2 = std::unique_ptr{Rados::aio_create_completion()}; bufferlist bl2; ASSERT_TRUE(my_completion2); - ASSERT_EQ(0, test_data.m_ioctx.aio_read("foo", my_completion2.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_read(test_data.m_oid, my_completion2.get(), &bl2, sizeof(buf), 0)); { TestAlarm alarm; @@ -1732,14 +1746,14 @@ TEST(LibRadosAioEC, FlushPP) { memset(buf, 0xee, sizeof(buf)); bufferlist bl1; bl1.append(buf, sizeof(buf)); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(buf), 0)); ASSERT_EQ(0, test_data.m_ioctx.aio_flush()); ASSERT_EQ(0, my_completion->get_return_value()); bufferlist bl2; auto my_completion2 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion2); - ASSERT_EQ(0, test_data.m_ioctx.aio_read("foo", my_completion2.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_read(test_data.m_oid, my_completion2.get(), &bl2, sizeof(buf), 0)); { TestAlarm alarm; @@ -1761,7 +1775,7 @@ TEST(LibRadosAioEC, FlushAsyncPP) { memset(buf, 0xee, sizeof(buf)); bufferlist bl1; bl1.append(buf, sizeof(buf)); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(buf), 0)); ASSERT_EQ(0, test_data.m_ioctx.aio_flush_async(flush_completion.get())); { @@ -1774,7 +1788,7 @@ TEST(LibRadosAioEC, FlushAsyncPP) { bufferlist bl2; auto my_completion2 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion2); - ASSERT_EQ(0, test_data.m_ioctx.aio_read("foo", my_completion2.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_read(test_data.m_oid, my_completion2.get(), &bl2, sizeof(buf), 0)); { TestAlarm alarm; @@ -1795,7 +1809,7 @@ TEST(LibRadosAioEC, RoundTripWriteFullPP) { memset(buf, 0xcc, sizeof(buf)); bufferlist bl1; bl1.append(buf, sizeof(buf)); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(buf), 0)); { TestAlarm alarm; @@ -1808,7 +1822,7 @@ TEST(LibRadosAioEC, RoundTripWriteFullPP) { bl2.append(buf2, sizeof(buf2)); auto my_completion2 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion2); - ASSERT_EQ(0, test_data.m_ioctx.aio_write_full("foo", my_completion2.get(), bl2)); + ASSERT_EQ(0, test_data.m_ioctx.aio_write_full(test_data.m_oid, my_completion2.get(), bl2)); { TestAlarm alarm; ASSERT_EQ(0, my_completion2->wait_for_complete()); @@ -1817,7 +1831,7 @@ TEST(LibRadosAioEC, RoundTripWriteFullPP) { bufferlist bl3; auto my_completion3 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion3); - ASSERT_EQ(0, test_data.m_ioctx.aio_read("foo", my_completion3.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_read(test_data.m_oid, my_completion3.get(), &bl3, sizeof(buf), 0)); { TestAlarm alarm; @@ -1833,7 +1847,8 @@ TEST(LibRadosAioEC, RoundTripWriteFullPP2) { SKIP_IF_CRIMSON(); Rados cluster; - std::string pool_name = get_temp_pool_name(); + auto pool_prefix = fmt::format("{}_", ::testing::UnitTest::GetInstance()->current_test_info()->name()); + std::string pool_name = get_temp_pool_name(pool_prefix); ASSERT_EQ("", create_one_pool_pp(pool_name, cluster)); IoCtx ioctx; cluster.ioctx_create(pool_name.c_str(), ioctx); @@ -1881,7 +1896,7 @@ TEST(LibRadosAioEC, SimpleStatPP) { memset(buf, 0xcc, sizeof(buf)); bufferlist bl1; bl1.append(buf, sizeof(buf)); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(buf), 0)); { TestAlarm alarm; @@ -1892,7 +1907,7 @@ TEST(LibRadosAioEC, SimpleStatPP) { time_t pmtime; auto my_completion2 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion2); - ASSERT_EQ(0, test_data.m_ioctx.aio_stat("foo", my_completion2.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_stat(test_data.m_oid, my_completion2.get(), &psize, &pmtime)); { TestAlarm alarm; @@ -1912,7 +1927,7 @@ TEST(LibRadosAioEC, SimpleStatPPNS) { memset(buf, 0xcc, sizeof(buf)); bufferlist bl1; bl1.append(buf, sizeof(buf)); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(buf), 0)); { TestAlarm alarm; @@ -1923,7 +1938,7 @@ TEST(LibRadosAioEC, SimpleStatPPNS) { time_t pmtime; auto my_completion2 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion2); - ASSERT_EQ(0, test_data.m_ioctx.aio_stat("foo", my_completion2.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_stat(test_data.m_oid, my_completion2.get(), &psize, &pmtime)); { TestAlarm alarm; @@ -1943,7 +1958,7 @@ TEST(LibRadosAioEC, StatRemovePP) { memset(buf, 0xcc, sizeof(buf)); bufferlist bl1; bl1.append(buf, sizeof(buf)); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(buf), 0)); { TestAlarm alarm; @@ -1954,7 +1969,7 @@ TEST(LibRadosAioEC, StatRemovePP) { time_t pmtime; auto my_completion2 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion2); - ASSERT_EQ(0, test_data.m_ioctx.aio_stat("foo", my_completion2.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_stat(test_data.m_oid, my_completion2.get(), &psize, &pmtime)); { TestAlarm alarm; @@ -1966,7 +1981,7 @@ TEST(LibRadosAioEC, StatRemovePP) { time_t pmtime2; auto my_completion3 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion3); - ASSERT_EQ(0, test_data.m_ioctx.aio_remove("foo", my_completion3.get())); + ASSERT_EQ(0, test_data.m_ioctx.aio_remove(test_data.m_oid, my_completion3.get())); { TestAlarm alarm; ASSERT_EQ(0, my_completion3->wait_for_complete()); @@ -1975,7 +1990,7 @@ TEST(LibRadosAioEC, StatRemovePP) { auto my_completion4 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion4); - ASSERT_EQ(0, test_data.m_ioctx.aio_stat("foo", my_completion4.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_stat(test_data.m_oid, my_completion4.get(), &psize2, &pmtime2)); { TestAlarm alarm; @@ -1994,7 +2009,7 @@ TEST(LibRadosAioEC, ExecuteClassPP) { memset(buf, 0xcc, sizeof(buf)); bufferlist bl1; bl1.append(buf, sizeof(buf)); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(buf), 0)); { TestAlarm alarm; @@ -2004,7 +2019,7 @@ TEST(LibRadosAioEC, ExecuteClassPP) { auto my_completion2 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion2); bufferlist in, out; - ASSERT_EQ(0, test_data.m_ioctx.aio_exec("foo", my_completion2.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_exec(test_data.m_oid, my_completion2.get(), "hello", "say_hello", in, &out)); { TestAlarm alarm; @@ -2017,7 +2032,8 @@ TEST(LibRadosAioEC, ExecuteClassPP) { TEST(LibRadosAioEC, OmapPP) { SKIP_IF_CRIMSON(); Rados cluster; - std::string pool_name = get_temp_pool_name(); + auto pool_prefix = fmt::format("{}_", ::testing::UnitTest::GetInstance()->current_test_info()->name()); + std::string pool_name = get_temp_pool_name(pool_prefix); ASSERT_EQ("", create_one_ec_pool_pp(pool_name, cluster)); IoCtx ioctx; cluster.ioctx_create(pool_name.c_str(), ioctx); @@ -2058,7 +2074,7 @@ TEST(LibRadosAioEC, MultiWritePP) { memset(buf, 0xcc, sizeof(buf)); bufferlist bl1; bl1.append(buf, sizeof(buf)); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(buf), 0)); { TestAlarm alarm; @@ -2072,7 +2088,7 @@ TEST(LibRadosAioEC, MultiWritePP) { bl2.append(buf2, sizeof(buf2)); auto my_completion2 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion2); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion2.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion2.get(), bl2, sizeof(buf2), sizeof(buf))); { TestAlarm alarm; @@ -2083,7 +2099,7 @@ TEST(LibRadosAioEC, MultiWritePP) { bufferlist bl3; auto my_completion3 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion3); - ASSERT_EQ(0, test_data.m_ioctx.aio_read("foo", my_completion3.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_read(test_data.m_oid, my_completion3.get(), &bl3, (sizeof(buf) + sizeof(buf2) * 3), 0)); { TestAlarm alarm; @@ -2106,8 +2122,8 @@ TEST(LibRadosAio, RacingRemovePP) { bl.append(buf, sizeof(buf)); auto my_completion2 = std::unique_ptr{Rados::aio_create_completion()}; ASSERT_TRUE(my_completion2); - ASSERT_EQ(0, test_data.m_ioctx.aio_remove("foo", my_completion2.get())); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_remove(test_data.m_oid, my_completion2.get())); + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl, sizeof(buf), 0)); { TestAlarm alarm; @@ -2116,7 +2132,7 @@ TEST(LibRadosAio, RacingRemovePP) { } ASSERT_EQ(-ENOENT, my_completion2->get_return_value()); ASSERT_EQ(0, my_completion->get_return_value()); - ASSERT_EQ(0, test_data.m_ioctx.stat("foo", nullptr, nullptr)); + ASSERT_EQ(0, test_data.m_ioctx.stat(test_data.m_oid, nullptr, nullptr)); } TEST(LibRadosAio, RoundTripCmpExtPP) { @@ -2128,7 +2144,7 @@ TEST(LibRadosAio, RoundTripCmpExtPP) { memset(full, 0xcc, sizeof(full)); bufferlist bl1; bl1.append(full, sizeof(full)); - ASSERT_EQ(0, test_data.m_ioctx.aio_write("foo", my_completion.get(), + ASSERT_EQ(0, test_data.m_ioctx.aio_write(test_data.m_oid, my_completion.get(), bl1, sizeof(full), 0)); { TestAlarm alarm; @@ -2140,7 +2156,7 @@ TEST(LibRadosAio, RoundTripCmpExtPP) { bufferlist cbl; cbl.append(full, sizeof(full)); auto my_completion2 = std::unique_ptr{Rados::aio_create_completion()}; - ASSERT_EQ(0, test_data.m_ioctx.aio_cmpext("foo", my_completion2.get(), 0, cbl)); + ASSERT_EQ(0, test_data.m_ioctx.aio_cmpext(test_data.m_oid, my_completion2.get(), 0, cbl)); { TestAlarm alarm; @@ -2153,7 +2169,7 @@ TEST(LibRadosAio, RoundTripCmpExtPP) { cbl.clear(); cbl.append(full, sizeof(full)); auto my_completion3 = std::unique_ptr{Rados::aio_create_completion()}; - ASSERT_EQ(0, test_data.m_ioctx.aio_cmpext("foo", my_completion3.get(), 0, cbl)); + ASSERT_EQ(0, test_data.m_ioctx.aio_cmpext(test_data.m_oid, my_completion3.get(), 0, cbl)); { TestAlarm alarm; ASSERT_EQ(0, my_completion3->wait_for_complete()); @@ -2168,7 +2184,8 @@ TEST(LibRadosAio, RoundTripCmpExtPP2) char miscmp_buf[128]; bufferlist cbl; Rados cluster; - std::string pool_name = get_temp_pool_name(); + auto pool_prefix = fmt::format("{}_", ::testing::UnitTest::GetInstance()->current_test_info()->name()); + std::string pool_name = get_temp_pool_name(pool_prefix); ASSERT_EQ("", create_one_pool_pp(pool_name, cluster)); IoCtx ioctx; cluster.ioctx_create(pool_name.c_str(), ioctx); @@ -2307,7 +2324,7 @@ TEST(LibRadosAio, PoolEIOFlag) { info->c->set_complete_callback((void*)info, pool_io_callback); inflight.insert(i); my_lock.unlock(); - int r = test_data.m_ioctx.aio_write("foo", info->c, bl, bl.length(), 0); + int r = test_data.m_ioctx.aio_write(test_data.m_oid, info->c, bl, bl.length(), 0); //cout << "start " << i << " r = " << r << std::endl; if (i == max / 2) { diff --git a/src/test/librados/test_shared.h b/src/test/librados/test_shared.h index 6f3747e7b41..3a18e916e2e 100644 --- a/src/test/librados/test_shared.h +++ b/src/test/librados/test_shared.h @@ -21,7 +21,7 @@ class TestAlarm public: #ifndef _WIN32 TestAlarm() { - alarm(1200); + alarm(2400); } ~TestAlarm() { alarm(0); diff --git a/src/test/librados/testcase_cxx.cc b/src/test/librados/testcase_cxx.cc index 135b36e8eee..77bdbf0fe2d 100644 --- a/src/test/librados/testcase_cxx.cc +++ b/src/test/librados/testcase_cxx.cc @@ -4,6 +4,7 @@ #include "testcase_cxx.h" #include +#include #include "test_cxx.h" #include "test_shared.h" #include "include/scope_guard.h" @@ -29,7 +30,8 @@ Rados RadosTestPPNS::s_cluster; void RadosTestPPNS::SetUpTestCase() { - pool_name = get_temp_pool_name(); + auto pool_prefix = fmt::format("{}_", ::testing::UnitTest::GetInstance()->current_test_case()->name()); + pool_name = get_temp_pool_name(pool_prefix); ASSERT_EQ("", create_one_pool_pp(pool_name, s_cluster)); } @@ -72,7 +74,8 @@ Rados RadosTestParamPPNS::s_cluster; void RadosTestParamPPNS::SetUpTestCase() { - pool_name = get_temp_pool_name(); + auto pool_prefix = fmt::format("{}_", ::testing::UnitTest::GetInstance()->current_test_case()->name()); + pool_name = get_temp_pool_name(pool_prefix); ASSERT_EQ("", create_one_pool_pp(pool_name, s_cluster)); } @@ -101,7 +104,8 @@ void RadosTestParamPPNS::TearDownTestCase() void RadosTestParamPPNS::SetUp() { if (strcmp(GetParam(), "cache") == 0 && cache_pool_name.empty()) { - cache_pool_name = get_temp_pool_name(); + auto pool_prefix = fmt::format("{}_", ::testing::UnitTest::GetInstance()->current_test_case()->name()); + cache_pool_name = get_temp_pool_name(pool_prefix); bufferlist inbl; ASSERT_EQ(0, cluster.mon_command( "{\"prefix\": \"osd pool create\", \"pool\": \"" + cache_pool_name + @@ -154,7 +158,8 @@ Rados RadosTestECPPNS::s_cluster; void RadosTestECPPNS::SetUpTestCase() { - pool_name = get_temp_pool_name(); + auto pool_prefix = fmt::format("{}_", ::testing::UnitTest::GetInstance()->current_test_case()->name()); + pool_name = get_temp_pool_name(pool_prefix); ASSERT_EQ("", create_one_ec_pool_pp(pool_name, s_cluster)); } @@ -187,7 +192,8 @@ void RadosTestPP::SetUpTestCase() { init_rand(); - pool_name = get_temp_pool_name(); + auto pool_prefix = fmt::format("{}_", ::testing::UnitTest::GetInstance()->current_test_case()->name()); + pool_name = get_temp_pool_name(pool_prefix); ASSERT_EQ("", create_one_pool_pp(pool_name, s_cluster)); } @@ -268,7 +274,8 @@ Rados RadosTestParamPP::s_cluster; void RadosTestParamPP::SetUpTestCase() { - pool_name = get_temp_pool_name(); + auto pool_prefix = fmt::format("{}_", ::testing::UnitTest::GetInstance()->current_test_case()->name()); + pool_name = get_temp_pool_name(pool_prefix); ASSERT_EQ("", create_one_pool_pp(pool_name, s_cluster)); } @@ -297,7 +304,8 @@ void RadosTestParamPP::TearDownTestCase() void RadosTestParamPP::SetUp() { if (strcmp(GetParam(), "cache") == 0 && cache_pool_name.empty()) { - cache_pool_name = get_temp_pool_name(); + auto pool_prefix = fmt::format("{}_", ::testing::UnitTest::GetInstance()->current_test_case()->name()); + cache_pool_name = get_temp_pool_name(pool_prefix); bufferlist inbl; ASSERT_EQ(0, cluster.mon_command( "{\"prefix\": \"osd pool create\", \"pool\": \"" + cache_pool_name + @@ -359,7 +367,8 @@ Rados RadosTestECPP::s_cluster; void RadosTestECPP::SetUpTestCase() { - pool_name = get_temp_pool_name(); + auto pool_prefix = fmt::format("{}_", ::testing::UnitTest::GetInstance()->current_test_case()->name()); + pool_name = get_temp_pool_name(pool_prefix); ASSERT_EQ("", create_one_ec_pool_pp(pool_name, s_cluster)); } diff --git a/src/test/librados/watch_notify.cc b/src/test/librados/watch_notify.cc index 7893652a963..4d880f2c250 100644 --- a/src/test/librados/watch_notify.cc +++ b/src/test/librados/watch_notify.cc @@ -245,7 +245,10 @@ TEST_F(LibRadosWatchNotify, AioWatchDelete) { } ASSERT_TRUE(left > 0); ASSERT_EQ(-ENOTCONN, notify_err); - ASSERT_EQ(-ENOTCONN, rados_watch_check(ioctx, handle)); + int rados_watch_check_err = rados_watch_check(ioctx, handle); + // We may hit ENOENT due to socket failure injection and a forced reconnect + EXPECT_TRUE(rados_watch_check_err == -ENOTCONN || rados_watch_check_err == -ENOENT) + << "Where rados_watch_check_err = " << rados_watch_check_err; ASSERT_EQ(0, rados_aio_create_completion2(nullptr, nullptr, &comp)); rados_aio_unwatch(ioctx, handle, comp); ASSERT_EQ(0, rados_aio_wait_for_complete(comp)); diff --git a/src/test/system/systest_runnable.cc b/src/test/system/systest_runnable.cc index f7342aa7ded..40f94c4036f 100644 --- a/src/test/system/systest_runnable.cc +++ b/src/test/system/systest_runnable.cc @@ -97,8 +97,10 @@ start() #else std::string err_msg; ret = preforker.prefork(err_msg); - if (ret < 0) - preforker.exit(ret); + if (ret < 0) { + printf("prefork failed: %s\n", err_msg.c_str()); + return ret; + } if (preforker.is_child()) { m_started = true;