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

Bug #1704793 reported by Scott Moser
This bug report is a duplicate of:  Bug #1703697: tests fail under python 3.6. Edit Remove
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init
Confirmed
High
Unassigned

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

Scott Moser (smoser)
Changed in cloud-init:
status: New → Confirmed
importance: Undecided → High
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.