diff --git a/tests/server_send.cpp b/tests/server_send.cpp index 54a3386bf..768671ad1 100644 --- a/tests/server_send.cpp +++ b/tests/server_send.cpp @@ -79,10 +79,11 @@ static void ssend_configure(const std::string &path) static void ssend_test_insert_many_keys_old_ts(session &s, int num, const std::string &id_prefix, const std::string &data_prefix) { + std::vector results; s.set_trace_id(rand()); for (int i = 0; i < num; ++i) { - std::string id = id_prefix + lexical_cast(i); - std::string data = data_prefix + lexical_cast(i); + auto id = id_prefix + lexical_cast(i); + auto data = data_prefix + lexical_cast(i); key k(id); s.transform(k); @@ -95,39 +96,59 @@ static void ssend_test_insert_many_keys_old_ts(session &s, int num, const std::s dnet_current_time(&io.timestamp); io.timestamp.tsec -= 1000; - ELLIPTICS_REQUIRE(res, s.write_data(io, data)); + results.push_back(s.write_data(io, data)); + } + + for (auto &r : results) { + ELLIPTICS_REQUIRE(res, std::move(r)); } } static void ssend_test_insert_many_keys(session &s, int num, const std::string &id_prefix, const std::string &data_prefix) { + std::vector results; s.set_trace_id(rand()); for (int i = 0; i < num; ++i) { - std::string id = id_prefix + lexical_cast(i); - std::string data = data_prefix + lexical_cast(i); + auto id = id_prefix + lexical_cast(i); + auto data = data_prefix + lexical_cast(i); + + results.push_back(s.write_data(id, data, 0)); + } - ELLIPTICS_REQUIRE(res, s.write_data(id, data, 0)); + for (auto &r : results) { + ELLIPTICS_REQUIRE(res, std::move(r)); } } static void ssend_test_read_many_keys(session &s, int num, const std::string &id_prefix, const std::string &data_prefix) { + std::vector results; s.set_trace_id(rand()); for (int i = 0; i < num; ++i) { - std::string id = id_prefix + lexical_cast(i); - std::string data = data_prefix + lexical_cast(i); + auto id = id_prefix + lexical_cast(i); - ELLIPTICS_COMPARE_REQUIRE(res, s.read_data(id, 0, 0), data); + results.push_back(s.read_data(id, 0, 0)); + } + + for (int i = 0; i < num; ++i) { + auto data = data_prefix + lexical_cast(i); + + ELLIPTICS_COMPARE_REQUIRE(res, std::move(results[i]), data); } } static void ssend_test_read_many_keys_error(session &s, int num, const std::string &id_prefix, int error) { + std::vector results; s.set_trace_id(rand()); for (int i = 0; i < num; ++i) { - std::string id = id_prefix + lexical_cast(i); + auto id = id_prefix + lexical_cast(i); + + results.push_back(s.read_data(id, 0, 0)); + } - ELLIPTICS_REQUIRE_ERROR(res, s.read_data(id, 0, 0), error); + for (auto &r : results) { + ELLIPTICS_REQUIRE_ERROR(res, std::move(r), error); } } @@ -231,16 +252,20 @@ static void ssend_test_server_send(session &s, int num, const std::string &id_pr logger &log = s.get_logger(); s.set_trace_id(rand()); + std::vector write_results; std::vector keys; for (int i = 0; i < num; ++i) { - std::string id = id_prefix + lexical_cast(i); - std::string data = data_prefix + lexical_cast(i); - - ELLIPTICS_REQUIRE(res, s.write_data(id, data, 0)); + auto id = id_prefix + lexical_cast(i); + auto data = data_prefix + lexical_cast(i); + write_results.push_back(s.write_data(id, data, 0)); keys.push_back(id); } + for (auto &r : write_results) { + ELLIPTICS_REQUIRE(res, std::move(r)); + } + BH_LOG(log, DNET_LOG_NOTICE, "%s: keys: %d, dst_groups: %s, starting copy", __func__, num, print_groups(dst_groups));