示例#1
0
static void test_error_message(session &s, const std::string &id, int err)
{
	s.set_filter(filters::all);

	ELLIPTICS_REQUIRE_ERROR(read_result, s.read_data(id, 0, 0), err);

	sync_read_result sync_result = read_result.get();

	BOOST_REQUIRE(sync_result.size() > 0);

	read_result_entry entry = sync_result[0];

	BOOST_REQUIRE_EXCEPTION(entry.io_attribute(), not_found_error, test_error_check_exception);
}
示例#2
0
static void test_make_backend_readonly(session &sess)
{
	server_node &node = global_data->nodes.back();
	const key id = std::string("read_only_key");
	const std::string data = "read_only_data";

	ELLIPTICS_REQUIRE(async_readonly_result, sess.make_readonly(node.remote(), 4));

	backend_status_result_entry result = async_readonly_result.get_one();
	BOOST_REQUIRE(result.is_valid());
	BOOST_REQUIRE_EQUAL(result.count(), 1);

	dnet_backend_status *status = result.backend(0);
	BOOST_REQUIRE_EQUAL(status->backend_id, 4);
	BOOST_REQUIRE_EQUAL(status->read_only, true);

	session new_sess = sess.clone();
	new_sess.set_direct_id(node.remote(), 4);

	ELLIPTICS_REQUIRE_ERROR(write_result, new_sess.write_data(id, data, 0), -EROFS);

	ELLIPTICS_REQUIRE_ERROR(second_async_readonly_result, sess.make_readonly(node.remote(), 4), -EALREADY);
}
示例#3
0
static void test_enable_backend_after_config_change(session &sess)
{
	server_node &node = get_setup()->nodes[0];

	server_config &config = node.config();
	config_data &hidden_backend = config.backends.back();
	uint32_t backend_id = std::stoi(hidden_backend.string_value("backend_id"));

	ELLIPTICS_REQUIRE_ERROR(enable_result, sess.enable_backend(node.remote(), backend_id), -ENOENT);

	hidden_backend.set_serializable(true);
	config.write(node.config_path());

	test_enable_backend(sess, backend_id);
}
示例#4
0
static void test_disable_backend_again(session &sess)
{
	server_node &node = global_data->nodes[0];

	ELLIPTICS_REQUIRE_ERROR(enable_result, sess.disable_backend(node.remote(), 1), -EALREADY);
}
示例#5
0
static void test_enable_backend_again(session &sess)
{
	server_node &node = get_setup()->nodes[0];

	ELLIPTICS_REQUIRE_ERROR(enable_result, sess.enable_backend(node.remote(), 1), -EALREADY);
}