comparison 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
comparison
equal deleted inserted replaced
37655:b9502b5f2066 37656:e6870bca1f47
103 103
104 with self.assertRaisesRegexp(error.ProgrammingError, 104 with self.assertRaisesRegexp(error.ProgrammingError,
105 'unhandled frame type'): 105 'unhandled frame type'):
106 sendframe(reactor, ffs(b'1 0 stream-begin text-output 0 foo')) 106 sendframe(reactor, ffs(b'1 0 stream-begin text-output 0 foo'))
107 107
108 class StreamTests(unittest.TestCase):
109 def testmultipleresponseframes(self):
110 reactor = framing.clientreactor(buffersends=False)
111
112 request, action, meta = reactor.callcommand(b'foo', {})
113
114 self.assertEqual(action, 'sendframes')
115 for f in meta['framegen']:
116 pass
117
118 action, meta = sendframe(
119 reactor,
120 ffs(b'%d 0 stream-begin 4 0 foo' % request.requestid))
121 self.assertEqual(action, 'responsedata')
122
123 action, meta = sendframe(
124 reactor,
125 ffs(b'%d 0 0 4 eos bar' % request.requestid))
126 self.assertEqual(action, 'responsedata')
127
108 if __name__ == '__main__': 128 if __name__ == '__main__':
109 import silenttestrunner 129 import silenttestrunner
110 silenttestrunner.main(__name__) 130 silenttestrunner.main(__name__)