Change in vdsm[master]: tests: Fix random failures on el6

nsoffer at redhat.com nsoffer at redhat.com
Tue Oct 28 20:57:37 UTC 2014


Nir Soffer has uploaded a new change for review.

Change subject: tests: Fix random failures on el6
......................................................................

tests: Fix random failures on el6

The reject tests were relaying on the behavior in Fedora 20, but on el6
the concurrent reject tests sometimes behaves differently. On Fedora 20,
recv() was always returning an empty string, but on el6, sometimes
socket.error "connection reset by peer" was raised.  Now both results
are considered as disconnection.

Change-Id: I7f6ad16bc2659318be3bb8dde4df5fee07af3417
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
---
M tests/protocoldetectorTests.py
1 file changed, 11 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/73/34573/1

diff --git a/tests/protocoldetectorTests.py b/tests/protocoldetectorTests.py
index bfb06c6..84a4cf1 100644
--- a/tests/protocoldetectorTests.py
+++ b/tests/protocoldetectorTests.py
@@ -18,6 +18,7 @@
 # Refer to the README and COPYING files for full details of the license
 #
 
+import errno
 import socket
 import ssl
 import threading
@@ -165,10 +166,7 @@
     def check_reject(self, use_ssl):
         with self.connect(use_ssl) as client:
             client.sendall("no such protocol\n")
-            if use_ssl:
-                self.assertEqual(client.recv(self.BUFSIZE), '')
-            else:
-                self.assertRaises(socket.error, client.recv, self.BUFSIZE)
+            self.check_disconnected(client)
 
     def check_slow_client(self, use_ssl):
         with self.connect(use_ssl) as client:
@@ -181,7 +179,15 @@
         with self.connect(use_ssl) as client:
             time.sleep(self.acceptor.CLEANUP_INTERVAL * 2)
             client.sendall("echo too slow probably\n")
-            self.assertEqual(client.recv(self.BUFSIZE), '')
+            self.check_disconnected(client)
+
+    def check_disconnected(self, client):
+        try:
+            data = client.recv(self.BUFSIZE)
+        except socket.error as e:
+            self.assertEqual(e.errno, errno.ECONNRESET)
+        else:
+            self.assertEqual(data, '')
 
     # Helpers
 


-- 
To view, visit http://gerrit.ovirt.org/34573
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7f6ad16bc2659318be3bb8dde4df5fee07af3417
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>


More information about the vdsm-patches mailing list