Rev 4892: Change the test that expected 100 writes to flush, to make it based on content size. in http://bazaar.launchpad.net/~jameinel/bzr/2.1.0b4-proto3-buffering

John Arbash Meinel john at arbash-meinel.com
Wed Dec 16 17:28:03 GMT 2009


At http://bazaar.launchpad.net/~jameinel/bzr/2.1.0b4-proto3-buffering

------------------------------------------------------------
revno: 4892
revision-id: john at arbash-meinel.com-20091216172749-sgr2ehcbi9efmauv
parent: john at arbash-meinel.com-20091215221709-h01xw9ud6r7xoc5p
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.1.0b4-proto3-buffering
timestamp: Wed 2009-12-16 11:27:49 -0600
message:
  Change the test that expected 100 writes to flush, to make it based on content size.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_smart_transport.py'
--- a/bzrlib/tests/test_smart_transport.py	2009-10-27 06:30:37 +0000
+++ b/bzrlib/tests/test_smart_transport.py	2009-12-16 17:27:49 +0000
@@ -2892,13 +2892,13 @@
         self.assertWriteCount(1)
 
     def test_send_response_with_body_stream_flushes_buffers_sometimes(self):
-        """When there are many chunks (>100), multiple writes will occur rather
+        """When there are many bytes (>1MB), multiple writes will occur rather
         than buffering indefinitely.
         """
-        # Construct a response with stream with 40 chunks in it.  Every chunk
-        # triggers 3 buffered writes, so we expect > 100 buffered writes, but <
-        # 200.
-        body_stream = ['chunk %d' % count for count in range(40)]
+        # Construct a response with stream with ~1.5MB in it. This should
+        # trigger 2 writes, but not 3
+        onekib = '12345678' * 128
+        body_stream = [onekib] * (1024 + 512)
         response = _mod_request.SuccessfulSmartServerResponse(
             ('arg', 'arg'), body_stream=body_stream)
         self.responder.send_response(response)



More information about the bazaar-commits mailing list