Change in vdsm[master]: imagetickets: add tests

nsoffer at redhat.com nsoffer at redhat.com
Wed Feb 10 10:40:35 UTC 2016


Nir Soffer has posted comments on this change.

Change subject: imagetickets: add tests
......................................................................


Patch Set 4: Code-Review-1

The tests fail here when ovirt_image_daemon is not installed:

Looking at the failures, it seems that replacing has_image_daemon
with setting uhttp to None will fix this issue:

    try:
        from ovirt_image_daemon import uhttp
    except ImportError:
        uhttp = None

And later check:

    if uhttp is None:

Second issue:

with self.assertRaises(se.ImageDaemonUnsupported):
AttributeError: 'module' object has no attribute 'ImageDaemonUnsupported'

Looks like mistyping of the exception name.

I wonder how did you verify :-)

--

imagetickets_test.TestImageTickets
    test_add_ticket                                             ERROR
    test_extend_ticket                                          ERROR
    test_image_daemon_error('getheader', <function <lambda> at 0x7ff73ec17398>)ERROR
    test_image_daemon_error('read', <function <lambda> at 0x7ff73ec17410>)ERROR
    test_image_daemon_error('read', <function <lambda> at 0x7ff73ec17488>)ERROR
    test_image_tickets_error(<class 'httplib.HTTPException'>)   ERROR
    test_image_tickets_error(<class 'socket.error'>)            ERROR
    test_image_tickets_error(<type 'exceptions.OSError'>)       ERROR
    test_not_supported('add_ticket', [{}])                      ERROR
    test_not_supported('extend_ticket', ['uuid', 300])          ERROR
    test_not_supported('remove_ticket', ['uuid'])               ERROR
    test_remove_ticket                                          ERROR


======================================================================
ERROR: test_add_ticket (imagetickets_test.TestImageTickets)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 133, in wrapper
    return f(*args, **kw)
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 132, in wrapper
    with MonkeyPatchScope([(module, name, that)]):
  File "/usr/lib64/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 108, in MonkeyPatchScope
    patch.apply()
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 63, in apply
    old = getattr(module, name)
AttributeError: 'module' object has no attribute 'uhttp'

======================================================================
ERROR: test_extend_ticket (imagetickets_test.TestImageTickets)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 133, in wrapper
    return f(*args, **kw)
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 132, in wrapper
    with MonkeyPatchScope([(module, name, that)]):
  File "/usr/lib64/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 108, in MonkeyPatchScope
    patch.apply()
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 63, in apply
    old = getattr(module, name)
AttributeError: 'module' object has no attribute 'uhttp'

======================================================================
ERROR: test_image_daemon_error('getheader', <function <lambda> at 0x7ff73ec17398>) (imagetickets_test.TestImageTickets)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/nsoffer/src/vdsm/tests/testlib.py", line 73, in wrapper
    return f(self, *args)
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 133, in wrapper
    return f(*args, **kw)
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 132, in wrapper
    with MonkeyPatchScope([(module, name, that)]):
  File "/usr/lib64/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 108, in MonkeyPatchScope
    patch.apply()
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 63, in apply
    old = getattr(module, name)
AttributeError: 'module' object has no attribute 'uhttp'

======================================================================
ERROR: test_image_daemon_error('read', <function <lambda> at 0x7ff73ec17410>) (imagetickets_test.TestImageTickets)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/nsoffer/src/vdsm/tests/testlib.py", line 73, in wrapper
    return f(self, *args)
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 133, in wrapper
    return f(*args, **kw)
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 132, in wrapper
    with MonkeyPatchScope([(module, name, that)]):
  File "/usr/lib64/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 108, in MonkeyPatchScope
    patch.apply()
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 63, in apply
    old = getattr(module, name)
AttributeError: 'module' object has no attribute 'uhttp'

======================================================================
ERROR: test_image_daemon_error('read', <function <lambda> at 0x7ff73ec17488>) (imagetickets_test.TestImageTickets)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/nsoffer/src/vdsm/tests/testlib.py", line 73, in wrapper
    return f(self, *args)
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 133, in wrapper
    return f(*args, **kw)
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 132, in wrapper
    with MonkeyPatchScope([(module, name, that)]):
  File "/usr/lib64/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 108, in MonkeyPatchScope
    patch.apply()
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 63, in apply
    old = getattr(module, name)
