# Async Data Fetch and Testing

**URL:** <https://discuss.elastic.co/t/async-data-fetch-and-testing/87809>\
**Category:** Elasticsearch\
**Created:** [May 31, 2017, 9:06pm UTC](https://discuss.elastic.co/t/async-data-fetch-and-testing/87809 "2017-05-31T21:06:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![droman](https://avatars.discourse-cdn.com/v4/letter/d/e99b99/32.png) [@droman](https://discuss.elastic.co/u/droman)\
**Post date:** [May 31, 2017, 9:06pm UTC](https://discuss.elastic.co/t/async-data-fetch-and-testing/87809/1 "2017-05-31T21:06:36Z")

</div>

Hi,

I am trying to test some code that gets data from Elastic Search. I am using Python. The problem is that my code seems to run asynchronously, so when I try to assert the data fetched the test fails because I has not retrieved the data yet.

Currently, we are setting up a waiting time before the assertion to solve this.

I would like to know if anybody solved this in a more precise way.

Thanks

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 28, 2017, 9:06pm UTC](https://discuss.elastic.co/t/async-data-fetch-and-testing/87809/2 "2017-06-28T21:06:43Z")

</div>

Closed on June 28, 2017, 9:06pm UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
