[openstack-dev] [Fuel] fake threads in tests

Jay Pipes jaypipes at gmail.com
Mon Feb 16 12:55:24 UTC 2015


On 02/16/2015 06:54 AM, Przemyslaw Kaminski wrote:
> Hello,
>
> This somehow relates to [1]: in integration tests we have a class
> called FakeThread. It is responsible for spawning threads to simulate
> asynchronous tasks in fake env. In BaseIntegrationTest class we have a
> method called _wait_for_threads that waits for all fake threads to
> terminate.
>
> In my understanding what these things actually do is that they just
> simulate Astute's responses. I'm thinking if this could be replaced by
> a better solution, I just want to start a discussion on the topic.
>
> My suggestion is to get rid of all this stuff and implement a
> predictable solution: something along promises or coroutines that
> would execute synchronously. With either promises or coroutines we
> could simulate tasks responses any way we want without the need to
> wait using unpredictable stuff like sleeping, threading and such. No
> need for waiting or killing threads. It would hopefully make our tests
> easier to debug and get rid of the random errors that are sometimes
> getting into our master branch.

Hi!

For integration/functional tests, why bother faking out the threads at 
all? Shouldn't the integration tests be functionally testing the real 
code, not mocked or faked stuff?

Best,
-jay



More information about the OpenStack-dev mailing list