add_ceph_unittest(unittest_rgw_lua)
target_include_directories(unittest_rgw_lua
SYSTEM PRIVATE "${CMAKE_SOURCE_DIR}/src/rgw")
-target_link_libraries(unittest_rgw_lua ${rgw_libs})
+target_link_libraries(unittest_rgw_lua unit-main ${rgw_libs})
add_executable(radosgw-cr-test rgw_cr_test.cc)
target_link_libraries(radosgw-cr-test ${rgw_libs} librados
using rgw::auth::Identity;
using rgw::auth::Principal;
-class CctCleaner {
- CephContext* cct;
-public:
- CctCleaner(CephContext* _cct) : cct(_cct) {}
- ~CctCleaner() {
-#ifdef WITH_CRIMSON
- delete cct;
-#else
- cct->put();
-#endif
- }
-};
-
class FakeIdentity : public Identity {
public:
FakeIdentity() = default;
}
};
-auto g_cct = new CephContext(CEPH_ENTITY_TYPE_CLIENT);
-
-CctCleaner cleaner(g_cct);
-
tracing::Tracer tracer;
inline std::unique_ptr<sal::RadosStore> make_store() {
auto context_pool = std::make_unique<ceph::async::io_context_pool>(
- g_cct->_conf->rgw_thread_pool_size);
+ g_ceph_context->_conf->rgw_thread_pool_size);
struct StoreBundle : public sal::RadosStore {
std::unique_ptr<ceph::async::io_context_pool> context_pool;
std::string lua_script;
unsigned read_time = 0;
TestLuaManager() {
- rgw_perf_start(g_cct);
+ rgw_perf_start(g_ceph_context);
}
int get_script(const DoutPrefixProvider* dpp, optional_yield y, const std::string& key, std::string& script) override {
std::this_thread::sleep_for(std::chrono::seconds(read_time));
return 0;
}
~TestLuaManager() {
- rgw_perf_stop(g_cct);
+ rgw_perf_stop(g_ceph_context);
}
};
auto store = make_store(); \
pe.lua.manager = std::make_unique<TestLuaManager>(); \
RGWEnv e; \
- req_state s(g_cct, pe, &e, 0);
+ req_state s(g_ceph_context, pe, &e, 0);
-#define INIT_TRACE tracer.init(g_cct, "test"); \
+#define INIT_TRACE tracer.init(g_ceph_context, "test"); \
s.trace = tracer.start_trace("test", true);
TEST(TestRGWLua, EmptyScript)
public:
TestBackground(sal::RadosStore* store, rgw::sal::LuaManager* manager) :
rgw::lua::Background(store,
- g_cct,
+ g_ceph_context,
manager,
1 /* run every second */) {
}