test: worker.py: Unflake test_webinterface test.

The test was flaky when the "Ping" command (issued through the web interface) was still being executed while we already assumed that it was done. This happened very rarely e.g. 1 out of 1000 times.
This commit is contained in:
Michael Berlin 2016-06-27 15:39:02 -07:00
Родитель 53de75e7b1
Коммит ea1b667d0a
1 изменённых файлов: 5 добавлений и 0 удалений

Просмотреть файл

@ -588,6 +588,11 @@ class TestVtworkerWebinterface(unittest.TestCase):
raise Exception('Should have thrown an HTTPError for the redirect.')
except urllib2.HTTPError as e:
self.assertEqual(e.code, 307)
# Wait for the Ping command to finish.
utils.poll_for_vars(
'vtworker', self.worker_port,
'WorkerState == done',
condition_fn=lambda v: v.get('WorkerState') == 'done')
# Verify that the command logged something and its available at /status.
status = urllib2.urlopen(worker_base_url + '/status').read()
self.assertIn(