← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1630420] [NEW] test_rescue_config_drive (libvirt driver unit test) isn't mocking genisoimage

 

Public bug reported:

I was running unit tests on a bare bones vm that didn't have genisoimage
installed and the test_rescue_config_drive test failed.

==============================
Failed 1 tests - output below:
==============================

nova.tests.unit.virt.libvirt.test_driver.LibvirtDriverTestCase.test_rescue_config_drive
---------------------------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    Traceback (most recent call last):
      File "nova/tests/unit/virt/libvirt/test_driver.py", line 16420, in test_rescue_config_drive
        instance, exists=lambda name: name != 'disk.config.rescue')
      File "/home/auggy/nova/.tox/py27/local/lib/python2.7/site-packages/mock/mock.py", line 1305, in patched
        return func(*args, **keywargs)
      File "nova/tests/unit/virt/libvirt/test_driver.py", line 16374, in _test_rescue
        network_info, image_meta, rescue_password)
      File "nova/virt/libvirt/driver.py", line 2531, in rescue
        self._create_domain(xml, post_xml_callback=gen_confdrive)
      File "/home/auggy/nova/.tox/py27/local/lib/python2.7/site-packages/mock/mock.py", line 1062, in __call__
        return _mock_self._mock_call(*args, **kwargs)
      File "/home/auggy/nova/.tox/py27/local/lib/python2.7/site-packages/mock/mock.py", line 1128, in _mock_call
        ret_val = effect(*args, **kwargs)
      File "nova/tests/unit/virt/libvirt/test_driver.py", line 16368, in fake_create_domain
        post_xml_callback()
      File "nova/virt/libvirt/driver.py", line 3130, in _create_configdrive
        cdb.make_drive(config_drive_local_path)
      File "nova/virt/configdrive.py", line 143, in make_drive
        self._make_iso9660(path, tmpdir)
      File "nova/virt/configdrive.py", line 97, in _make_iso9660
        run_as_root=False)
      File "nova/utils.py", line 296, in execute
        return processutils.execute(*cmd, **kwargs)
      File "/home/auggy/nova/.tox/py27/local/lib/python2.7/site-packages/oslo_concurrency/processutils.py", line 363, in execute
        env=env_variables)
      File "/home/auggy/nova/.tox/py27/local/lib/python2.7/site-packages/eventlet/green/subprocess.py", line 54, in __init__
        subprocess_orig.Popen.__init__(self, args, 0, *argss, **kwds)
      File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
        errread, errwrite)
      File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
        raise child_exception
    OSError: [Errno 2] No such file or directory


When I installed genisoimage, the test passed.

genisoimage is the default value for mkisofs_cmd (configurable). It's
called in the _make_iso9660 method for creating an image. Besides the
issue of shelling out to a process going beyond the scope of what a unit
test should cover, this also creates a hard dependency on genisoimage.

Other areas in the code mock the call to genisoimage. This test should do something similar.
https://github.com/openstack/nova/blob/master/nova/tests/unit/test_configdrive2.py#L49

** Affects: nova
     Importance: Undecided
         Status: New


** Tags: libvirt testing

** Tags added: libvirt testing

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1630420

Title:
  test_rescue_config_drive (libvirt driver unit test) isn't mocking
  genisoimage

Status in OpenStack Compute (nova):
  New

Bug description:
  I was running unit tests on a bare bones vm that didn't have
  genisoimage installed and the test_rescue_config_drive test failed.

  ==============================
  Failed 1 tests - output below:
  ==============================

  nova.tests.unit.virt.libvirt.test_driver.LibvirtDriverTestCase.test_rescue_config_drive
  ---------------------------------------------------------------------------------------

  Captured traceback:
  ~~~~~~~~~~~~~~~~~~~
      Traceback (most recent call last):
        File "nova/tests/unit/virt/libvirt/test_driver.py", line 16420, in test_rescue_config_drive
          instance, exists=lambda name: name != 'disk.config.rescue')
        File "/home/auggy/nova/.tox/py27/local/lib/python2.7/site-packages/mock/mock.py", line 1305, in patched
          return func(*args, **keywargs)
        File "nova/tests/unit/virt/libvirt/test_driver.py", line 16374, in _test_rescue
          network_info, image_meta, rescue_password)
        File "nova/virt/libvirt/driver.py", line 2531, in rescue
          self._create_domain(xml, post_xml_callback=gen_confdrive)
        File "/home/auggy/nova/.tox/py27/local/lib/python2.7/site-packages/mock/mock.py", line 1062, in __call__
          return _mock_self._mock_call(*args, **kwargs)
        File "/home/auggy/nova/.tox/py27/local/lib/python2.7/site-packages/mock/mock.py", line 1128, in _mock_call
          ret_val = effect(*args, **kwargs)
        File "nova/tests/unit/virt/libvirt/test_driver.py", line 16368, in fake_create_domain
          post_xml_callback()
        File "nova/virt/libvirt/driver.py", line 3130, in _create_configdrive
          cdb.make_drive(config_drive_local_path)
        File "nova/virt/configdrive.py", line 143, in make_drive
          self._make_iso9660(path, tmpdir)
        File "nova/virt/configdrive.py", line 97, in _make_iso9660
          run_as_root=False)
        File "nova/utils.py", line 296, in execute
          return processutils.execute(*cmd, **kwargs)
        File "/home/auggy/nova/.tox/py27/local/lib/python2.7/site-packages/oslo_concurrency/processutils.py", line 363, in execute
          env=env_variables)
        File "/home/auggy/nova/.tox/py27/local/lib/python2.7/site-packages/eventlet/green/subprocess.py", line 54, in __init__
          subprocess_orig.Popen.__init__(self, args, 0, *argss, **kwds)
        File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
          errread, errwrite)
        File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
          raise child_exception
      OSError: [Errno 2] No such file or directory

  
  When I installed genisoimage, the test passed.

  genisoimage is the default value for mkisofs_cmd (configurable). It's
  called in the _make_iso9660 method for creating an image. Besides the
  issue of shelling out to a process going beyond the scope of what a
  unit test should cover, this also creates a hard dependency on
  genisoimage.

  Other areas in the code mock the call to genisoimage. This test should do something similar.
  https://github.com/openstack/nova/blob/master/nova/tests/unit/test_configdrive2.py#L49

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1630420/+subscriptions


Follow ups