Beispiel #1
0
static void test_backend_status(session &sess)
{
	server_node &node = global_data->nodes[0];

	ELLIPTICS_REQUIRE(async_status_result, sess.request_backends_status(node.remote()));
	sync_backend_status_result result = async_status_result;

	BOOST_REQUIRE_EQUAL(result.size(), 1);

	backend_status_result_entry entry = result.front();

	BOOST_REQUIRE_EQUAL(entry.count(), backends_count);

	for (size_t i = 0; i < backends_count; ++i) {
		dnet_backend_status *status = entry.backend(i);
		BOOST_REQUIRE_EQUAL(status->backend_id, i);
		if (i < 2 || i == 3) {
			BOOST_REQUIRE_EQUAL(status->state, DNET_BACKEND_ENABLED);
		} else {
			BOOST_REQUIRE_EQUAL(status->state, DNET_BACKEND_DISABLED);
		}
	}
}
Beispiel #2
0
static void test_remove_backend(session &sess) {
	server_node &node = get_setup()->nodes[0];


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

	ELLIPTICS_REQUIRE(enable_result, sess.remove_backend(node.remote(), backend_id));

	/* Request all backends status and check that removed backend is missed */
	ELLIPTICS_REQUIRE(async_status_result, sess.request_backends_status(node.remote()));
	sync_backend_status_result result = async_status_result;

	BOOST_REQUIRE_EQUAL(result.size(), 1);

	backend_status_result_entry entry = result.front();

	for (size_t i = 0; i < backends_count; ++i) {
		auto status = entry.backend(i);
		BOOST_REQUIRE_NE(status->backend_id, backend_id);
	}
}