Mercurial > public > mercurial-scm > hg-stable
diff tests/test-wireproto-clientreactor.py @ 37656:e6870bca1f47
wireprotoframing: record when new stream is encountered
Without this, we choke after receiving the 2nd frame in a stream.
Not sure how we made it this far without finding this bug.
Differential Revision: https://phab.mercurial-scm.org/D3334
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Fri, 13 Apr 2018 12:49:47 -0700 |
parents | 55b5ba8d4e68 |
children | cb71e0f9ac6f |
line wrap: on
line diff
--- a/tests/test-wireproto-clientreactor.py Thu Apr 12 13:11:29 2018 -0700 +++ b/tests/test-wireproto-clientreactor.py Fri Apr 13 12:49:47 2018 -0700 @@ -105,6 +105,26 @@ 'unhandled frame type'): sendframe(reactor, ffs(b'1 0 stream-begin text-output 0 foo')) +class StreamTests(unittest.TestCase): + def testmultipleresponseframes(self): + reactor = framing.clientreactor(buffersends=False) + + request, action, meta = reactor.callcommand(b'foo', {}) + + self.assertEqual(action, 'sendframes') + for f in meta['framegen']: + pass + + action, meta = sendframe( + reactor, + ffs(b'%d 0 stream-begin 4 0 foo' % request.requestid)) + self.assertEqual(action, 'responsedata') + + action, meta = sendframe( + reactor, + ffs(b'%d 0 0 4 eos bar' % request.requestid)) + self.assertEqual(action, 'responsedata') + if __name__ == '__main__': import silenttestrunner silenttestrunner.main(__name__)