Skip to content

Commit

Permalink
Fix es_objects plugin limit order processing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
abitmore committed Aug 8, 2022
1 parent d54da7e commit d0ead78
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions tests/common/database_fixture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,8 @@ std::shared_ptr<boost::program_options::variables_map> database_fixture_base::in
fixture.app.register_plugin<graphene::es_objects::es_objects_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 );
Expand Down
18 changes: 11 additions & 7 deletions tests/elasticsearch/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
});

}
}
Expand Down

0 comments on commit d0ead78

Please sign in to comment.