← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1380424] [NEW] Missing Mock in test_simple_write_freebsd

 

Public bug reported:

When running the test suite on a Gentoo box (barebones) the following
failure occurs:

======================================================================
FAIL: test_simple_write_freebsd (tests.unittests.test_distros.test_netconfig.TestNetCfgDistro)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/mocker.py", line 149, in test_method_wrapper
    result = test_method()
  File "/var/tmp/portage/app-emulation/cloud-init-0.7.6/work/cloud-init-0.7.6/tests/unittests/test_distros/test_netconfig.py", line 230, in test_simple_write_freebsd
    self.assertCfgEquals(expected_buf, str(write_buf))
  File "/var/tmp/portage/app-emulation/cloud-init-0.7.6/work/cloud-init-0.7.6/tests/unittests/test_distros/test_netconfig.py", line 90, in assertCfgEquals
    self.assertEquals(b1, b2)
AssertionError: {'ifconfig_vtnet0': '192.168.1.5 netmask 255.255.255.0', 'ifconfig_vtnet1': 'DHC [truncated]... != {'ifconfig_eth0': '192.168.1.5 netmask 255.255.255.0', 'ifconfig_eth1': 'DHCP',  [truncated]...
  {'defaultrouter': '192.168.1.254',
-  'ifconfig_vtnet0': '192.168.1.5 netmask 255.255.255.0',
?            ---

+  'ifconfig_eth0': '192.168.1.5 netmask 255.255.255.0',
?              +

-  'ifconfig_vtnet1': 'DHCP'}
?            ---

+  'ifconfig_eth1': 'DHCP'}
?              +

-------------------- >> begin captured logging << --------------------
cloudinit.distros.freebsd: DEBUG: Translating network interface eth1
cloudinit.util: DEBUG: Running command ['ifconfig', '-a'] with allowed return codes [0] (shell=False, capture=True)
cloudinit.distros.freebsd: DEBUG: Using network interface eth1
cloudinit.distros.freebsd: INFO: Configuring interface eth1
cloudinit.distros.freebsd: DEBUG: Checking /etc/rc.conf for: ifconfig_eth1 = DHCP
cloudinit.distros.freebsd: DEBUG: Adding key in /etc/rc.conf: ifconfig_eth1 = DHCP
cloudinit.distros.freebsd: INFO: Writing /etc/rc.conf
cloudinit.distros.freebsd: DEBUG: Translating network interface eth0
cloudinit.util: DEBUG: Running command ['ifconfig', '-a'] with allowed return codes [0] (shell=False, capture=True)
cloudinit.distros.freebsd: DEBUG: Using network interface eth0
cloudinit.distros.freebsd: INFO: Configuring interface eth0
cloudinit.distros.freebsd: DEBUG: Configuring dev eth0 with 192.168.1.5 / 255.255.255.0
cloudinit.distros.freebsd: DEBUG: Checking /etc/rc.conf for: defaultrouter = 192.168.1.254
cloudinit.distros.freebsd: DEBUG: Adding key in /etc/rc.conf: defaultrouter = 192.168.1.254
cloudinit.distros.freebsd: INFO: Writing /etc/rc.conf
cloudinit.distros.freebsd: DEBUG: Checking /etc/rc.conf for: ifconfig_eth0 = 192.168.1.5 netmask 255.255.255.0
cloudinit.distros.freebsd: DEBUG: Adding key in /etc/rc.conf: ifconfig_eth0 = 192.168.1.5 netmask 255.255.255.0
cloudinit.distros.freebsd: INFO: Writing /etc/rc.conf
cloudinit.distros.freebsd: WARNING: Failed to parse /etc/resolv.conf, use new empty file
cloudinit.distros.freebsd: DEBUG: Failed to parse /etc/resolv.conf, use new empty file
Traceback (most recent call last):
  File "/var/tmp/portage/app-emulation/cloud-init-0.7.6/work/cloud-init-0.7.6-python2_7/lib/cloudinit/distros/freebsd.py", line 309, in _write_network
    resolvconf = ResolvConf(util.load_file(self.resolv_conf_fn))
  File "/usr/lib64/python2.7/site-packages/mocker.py", line 1223, in __call__
    return self.__mocker_act__("call", args, kwargs)
  File "/usr/lib64/python2.7/site-packages/mocker.py", line 1184, in __mocker_act__
    return self.__mocker__.act(path)
  File "/usr/lib64/python2.7/site-packages/mocker.py", line 847, in act
    return event.run(path)
  File "/usr/lib64/python2.7/site-packages/mocker.py", line 1694, in run
    task_result = task.run(path)
  File "/usr/lib64/python2.7/site-packages/mocker.py", line 1962, in run
    return self._func(*action.args, **action.kwargs)
  File "/var/tmp/portage/app-emulation/cloud-init-0.7.6/work/cloud-init-0.7.6/tests/unittests/test_distros/test_netconfig.py", line 206, in replace_read
    raise IOError("%s not found" % fname)
IOError: /etc/resolv.conf not found
--------------------- >> end captured logging << ---------------------

Would it be preferable to mock the interaction with /etc/resolv.conf?
If not, why?

** Affects: cloud-init
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1380424

Title:
  Missing Mock in test_simple_write_freebsd

Status in Init scripts for use on cloud images:
  New

