X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/ffb304afad93f50fd6ee43ecda6584dd0ac000c4..10d497fe4eb9ab1dc10171ba90c0c1b148108a35:/sdk/python/tests/test_events.py diff --git a/sdk/python/tests/test_events.py b/sdk/python/tests/test_events.py index 5e1e00608a..f5192160f3 100644 --- a/sdk/python/tests/test_events.py +++ b/sdk/python/tests/test_events.py @@ -1,3 +1,7 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + from __future__ import print_function from __future__ import absolute_import from __future__ import division @@ -59,6 +63,14 @@ class WebsocketTest(run_test_server.TestCaseWithServers): last_log_id=(1 if start_time else None)) self.assertIsInstance(self.ws, expect_type) self.assertEqual(200, events.get(True, 5)['status']) + + if hasattr(self.ws, '_skip_old_events'): + # Avoid race by waiting for the first "find ID threshold" + # poll to finish. + deadline = time.time() + 10 + while not self.ws._skip_old_events: + self.assertLess(time.time(), deadline) + time.sleep(0.1) human = arvados.api('v1').humans().create(body={}).execute() want_uuids = [] @@ -159,7 +171,7 @@ class WebsocketTest(run_test_server.TestCaseWithServers): """Convert minutes-east-of-UTC to RFC3339- and ISO-compatible time zone designator""" return '{:+03d}:{:02d}'.format(offset//60, offset%60) - # Test websocket reconnection on (un)execpted close + # Test websocket reconnection on (un)expected close def _test_websocket_reconnect(self, close_unexpected): run_test_server.authorize_with('active') events = queue.Queue(100)