Reviewed: https://review.openstack.org/275815 Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=57321d5a1adab07798ad554a922f631c1cd99ce1 Submitter: Jenkins Branch: master
commit 57321d5a1adab07798ad554a922f631c1cd99ce1 Author: Victor Stinner <[email protected]> Date: Wed Feb 3 17:35:16 2016 +0100 Fix _wait_on_task_execution() Attempt to fix a race condition in test_all_task_api of glance.tests.integration.v2.test_tasks_api.TestTasksApi. _wait_on_task_execution() must use eventlet.sleep() instead of time.sleep() to give control to the pending server task, instead of blocking the whole process. Note: The time module is not monkey-patched, so time.sleep() really hangs the current thread for the specified duration. For an unknown reason, the test pass in most cases, but always fail with testtools. Change-Id: I785a7cf0d556ad72c443946adac3b4f5f361edd8 Closes-Bug: #1541487 ** Changed in: glance Status: New => Fix Released -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to Glance. https://bugs.launchpad.net/bugs/1541487 Title: glance.tests.integration.v2.test_tasks_api.TestTasksApi.test_all_task_api hangs when run with testtools Status in Glance: Fix Released Bug description: When glance.tests.integration.v2.test_tasks_api is run directly with testtools, the test fails: "python -u -m testtools.run glance.tests.integration.v2.test_tasks_api.TestTasksApi.test_all_task_api" For an unknown reason, the test pass when run with testr: "testr run glance.tests.integration.v2.test_tasks_api.TestTasksApi.test_all_task_api" It looks like the _wait_on_task_execution() method of glance/tests/integration/v2/test_tasks_api.py is not reliable. The method uses time.sleep() to give time to the "server" to execute a task run in background. Problem: in practice, the "server" is in the same process than the client, eventlet is used to scheduled tasks of the server. time.sleep() really blocks the whole process, including the server which is supposed to run the task. Sorry, I'm unable to explain why the test pass with testr, eventlet, taskflow, etc. are too magic for my little brain :-) IMHO we must enable monkey-patch to run Glance unit and integration tests. Or at least, _wait_on_task_execution() must call eventlet.sleep(), not time.sleep(). Note: time.sleep() is not monkey-patched when the test is run with testtools or testr, the test runner doesn't change that. To manage notifications about this bug go to: https://bugs.launchpad.net/glance/+bug/1541487/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : [email protected] Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp

