diff --git a/src/test/common/test_context.cc b/src/test/common/test_context.cc index 2c846a9ae7240b..889d000da85cdb 100644 --- a/src/test/common/test_context.cc +++ b/src/test/common/test_context.cc @@ -30,7 +30,7 @@ using namespace std; TEST(CephContext, do_command) { - CephContext *cct = (new CephContext(CEPH_ENTITY_TYPE_CLIENT))->get(); + boost::intrusive_ptr cct{new CephContext(CEPH_ENTITY_TYPE_CLIENT), false}; cct->_conf->cluster = "ceph"; @@ -89,12 +89,11 @@ TEST(CephContext, do_command) string s(out.c_str(), out.length()); EXPECT_EQ("" + value + "value616100", s); } - cct->put(); } TEST(CephContext, experimental_features) { - CephContext *cct = (new CephContext(CEPH_ENTITY_TYPE_CLIENT))->get(); + boost::intrusive_ptr cct{new CephContext(CEPH_ENTITY_TYPE_CLIENT), false}; cct->_conf->cluster = "ceph"; diff --git a/src/test/common/test_util.cc b/src/test/common/test_util.cc index 91ac771f80481e..8eb989d3047b72 100644 --- a/src/test/common/test_util.cc +++ b/src/test/common/test_util.cc @@ -31,12 +31,12 @@ TEST(util, collect_sys_info) map sys_info; - CephContext *cct = (new CephContext(CEPH_ENTITY_TYPE_CLIENT))->get(); - collect_sys_info(&sys_info, cct); + boost::intrusive_ptr cct{new CephContext(CEPH_ENTITY_TYPE_CLIENT), false}; + + collect_sys_info(&sys_info, cct.get()); ASSERT_TRUE(sys_info.find("distro") != sys_info.end()); ASSERT_TRUE(sys_info.find("distro_description") != sys_info.end()); - - cct->put(); } + #endif