openstack: nova_utils_tests: Use API timeout argument instead of sleep() 15/51415/1
authorMarkos Chandras <mchandras@suse.de>
Wed, 31 Jan 2018 19:03:43 +0000 (19:03 +0000)
committerMarkos Chandras <mchandras@suse.de>
Wed, 31 Jan 2018 19:08:38 +0000 (19:08 +0000)
commit011c8254e9f9c6f586d8416aaf8be6f807e77e15
tree3047b112ae99f2b49353eccb4c4f37aba4eb1bd6
parentae14510fbc5facbd0bbca7c8d51ddf3d73c7d77e
openstack: nova_utils_tests: Use API timeout argument instead of sleep()

On slow environments, time.sleep(10) is not enough for attach/detach API
calls to propage properly leading to failures like the following one
(reduced api_check test)

2018-01-31 18:53:19,297 - functest.ci.run_tests - INFO - Running test case 'api_check'...
2018-01-31 18:54:27,434 - functest.ci.run_tests - INFO - Test result:

+-------------------+------------------+------------------+----------------+
|     TEST CASE     |     PROJECT      |     DURATION     |     RESULT     |
+-------------------+------------------+------------------+----------------+
|     api_check     |     functest     |      01:07       |      FAIL      |
+-------------------+------------------+------------------+----------------+

We can workaround this by using the nova_utils.{de,at}tach_volume}
'timeout' argument to wait up to 2 minutes for the attach/detach call to
complete. This doesn't affect normal exception whilst it helps get the
test going on slow systems. WIth this change, the api_check (reduced
test) passes as follows:

2018-01-31 18:48:35,469 - functest.ci.run_tests - INFO - Running test case 'api_check'...
2018-01-31 18:50:56,705 - functest.ci.run_tests - INFO - Test result:

+-------------------+------------------+------------------+----------------+
|     TEST CASE     |     PROJECT      |     DURATION     |     RESULT     |
+-------------------+------------------+------------------+----------------+
|     api_check     |     functest     |      02:20       |      PASS      |
+-------------------+------------------+------------------+----------------+

Change-Id: I2245adb84d0e6d4e3350d17d0c2e44baf5202d51
Signed-off-by: Markos Chandras <mchandras@suse.de>
snaps/openstack/utils/tests/nova_utils_tests.py