~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_smart_transport.py

  • Committer: John Arbash Meinel
  • Date: 2009-12-16 20:01:49 UTC
  • mfrom: (4903 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4904.
  • Revision ID: john@arbash-meinel.com-20091216200149-jg71giy0qp27bfv0
Merge bzr.dev 4903, resolve NEWS

Show diffs side-by-side

added added

removed removed

Lines of Context:
2892
2892
        self.assertWriteCount(1)
2893
2893
 
2894
2894
    def test_send_response_with_body_stream_flushes_buffers_sometimes(self):
2895
 
        """When there are many chunks (>100), multiple writes will occur rather
 
2895
        """When there are many bytes (>1MB), multiple writes will occur rather
2896
2896
        than buffering indefinitely.
2897
2897
        """
2898
 
        # Construct a response with stream with 40 chunks in it.  Every chunk
2899
 
        # triggers 3 buffered writes, so we expect > 100 buffered writes, but <
2900
 
        # 200.
2901
 
        body_stream = ['chunk %d' % count for count in range(40)]
 
2898
        # Construct a response with stream with ~1.5MB in it. This should
 
2899
        # trigger 2 writes, but not 3
 
2900
        onekib = '12345678' * 128
 
2901
        body_stream = [onekib] * (1024 + 512)
2902
2902
        response = _mod_request.SuccessfulSmartServerResponse(
2903
2903
            ('arg', 'arg'), body_stream=body_stream)
2904
2904
        self.responder.send_response(response)