Skip to content

Commit 88368da

Browse files
committed
Close client connection once 'ready' message arrives
In our tests when we pretend to be a web browser we were waiting for BinderHub to close the network connection while streaming the response. Because BinderHub waits "a long time" after sending the "ready" message this was slowing down the tests, as they sat around twiddling their thumbs.
1 parent 6efa521 commit 88368da

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

binderhub/tests/test_build.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ async def test_build(app, needs_build, needs_launch, always_build, slug, pytestc
5252
events.append(event)
5353
assert 'message' in event
5454
sys.stdout.write(event['message'])
55+
# this is the signal that everything is ready, pod is launched
56+
# and server is up inside the pod. Break out of the loop now
57+
# because BinderHub keeps the connection open for many seconds
58+
# after to avoid "reconnects" from slow clients
59+
if event.get('phase') == 'ready':
60+
r.close()
61+
break
5562

5663
final = events[-1]
5764
assert 'phase' in final

0 commit comments

Comments
 (0)