Bug description:
  When running the test suite on a Gentoo box (barebones) the following
  failure occurs:

  ======================================================================
  FAIL: test_simple_write_freebsd (tests.unittests.test_distros.test_netconfig.TestNetCfgDistro)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "/usr/lib64/python2.7/site-packages/mocker.py", line 149, in test_method_wrapper
      result = test_method()
    File "/var/tmp/portage/app-emulation/cloud-init-0.7.6/work/cloud-init-0.7.6/tests/unittests/test_distros/test_netconfig.py", line 230, in test_simple_write_freebsd
      self.assertCfgEquals(expected_buf, str(write_buf))
    File "/var/tmp/portage/app-emulation/cloud-init-0.7.6/work/cloud-init-0.7.6/tests/unittests/test_distros/test_netconfig.py", line 90, in assertCfgEquals
      self.assertEquals(b1, b2)
  AssertionError: {'ifconfig_vtnet0': '192.168.1.5 netmask 255.255.255.0', 'ifconfig_vtnet1': 'DHC [truncated]... != {'ifconfig_eth0': '192.168.1.5 netmask 255.255.255.0', 'ifconfig_eth1': 'DHCP',  [truncated]...
    {'defaultrouter': '192.168.1.254',
  -  'ifconfig_vtnet0': '192.168.1.5 netmask 255.255.255.0',
  ?            ---

  +  'ifconfig_eth0': '192.168.1.5 netmask 255.255.255.0',
  ?              +

  -  'ifconfig_vtnet1': 'DHCP'}
  ?            ---

  +  'ifconfig_eth1': 'DHCP'}
  ?              +

  -------------------- >> begin captured logging << --------------------
  cloudinit.distros.freebsd: DEBUG: Translating network interface eth1
  cloudinit.util: DEBUG: Running command ['ifconfig', '-a'] with allowed return codes [0] (shell=False, capture=True)
  cloudinit.distros.freebsd: DEBUG: Using network interface eth1
  cloudinit.distros.freebsd: INFO: Configuring interface eth1
  cloudinit.distros.freebsd: DEBUG: Checking /etc/rc.conf for: ifconfig_eth1 = DHCP
  cloudinit.distros.freebsd: DEBUG: Adding key in /etc/rc.conf: ifconfig_eth1 = DHCP
  cloudinit.distros.freebsd: INFO: Writing /etc/rc.conf
  cloudinit.distros.freebsd: DEBUG: Translating network interface eth0
  cloudinit.util: DEBUG: Running command ['ifconfig', '-a'] with allowed return codes [0] (shell=False, capture=True)
  cloudinit.distros.freebsd: DEBUG: Using network interface eth0
  cloudinit.distros.freebsd: INFO: Configuring interface eth0
  cloudinit.distros.freebsd: DEBUG: Configuring dev eth0 with 192.168.1.5 / 255.255.255.0
  cloudinit.distros.freebsd: DEBUG: Checking /etc/rc.conf for: defaultrouter = 192.168.1.254
  cloudinit.distros.freebsd: DEBUG: Adding key in /etc/rc.conf: defaultrouter = 192.168.1.254
  cloudinit.distros.freebsd: INFO: Writing /etc/rc.conf
  cloudinit.distros.freebsd: DEBUG: Checking /etc/rc.conf for: ifconfig_eth0 = 192.168.1.5 netmask 255.255.255.0
  cloudinit.distros.freebsd: DEBUG: Adding key in /etc/rc.conf: ifconfig_eth0 = 192.168.1.5 netmask 255.255.255.0
  cloudinit.distros.freebsd: INFO: Writing /etc/rc.conf
  cloudinit.distros.freebsd: WARNING: Failed to parse /etc/resolv.conf, use new empty file
  cloudinit.distros.freebsd: DEBUG: Failed to parse /etc/resolv.conf, use new empty file
  Traceback (most recent call last):
    File "/var/tmp/portage/app-emulation/cloud-init-0.7.6/work/cloud-init-0.7.6-python2_7/lib/cloudinit/distros/freebsd.py", line 309, in _write_network
      resolvconf = ResolvConf(util.load_file(self.resolv_conf_fn))
    File "/usr/lib64/python2.7/site-packages/mocker.py", line 1223, in __call__
      return self.__mocker_act__("call", args, kwargs)
    File "/usr/lib64/python2.7/site-packages/mocker.py", line 1184, in __mocker_act__
      return self.__mocker__.act(path)
    File "/usr/lib64/python2.7/site-packages/mocker.py", line 847, in act
      return event.run(path)
    File "/usr/lib64/python2.7/site-packages/mocker.py", line 1694, in run
      task_result = task.run(path)
    File "/usr/lib64/python2.7/site-packages/mocker.py", line 1962, in run
      return self._func(*action.args, **action.kwargs)
    File "/var/tmp/portage/app-emulation/cloud-init-0.7.6/work/cloud-init-0.7.6/tests/unittests/test_distros/test_netconfig.py", line 206, in replace_read
      raise IOError("%s not found" % fname)
  IOError: /etc/resolv.conf not found
  --------------------- >> end captured logging << ---------------------

  Would it be preferable to mock the interaction with /etc/resolv.conf?
  If not, why?

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1380424/+subscriptions


Follow ups

References