Rev 5426: Fix random test_bad_connection_ssh failures in file:///home/vila/src/bzr/bugs/601804-test-bad-connection-ssh/

Vincent Ladeuil v.ladeuil+lp at free.fr
Wed Sep 15 11:10:22 BST 2010


At file:///home/vila/src/bzr/bugs/601804-test-bad-connection-ssh/

------------------------------------------------------------
revno: 5426
revision-id: v.ladeuil+lp at free.fr-20100915101022-6735yj2z0b70vqvb
parent: pqm at pqm.ubuntu.com-20100914163122-geipr89d2myl2299
fixes bug(s): https://launchpad.net/bugs/601804
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 601804-test-bad-connection-ssh
timestamp: Wed 2010-09-15 12:10:22 +0200
message:
  Fix random test_bad_connection_ssh failures
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2010-09-14 09:29:57 +0000
+++ b/NEWS	2010-09-15 10:10:22 +0000
@@ -286,6 +286,10 @@
 Testing
 *******
 
+* Catch socket errors to avoid
+  bt.test_sftp_transport.SSHVendorBadConnection.test_bad_connection_ssh
+  random failures. (Vincent Ladeuil, #601804)
+
 * HTTP test servers will leak less threads (and sockets) and will not hang on
   AIX anymore. (Vincent Ladeuil, #405745)
 

=== modified file 'bzrlib/transport/ssh.py'
--- a/bzrlib/transport/ssh.py	2010-09-09 07:31:02 +0000
+++ b/bzrlib/transport/ssh.py	2010-09-15 10:10:22 +0000
@@ -377,7 +377,7 @@
             return SFTPClient(SocketAsChannelAdapter(sock))
         except _sftp_connection_errors, e:
             self._raise_connection_error(host, port=port, orig_error=e)
-        except (OSError, IOError), e:
+        except (OSError, IOError, socket.error), e:
             # If the machine is fast enough, ssh can actually exit
             # before we try and send it the sftp request, which
             # raises a Broken Pipe
@@ -392,7 +392,7 @@
             return self._connect(argv)
         except (EOFError), e:
             self._raise_connection_error(host, port=port, orig_error=e)
-        except (OSError, IOError), e:
+        except (OSError, IOError, socket.error), e:
             # If the machine is fast enough, ssh can actually exit
             # before we try and send it the sftp request, which
             # raises a Broken Pipe



More information about the bazaar-commits mailing list