Skip to content

Commit

Permalink
Add tests for storing budget records in ES
Browse files Browse the repository at this point in the history
  • Loading branch information
abitmore committed Jan 2, 2022
1 parent 521b6ec commit 68b739d
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/elasticsearch/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,25 @@ BOOST_AUTO_TEST_CASE(elasticsearch_objects) {

auto bitasset_data_id = j["hits"]["hits"][size_t(0)]["_source"]["bitasset_data_id"].as_string();
es.endpoint = es.index_prefix + "bitasset/_doc/_search";
es.query = "{ \"query\" : { \"bool\": { \"must\" : [{ \"term\": { \"object_id\": \""+bitasset_data_id+"\"}}] } } }";
es.query = "{ \"query\" : { \"bool\": { \"must\" : [{ \"term\": { \"object_id\": \""
+ bitasset_data_id + "\"}}] } } }";
res = graphene::utilities::simpleQuery(es);
j = fc::json::from_string(res);
auto bitasset_object_id = j["hits"]["hits"][size_t(0)]["_source"]["object_id"].as_string();
BOOST_CHECK_EQUAL(bitasset_object_id, bitasset_data_id);

// maintenance, for budget records
generate_blocks( db.get_dynamic_global_properties().next_maintenance_time );

es.endpoint = es.index_prefix + "budget/_doc/_count";
es.query = "{ \"query\" : { \"bool\" : { \"must\" : [{\"match_all\": {}}] } } }";
fc::wait_for( ES_WAIT_TIME, [&]() {
res = graphene::utilities::simpleQuery(es);
j = fc::json::from_string(res);
total = j["count"].as_string();
return (total == "1");
});

}
}
catch (fc::exception &e) {
Expand Down

0 comments on commit 68b739d

Please sign in to comment.