← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1541487] [NEW] glance.tests.integration.v2.test_tasks_api.TestTasksApi.test_all_task_api hangs when run with testtools

 

Public bug reported:

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.

** Affects: glance
     Importance: Undecided
         Status: New

-- 
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:
  New

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


Follow ups