Dan Kenigsberg has uploaded a new change for review.
Change subject: apiTests: silence testMissingSize failure on Python 2.6 ......................................................................
apiTests: silence testMissingSize failure on Python 2.6
I did not delve into the reasons of this, but on Python 2.6, testMissingSize raises socket.error instead of struct.error.
Change-Id: I6d69ec07234c73a884abdc615a33c6b6508b47f5 Signed-off-by: Dan Kenigsberg danken@redhat.com --- M tests/apiTests.py 1 file changed, 7 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/42/9442/1
diff --git a/tests/apiTests.py b/tests/apiTests.py index ff0a785..4100ad0 100644 --- a/tests/apiTests.py +++ b/tests/apiTests.py @@ -25,6 +25,7 @@ import errno import json import struct +import sys
from testrunner import VdsmTestCase as TestCaseBase from vdsm import constants @@ -73,7 +74,6 @@ self.lastFunc = name return self.default
- import sys import imp from new import classobj
@@ -227,7 +227,12 @@ self.assertEquals(4, reply['error']['code'])
def testMissingSize(self): - self.assertRaises(struct.error, self.sendMessage, + if sys.version_info[0:2] == (2, 6): + expectedException = socket.error + else: + expectedException = struct.error + + self.assertRaises(expectedException, self.sendMessage, "malformed message")
def testClientNotJson(self):
-- To view, visit http://gerrit.ovirt.org/9442 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange Gerrit-Change-Id: I6d69ec07234c73a884abdc615a33c6b6508b47f5 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Dan Kenigsberg danken@redhat.com
oVirt Jenkins CI Server has posted comments on this change.
Change subject: apiTests: silence testMissingSize failure on Python 2.6 ......................................................................
Patch Set 1:
Build Started http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/132/ (1/2)
-- To view, visit http://gerrit.ovirt.org/9442 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I6d69ec07234c73a884abdc615a33c6b6508b47f5 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: apiTests: silence testMissingSize failure on Python 2.6 ......................................................................
Patch Set 1:
Build Started http://jenkins.ovirt.org/job/vdsm_unit_tests_manual_gerrit/166/ (2/2)
-- To view, visit http://gerrit.ovirt.org/9442 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I6d69ec07234c73a884abdc615a33c6b6508b47f5 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: apiTests: silence testMissingSize failure on Python 2.6 ......................................................................
Patch Set 1:
Build Successful
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/132/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_manual_gerrit/166/ : SUCCESS
-- To view, visit http://gerrit.ovirt.org/9442 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I6d69ec07234c73a884abdc615a33c6b6508b47f5 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
Dan Kenigsberg has posted comments on this change.
Change subject: apiTests: silence testMissingSize failure on Python 2.6 ......................................................................
Patch Set 1:
before this patch, I'm getting
ERROR: testMissingSize (apiTests.JsonRawTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/dk/vdsm.git/tests/apiTests.py", line 231, in testMissingSize "malformed message") File "/usr/lib64/python2.6/unittest.py", line 335, in failUnlessRaises callableObj(*args, **kwargs) File "/home/dk/vdsm.git/tests/apiTests.py", line 194, in sendMessage data = sock.recv(JsonRawTest._Size.size) error: [Errno 104] Connection reset by peer
-- To view, visit http://gerrit.ovirt.org/9442 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I6d69ec07234c73a884abdc615a33c6b6508b47f5 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Adam Litke agl@us.ibm.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
Adam Litke has posted comments on this change.
Change subject: apiTests: silence testMissingSize failure on Python 2.6 ......................................................................
Patch Set 1: I would prefer that you didn't submit this
Please consider http://gerrit.ovirt.org/9499 as an alternate solution to this issue. Dan, could you check if the change above resolves your problem?
-- To view, visit http://gerrit.ovirt.org/9442 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I6d69ec07234c73a884abdc615a33c6b6508b47f5 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Adam Litke agl@us.ibm.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
ShaoHe Feng has posted comments on this change.
Change subject: apiTests: silence testMissingSize failure on Python 2.6 ......................................................................
Patch Set 1: I would prefer that you didn't submit this
(1 inline comment)
.................................................... File tests/apiTests.py Line 227: self.assertEquals(4, reply['error']['code']) Line 228: Line 229: def testMissingSize(self): Line 230: if sys.version_info[0:2] == (2, 6): Line 231: expectedException = socket.error for python 2.7 the struct.error is raised by 'msgLen = JsonRawTest._Size.unpack(data)[0]'. for python 2.6 the socket.error is raised before ._Size.unpack. probably it is raised by sock.recv.
so it may be raised by sock.connect or sock.sendall. such as , the socket server is not setup, sock.error will also come up. IMO, the scope is big to catch socket.error Exception. Line 232: else: Line 233: expectedException = struct.error Line 234: Line 235: self.assertRaises(expectedException, self.sendMessage,
-- To view, visit http://gerrit.ovirt.org/9442 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I6d69ec07234c73a884abdc615a33c6b6508b47f5 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Adam Litke agl@us.ibm.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: ShaoHe Feng shaohef@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Dan Kenigsberg has abandoned this change.
Change subject: apiTests: silence testMissingSize failure on Python 2.6 ......................................................................
Patch Set 1: Abandoned
to be handled in http://gerrit.ovirt.org/#/c/9499
-- To view, visit http://gerrit.ovirt.org/9442 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: abandon Gerrit-Change-Id: I6d69ec07234c73a884abdc615a33c6b6508b47f5 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Adam Litke agl@us.ibm.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: ShaoHe Feng shaohef@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
vdsm-patches@lists.fedorahosted.org