Public bug reported:

We run cloud-init's unit tests as part of building packages for Fedora.
Since cc_apt_configure includes an extra entry in its list of mirror
URIs when the system's hostname includes a domain, one of
test_handler_apt_configure_sources_list_v3's tests fails because of that
extra entry:

======================================================================
FAIL: test_apt_v3_mirror_search_dns - Test searching dns patterns
----------------------------------------------------------------------
Traceback (most recent call last):
  File 
"/builddir/build/BUILD/cloud-init-0.7.8/tests/unittests/test_handler/test_handler_apt_source_v3.py",
 line 986, in test_apt_v3_mirror_search_dns
    mockse.assert_has_calls(calls)
  File "/usr/lib64/python3.5/unittest/mock.py", line 824, in assert_has_calls
    ) from cause
AssertionError: Calls not found.
Expected: [call(None), call(['http://ubuntu-mirror.localdomain/ubuntu', 
'http://ubuntu-mirror/ubuntu']), call(None), 
call(['http://ubuntu-security-mirror.localdomain/ubuntu', 
'http://ubuntu-security-mirror/ubuntu'])]
Actual: [call(None),
 call(['http://ubuntu-mirror.devzero.com/ubuntu', 
'http://ubuntu-mirror.localdomain/ubuntu', 'http://ubuntu-mirror/ubuntu']),
 call(None),
 call(['http://ubuntu-security-mirror.devzero.com/ubuntu', 
'http://ubuntu-security-mirror.localdomain/ubuntu', 
'http://ubuntu-security-mirror/ubuntu'])]
-------------------- >> begin captured logging << --------------------
tests.unittests.test_handler.test_handler_apt_configure_sources_list_v3: DEBUG: 
got primary mirror: http://mocked/foo
tests.unittests.test_handler.test_handler_apt_configure_sources_list_v3: DEBUG: 
got security mirror: http://mocked/foo
tests.unittests.test_handler.test_handler_apt_configure_sources_list_v3: DEBUG: 
got primary mirror: http://mocked/foo
tests.unittests.test_handler.test_handler_apt_configure_sources_list_v3: DEBUG: 
got security mirror: http://mocked/foo
cloudinit.util: DEBUG: Reading from /tmp/tmpsfoz_fzy/etc/hosts (quiet=False)
cloudinit.util: DEBUG: Reading from /tmp/tmpsfoz_fzy/etc/hosts (quiet=False)
tests.unittests.test_handler.test_handler_apt_configure_sources_list_v3: DEBUG: 
got primary mirror: phit
cloudinit.util: DEBUG: Reading from /tmp/tmpsfoz_fzy/etc/hosts (quiet=False)
cloudinit.util: DEBUG: Reading from /tmp/tmpsfoz_fzy/etc/hosts (quiet=False)
tests.unittests.test_handler.test_handler_apt_configure_sources_list_v3: DEBUG: 
got security mirror: shit
--------------------- >> end captured logging << ---------------------

I can skip this test because Fedora can't use that module, but I suspect
it would be worthwhile to fix the problem so it doesn't affect distros
that can use it.

** 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/1629149

Title:
  Unit tests fail when run on machines with domains in their hostnames

Status in cloud-init:
  New

Bug description:
  We run cloud-init's unit tests as part of building packages for
  Fedora.  Since cc_apt_configure includes an extra entry in its list of
  mirror URIs when the system's hostname includes a domain, one of
  test_handler_apt_configure_sources_list_v3's tests fails because of
  that extra entry:

  ======================================================================
  FAIL: test_apt_v3_mirror_search_dns - Test searching dns patterns
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File 
"/builddir/build/BUILD/cloud-init-0.7.8/tests/unittests/test_handler/test_handler_apt_source_v3.py",
 line 986, in test_apt_v3_mirror_search_dns
      mockse.assert_has_calls(calls)
    File "/usr/lib64/python3.5/unittest/mock.py", line 824, in assert_has_calls
      ) from cause
  AssertionError: Calls not found.
  Expected: [call(None), call(['http://ubuntu-mirror.localdomain/ubuntu', 
'http://ubuntu-mirror/ubuntu']), call(None), 
call(['http://ubuntu-security-mirror.localdomain/ubuntu', 
'http://ubuntu-security-mirror/ubuntu'])]
  Actual: [call(None),
   call(['http://ubuntu-mirror.devzero.com/ubuntu', 
'http://ubuntu-mirror.localdomain/ubuntu', 'http://ubuntu-mirror/ubuntu']),
   call(None),
   call(['http://ubuntu-security-mirror.devzero.com/ubuntu', 
'http://ubuntu-security-mirror.localdomain/ubuntu', 
'http://ubuntu-security-mirror/ubuntu'])]
  -------------------- >> begin captured logging << --------------------
  tests.unittests.test_handler.test_handler_apt_configure_sources_list_v3: 
DEBUG: got primary mirror: http://mocked/foo
  tests.unittests.test_handler.test_handler_apt_configure_sources_list_v3: 
DEBUG: got security mirror: http://mocked/foo
  tests.unittests.test_handler.test_handler_apt_configure_sources_list_v3: 
DEBUG: got primary mirror: http://mocked/foo
  tests.unittests.test_handler.test_handler_apt_configure_sources_list_v3: 
DEBUG: got security mirror: http://mocked/foo
  cloudinit.util: DEBUG: Reading from /tmp/tmpsfoz_fzy/etc/hosts (quiet=False)
  cloudinit.util: DEBUG: Reading from /tmp/tmpsfoz_fzy/etc/hosts (quiet=False)
  tests.unittests.test_handler.test_handler_apt_configure_sources_list_v3: 
DEBUG: got primary mirror: phit
  cloudinit.util: DEBUG: Reading from /tmp/tmpsfoz_fzy/etc/hosts (quiet=False)
  cloudinit.util: DEBUG: Reading from /tmp/tmpsfoz_fzy/etc/hosts (quiet=False)
  tests.unittests.test_handler.test_handler_apt_configure_sources_list_v3: 
DEBUG: got security mirror: shit
  --------------------- >> end captured logging << ---------------------

  I can skip this test because Fedora can't use that module, but I
  suspect it would be worthwhile to fix the problem so it doesn't affect
  distros that can use it.

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

-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to     : yahoo-eng-team@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to