[xBBxMERGE] Fix test suite regression on OSX in TestReadMergeableFromUrl.test_smart_server_connection_reset.
Vincent Ladeuil
v.ladeuil+lp at free.fr
Thu Oct 2 14:47:47 BST 2008
>>>>> "Andrew" == Andrew Bennetts <andrew at canonical.com> writes:
Andrew> Andrew Bennetts has voted tweak.
Andrew> Status is now: Conditionally approved
Andrew> Comment:
Andrew> A test for this would be nice.
Reminder: this test failed on OS X and prompted me to propose
this fix :-)
Andrew> I think you could probably make a good one using the
Andrew> _DisconnectingTCPServer in test_bundle.
I think so too :)
But as said on IRC, I will look into doing the same for other
smart mediums.
...
Well, that doesn't work as expected to say the least. Roughly
speaking the model you used for _DisconnectingTCPServer doesn't
work for http (even if test_http.WallServer existed and provides
the same service than _DisconnectingTCPServer), since errors are
handled in two different phases:
- the request headers handling (i.e. during get()),
- the body reading handling (i.e during subsequent read()).
The equivalent phases are handled the same way for bzr over TCP
since all bytes are read via read_bytes.
But for http, the connection reset is already either a
ConnectionError or an InvalidHttpResponse in the headers phase
where read_bytes is not involved at all.
So I'm back at my earlier question (in what circumstances is the
smart server involved in reading a *bundle*) but waiting for a
higher level answer to understand why it is used that way.
Because it seems to me that special casing ConnectionReset like
you did will lead to more collisions down the road.
I'll merge the previous fix to avoid OSX support bitrot but I
think we should keep discussing and complete that fix.
I think there is more than appears behind this collision between
hpss and http:
- http lacks some error handling in the body reading phase (but
since it provides a file-like for the body to upper layers, it
need help from upper layers),
- we may need to define more specific (regarding causes) and more
generic (regarding the medium involved, be it http, ssh, or raw
TCP) exceptions to unify the error handling (the except clauses
in bundle.read_mergeable_from_transport start to become
impressive, speaking of which jam made a comment there
regarding sftp which is close to the problem I just encountered
(exception during get() or exception during read()).
Vincent
More information about the bazaar
mailing list