AttributeError: 'module' object has no attribute 'uhttp'

======================================================================
ERROR: test_image_tickets_error(<class 'httplib.HTTPException'>) (imagetickets_test.TestImageTickets)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/nsoffer/src/vdsm/tests/testlib.py", line 73, in wrapper
    return f(self, *args)
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 133, in wrapper
    return f(*args, **kw)
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 132, in wrapper
    with MonkeyPatchScope([(module, name, that)]):
  File "/usr/lib64/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 108, in MonkeyPatchScope
    patch.apply()
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 63, in apply
    old = getattr(module, name)
AttributeError: 'module' object has no attribute 'uhttp'

======================================================================
ERROR: test_image_tickets_error(<class 'socket.error'>) (imagetickets_test.TestImageTickets)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/nsoffer/src/vdsm/tests/testlib.py", line 73, in wrapper
    return f(self, *args)
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 133, in wrapper
    return f(*args, **kw)
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 132, in wrapper
    with MonkeyPatchScope([(module, name, that)]):
  File "/usr/lib64/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 108, in MonkeyPatchScope
    patch.apply()
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 63, in apply
    old = getattr(module, name)
AttributeError: 'module' object has no attribute 'uhttp'

======================================================================
ERROR: test_image_tickets_error(<type 'exceptions.OSError'>) (imagetickets_test.TestImageTickets)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/nsoffer/src/vdsm/tests/testlib.py", line 73, in wrapper
    return f(self, *args)
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 133, in wrapper
    return f(*args, **kw)
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 132, in wrapper
    with MonkeyPatchScope([(module, name, that)]):
  File "/usr/lib64/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 108, in MonkeyPatchScope
    patch.apply()
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 63, in apply
    old = getattr(module, name)
AttributeError: 'module' object has no attribute 'uhttp'

======================================================================
ERROR: test_not_supported('add_ticket', [{}]) (imagetickets_test.TestImageTickets)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/nsoffer/src/vdsm/tests/testlib.py", line 73, in wrapper
    return f(self, *args)
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 133, in wrapper
    return f(*args, **kw)
  File "/home/nsoffer/src/vdsm/tests/imagetickets_test.py", line 82, in test_not_supported
    with self.assertRaises(se.ImageDaemonUnsupported):
AttributeError: 'module' object has no attribute 'ImageDaemonUnsupported'

======================================================================
ERROR: test_not_supported('extend_ticket', ['uuid', 300]) (imagetickets_test.TestImageTickets)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/nsoffer/src/vdsm/tests/testlib.py", line 73, in wrapper
    return f(self, *args)
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 133, in wrapper
    return f(*args, **kw)
  File "/home/nsoffer/src/vdsm/tests/imagetickets_test.py", line 82, in test_not_supported
    with self.assertRaises(se.ImageDaemonUnsupported):
AttributeError: 'module' object has no attribute 'ImageDaemonUnsupported'

======================================================================
ERROR: test_not_supported('remove_ticket', ['uuid']) (imagetickets_test.TestImageTickets)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/nsoffer/src/vdsm/tests/testlib.py", line 73, in wrapper
    return f(self, *args)
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 133, in wrapper
    return f(*args, **kw)
  File "/home/nsoffer/src/vdsm/tests/imagetickets_test.py", line 82, in test_not_supported
    with self.assertRaises(se.ImageDaemonUnsupported):
AttributeError: 'module' object has no attribute 'ImageDaemonUnsupported'

======================================================================
ERROR: test_remove_ticket (imagetickets_test.TestImageTickets)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 133, in wrapper
    return f(*args, **kw)
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 132, in wrapper
    with MonkeyPatchScope([(module, name, that)]):
  File "/usr/lib64/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 108, in MonkeyPatchScope
    patch.apply()
  File "/home/nsoffer/src/vdsm/tests/monkeypatch.py", line 63, in apply
    old = getattr(module, name)
AttributeError: 'module' object has no attribute 'uhttp'

-- 
To view, visit https://gerrit.ovirt.org/52900
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I2728851a91529ec35501f423d9a798af961fb82a
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Amit Aviram <aaviram at redhat.com>
Gerrit-Reviewer: Amit Aviram <aaviram at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
Gerrit-HasComments: No


More information about the vdsm-patches mailing list