← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1704793] [NEW] tests_simple.py has side effects, allows test_create_users to pass when it should not.

 

*** This bug is a duplicate of bug 1703697 ***
    https://bugs.launchpad.net/bugs/1703697

Public bug reported:

test_simple_run.py has some side effects, and makes test_create_users.py (and possibly others) succeed when they should not.
This was found when looking at bug 1704024.  It seems that python 3.6 ends
up iterating through tests in a different order than 3.5.

$ python3 -m nose tests/unittests/test_runs/test_simple_run.py tests/unittests/test_distros/test_create_users.py
..........
----------------------------------------------------------------------
Ran 10 tests in 0.065s

OK

$ python3 -m nose tests/unittests/test_distros/test_create_users.pyF........
======================================================================
FAIL: test_basic (tests.unittests.test_distros.test_create_users.TestCreateUser)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/mock/mock.py", line 1305, in patched
    return func(*args, **keywargs)
  File "/home/smoser-public/src/cloud-init/cloud-init/tests/unittests/test_distros/test_create_users.py", line 63, in test_basic
    mock.call(['passwd', '-l', user])])
AssertionError: [call(['systemd-detect-virt', '--quiet', '--conta[116 chars]r'])] != [call(['useradd', 'foouser', '-m'], logstring=['u[57 chars]r'])]
-------------------- >> begin captured logging << --------------------
cloudinit.util: DEBUG: Reading from /etc/os-release (quiet=True)
cloudinit.util: DEBUG: Read 407 bytes from /etc/os-release
cloudinit.util: DEBUG: Reading from /proc/1/cmdline (quiet=False)
cloudinit.util: DEBUG: Read 47 bytes from /proc/1/cmdline
cloudinit.util: DEBUG: Reading from /etc/system-image/channel.ini (quiet=True)
cloudinit.util: DEBUG: Read 0 bytes from /etc/system-image/channel.ini
cloudinit.distros: DEBUG: Adding user foouser
--------------------- >> end captured logging << ---------------------

----------------------------------------------------------------------
Ran 9 tests in 0.023s

FAILED (failures=1)


Related bugs:
 * bug 1704024: tox fails under python 3.6

** Affects: cloud-init
     Importance: High
         Status: Confirmed

** Changed in: cloud-init
       Status: New => Confirmed

** Changed in: cloud-init
   Importance: Undecided => High

** This bug has been marked a duplicate of bug 1703697
   tox fails under python 3.6

-- 
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/1704793

Title:
  tests_simple.py has side effects, allows test_create_users to pass
  when it should not.

Status in cloud-init:
  Confirmed

Bug description:
  test_simple_run.py has some side effects, and makes test_create_users.py (and possibly others) succeed when they should not.
  This was found when looking at bug 1704024.  It seems that python 3.6 ends
  up iterating through tests in a different order than 3.5.

  $ python3 -m nose tests/unittests/test_runs/test_simple_run.py tests/unittests/test_distros/test_create_users.py
  ..........
  ----------------------------------------------------------------------
  Ran 10 tests in 0.065s

  OK

  $ python3 -m nose tests/unittests/test_distros/test_create_users.pyF........
  ======================================================================
  FAIL: test_basic (tests.unittests.test_distros.test_create_users.TestCreateUser)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/mock/mock.py", line 1305, in patched
      return func(*args, **keywargs)
    File "/home/smoser-public/src/cloud-init/cloud-init/tests/unittests/test_distros/test_create_users.py", line 63, in test_basic
      mock.call(['passwd', '-l', user])])
  AssertionError: [call(['systemd-detect-virt', '--quiet', '--conta[116 chars]r'])] != [call(['useradd', 'foouser', '-m'], logstring=['u[57 chars]r'])]
  -------------------- >> begin captured logging << --------------------
  cloudinit.util: DEBUG: Reading from /etc/os-release (quiet=True)
  cloudinit.util: DEBUG: Read 407 bytes from /etc/os-release
  cloudinit.util: DEBUG: Reading from /proc/1/cmdline (quiet=False)
  cloudinit.util: DEBUG: Read 47 bytes from /proc/1/cmdline
  cloudinit.util: DEBUG: Reading from /etc/system-image/channel.ini (quiet=True)
  cloudinit.util: DEBUG: Read 0 bytes from /etc/system-image/channel.ini
  cloudinit.distros: DEBUG: Adding user foouser
  --------------------- >> end captured logging << ---------------------

  ----------------------------------------------------------------------
  Ran 9 tests in 0.023s

  FAILED (failures=1)

  
  Related bugs:
   * bug 1704024: tox fails under python 3.6

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