From d0ead7893cfc794dd3adb4e1ddb46fac74145d5f Mon Sep 17 00:00:00 2001 From: abitmore Date: Mon, 8 Aug 2022 11:57:07 +0000 Subject: [PATCH] Fix es_objects plugin limit order processing tests --- tests/common/database_fixture.cpp | 4 ++-- tests/elasticsearch/main.cpp | 18 +++++++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/tests/common/database_fixture.cpp b/tests/common/database_fixture.cpp index 0240ef86f7..67683e9421 100644 --- a/tests/common/database_fixture.cpp +++ b/tests/common/database_fixture.cpp @@ -413,8 +413,8 @@ std::shared_ptr database_fixture_base::in fixture.app.register_plugin(true); fc::set_option( options, "es-objects-elasticsearch-url", GRAPHENE_TESTING_ES_URL ); - fc::set_option( options, "es-objects-bulk-replay", uint32_t(2) ); - fc::set_option( options, "es-objects-bulk-sync", uint32_t(2) ); + fc::set_option( options, "es-objects-bulk-replay", uint32_t(1) ); + fc::set_option( options, "es-objects-bulk-sync", uint32_t(1) ); fc::set_option( options, "es-objects-proposals", true ); fc::set_option( options, "es-objects-accounts", true ); fc::set_option( options, "es-objects-assets", true ); diff --git a/tests/elasticsearch/main.cpp b/tests/elasticsearch/main.cpp index 779c887406..eb7f5d3795 100644 --- a/tests/elasticsearch/main.cpp +++ b/tests/elasticsearch/main.cpp @@ -307,13 +307,17 @@ BOOST_AUTO_TEST_CASE(elasticsearch_objects) { es.endpoint = es.index_prefix + "limitorder/_doc/_count"; es.query = ""; - res = graphene::utilities::getEndPoint(es); - j = fc::json::from_string(res); - BOOST_REQUIRE( j.is_object() ); - const auto& obj = j.get_object(); - BOOST_REQUIRE( obj.find("count") != obj.end() ); - total = obj["count"].as_string(); - BOOST_CHECK( total == "0" ); // the limit order expired, so the object is removed + fc::wait_for( ES_WAIT_TIME, [&]() { + res = graphene::utilities::getEndPoint(es); + j = fc::json::from_string(res); + if( !j.is_object() ) + return false; + const auto& obj = j.get_object(); + if( obj.find("count") == obj.end() ) + return false; + total = obj["count"].as_string(); + return (total == "0"); // the limit order expired, so the object is removed + }); } }