Exemplo n.º 1
0
void init_application_impl(session &sess, const std::string &app_name, const nodes_data *setup)
{
	sess.set_timeout(600);
	auto log = sess.get_logger();
	DNET_LOG_INFO(log, "Sending @init");

	node_info info = node_info_create(setup, sess.get_groups());

	ELLIPTICS_REQUIRE(exec_result, sess.exec(NULL, app_name + "@init", info.pack()));

	sync_exec_result result = exec_result;
	BOOST_REQUIRE_EQUAL(result.size(), setup->nodes.size());
	for (auto it = result.begin(); it != result.end(); ++it)
		BOOST_REQUIRE_EQUAL(it->context().data().to_string(), "inited");
}
Exemplo n.º 2
0
std::function<void ()> make(const char *test_name, Method method, session sess, Args... args)
{
	uint64_t trace_id = 0;
	auto buffer = reinterpret_cast<unsigned char *>(&trace_id);
	for (size_t i = 0; i < sizeof(trace_id); ++i) {
		buffer[i] = rand();
	}

	sess.set_trace_id(trace_id);

	test_wrapper wrapper = {
		std::make_shared<ioremap::elliptics::logger>(sess.get_logger(), blackhole::log::attributes_t()),
		test_name,
		std::bind(method, sess, std::forward<Args>(args)...)
	};

	return wrapper;
}