Rev 3198: (andrew) Cleanly handle connection errors in smart protocol version in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Wed Jan 23 01:58:32 GMT 2008
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3198
revision-id:pqm at pqm.ubuntu.com-20080123015828-qtxnooia7jjqdkbp
parent: pqm at pqm.ubuntu.com-20080123002558-oeppeqc0v0etytb5
parent: andrew.bennetts at canonical.com-20080122221934-zsmjungpdldiz5o7
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2008-01-23 01:58:28 +0000
message:
(andrew) Cleanly handle connection errors in smart protocol version
two (just like version one already does).
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/smart/medium.py medium.py-20061103051856-rgu2huy59fkz902q-1
bzrlib/tests/test_smart_transport.py test_ssh_transport.py-20060608202016-c25gvf1ob7ypbus6-2
------------------------------------------------------------
revno: 3195.2.2
revision-id:andrew.bennetts at canonical.com-20080122221934-zsmjungpdldiz5o7
parent: andrew.bennetts at canonical.com-20080122065659-yqtin963cx19iokh
committer: Andrew Bennetts <andrew.bennetts at canonical.com>
branch nick: tidy-smart-tests
timestamp: Wed 2008-01-23 09:19:34 +1100
message:
Add NEWS entry.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
------------------------------------------------------------
revno: 3195.2.1
revision-id:andrew.bennetts at canonical.com-20080122065659-yqtin963cx19iokh
parent: pqm at pqm.ubuntu.com-20080122004623-p8kb5y8dehs5cmho
committer: Andrew Bennetts <andrew.bennetts at canonical.com>
branch nick: tidy-smart-tests
timestamp: Tue 2008-01-22 17:56:59 +1100
message:
Improve test coverage, and fix a bug revealed by the improved coverage.
modified:
bzrlib/smart/medium.py medium.py-20061103051856-rgu2huy59fkz902q-1
bzrlib/tests/test_smart_transport.py test_ssh_transport.py-20060608202016-c25gvf1ob7ypbus6-2
=== modified file 'NEWS'
--- a/NEWS 2008-01-23 00:25:58 +0000
+++ b/NEWS 2008-01-23 01:58:28 +0000
@@ -44,6 +44,9 @@
* Calculate remote path relative to the shared medium in _SmartClient. This
is related to the problem in bug #124089. (Andrew Bennetts)
+ * Cleanly handle connection errors in smart protocol version two, the same
+ way as they are handled by version one. (Andrew Bennetts)
+
* ``reconfigure`` can safely be interrupted while fetching.
(Aaron Bentley, #179316)
=== modified file 'bzrlib/smart/medium.py'
--- a/bzrlib/smart/medium.py 2008-01-15 00:59:12 +0000
+++ b/bzrlib/smart/medium.py 2008-01-22 06:56:59 +0000
@@ -358,8 +358,10 @@
new_char = self.read_bytes(1)
line += new_char
if new_char == '':
- raise errors.SmartProtocolError(
- 'unexpected end of file reading from server')
+ # end of file encountered reading from server
+ raise errors.ConnectionReset(
+ "please check connectivity and permissions",
+ "(and try -Dhpss if further diagnosis is required)")
return line
=== modified file 'bzrlib/tests/test_smart_transport.py'
--- a/bzrlib/tests/test_smart_transport.py 2008-01-15 05:36:32 +0000
+++ b/bzrlib/tests/test_smart_transport.py 2008-01-22 06:56:59 +0000
@@ -1420,6 +1420,19 @@
self.assertContainsRe(test_log, 'Traceback')
self.assertContainsRe(test_log, 'SmartProtocolError')
+ def test_connection_closed_reporting(self):
+ input = StringIO()
+ output = StringIO()
+ client_medium = medium.SmartSimplePipesClientMedium(input, output)
+ request = client_medium.get_request()
+ smart_protocol = self.client_protocol_class(request)
+ smart_protocol.call('hello')
+ ex = self.assertRaises(errors.ConnectionReset,
+ smart_protocol.read_response_tuple)
+ self.assertEqual("Connection closed: "
+ "please check connectivity and permissions "
+ "(and try -Dhpss if further diagnosis is required)", str(ex))
+
class TestSmartProtocolOne(TestSmartProtocol, CommonSmartProtocolTestMixin):
"""Tests for the smart protocol version one."""
@@ -1455,19 +1468,6 @@
self.assertOffsetSerialisation([(1,2), (3,4), (100, 200)],
'1,2\n3,4\n100,200', self.client_protocol)
- def test_connection_closed_reporting(self):
- input = StringIO()
- output = StringIO()
- client_medium = medium.SmartSimplePipesClientMedium(input, output)
- request = client_medium.get_request()
- smart_protocol = protocol.SmartClientRequestProtocolOne(request)
- smart_protocol.call('hello')
- ex = self.assertRaises(errors.ConnectionReset,
- smart_protocol.read_response_tuple)
- self.assertEqual("Connection closed: "
- "please check connectivity and permissions "
- "(and try -Dhpss if further diagnosis is required)", str(ex))
-
def test_accept_bytes_of_bad_request_to_protocol(self):
out_stream = StringIO()
smart_protocol = protocol.SmartServerRequestProtocolOne(
More information about the bazaar-commits
mailing list