Allow to create OSD with mocked blockstore and network
This commit is contained in:
@@ -19,7 +19,7 @@ add_executable(stub_uring_osd
|
||||
stub_uring_osd.cpp
|
||||
)
|
||||
target_link_libraries(stub_uring_osd
|
||||
vitastor_common
|
||||
vitastor_net
|
||||
${LIBURING_LIBRARIES}
|
||||
${IBVERBS_LIBRARIES}
|
||||
${RDMACM_LIBRARIES}
|
||||
|
||||
@@ -61,3 +61,30 @@ json11::Json::object osd_messenger_t::merge_configs(const json11::Json::object &
|
||||
void osd_messenger_t::destroy_rdma_conn(msgr_rdma_connection_t *rdma_conn)
|
||||
{
|
||||
}
|
||||
|
||||
void osd_messenger_t::accept_connections(int listen_fd)
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef WITH_RDMA
|
||||
json11::Json osd_messenger_t::connect_rdma(uint64_t client_id, std::string rdma_address, uint64_t client_max_msg)
|
||||
{
|
||||
return json11::Json();
|
||||
}
|
||||
|
||||
bool osd_messenger_t::is_rdma_enabled()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WITH_RDMACM
|
||||
rdma_cm_id *osd_messenger_t::rdmacm_listen(const std::string & bind_address, int rdmacm_port, int *bound_port, int log_level)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void osd_messenger_t::rdmacm_destroy_listener(rdma_cm_id *listener)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
// Copyright (c) Vitaliy Filippov, 2019+
|
||||
// License: VNPL-1.1 (see README.md for details)
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include "osd.h"
|
||||
#include "etcd_state_client_mock.h"
|
||||
#include "ringloop_mock.h"
|
||||
#include "blockstore_mock.h"
|
||||
|
||||
void test1()
|
||||
{
|
||||
json11::Json config;
|
||||
timerfd_manager_t *tfd = new timerfd_manager_t([](int fd, bool wr, std::function<void(int, int)> callback){});
|
||||
etcd_state_client_mock_t *st_cli = new etcd_state_client_mock_t();
|
||||
ring_loop_mock_t *ringloop = new ring_loop_mock_t(RINGLOOP_DEFAULT_SIZE, [&](io_uring_sqe *sqe) {});
|
||||
st_cli->pause();
|
||||
osd_t *osd = new osd_t(config, ringloop, tfd, std::unique_ptr<etcd_state_client_t>(st_cli), [](blockstore_config_t & cfg)
|
||||
{
|
||||
return new blockstore_mock_t({});
|
||||
});
|
||||
}
|
||||
|
||||
int main(int narg, char *args[])
|
||||
{
|
||||
test1();
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user