Description of problem: The database connection tests do not pass if run by themselves. Version-Release number of selected component (if applicable): master How reproducible: Every time. Steps to Reproduce: 1. $ nosetests -sx server/test/unit/server/db/test_connection.py Actual results: $ nosetests -sx server/test/unit/server/db/test_connection.py ......F ====================================================================== FAIL: test_initialize_username_and_password (unit.server.db.test_connection.TestDatabaseAuthentication) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/mock.py", line 1201, in patched return func(*args, **keywargs) File "/home/rbarlow/devel/pulp/server/test/unit/server/db/test_connection.py", line 327, in test_initialize_username_and_password max_pool_size=10, port=27017) File "/usr/lib/python2.7/site-packages/mock.py", line 846, in assert_called_once_with return self.assert_called_with(*args, **kwargs) File "/usr/lib/python2.7/site-packages/mock.py", line 835, in assert_called_with raise AssertionError(msg) AssertionError: Expected call: connect('pulp_unittest', username='admin', host='localhost', password='admin', max_pool_size=10, port=27017) Actual call: connect('pulp_database', username='admin', host='localhost', password='admin', max_pool_size=10, port=27017) -------------------- >> begin captured logging << -------------------- pulp.server.db.connection: DEBUG: Attempting username and password authentication. pulp.server.db.connection: DEBUG: Connection Arguments: {'username': 'admin', 'host': 'localhost', 'password': 'admin', 'max_pool_size': 10, 'port': 27017} pulp.server.db.connection: DEBUG: Querying the database to validate the connection. pulp.server.db.connection: INFO: Mongo database for connection is version 2.4.0 --------------------- >> end captured logging << --------------------- ---------------------------------------------------------------------- Ran 7 tests in 0.044s FAILED (failures=1) Expected results: Tests should all pass.
Raising the severity, as this could easily lead to damaging developers' databases.
unassigning this bz from myself for now
This is now damaging developer databases even when run with run-tests.py. A recent commit[0] seems to have shifted the order in which tests are run, and now run-tests.py will delete your development database ☹ I believe this issue is urgent severity now, as this makes it hard to "sprint" when you DB gets deleted all the time ☺ [0] https://github.com/pulp/pulp/commit/70274cf9be047708da930b25f93c9d3f4feb7f78#diff-b63946c4f3426dfd51c0a07586752ab2R325
This bug is about a specific test, but a more general method will be used to fix it. The other refactor [0] will be used to track its resolution. I'm closing this bug indicating it is being tracked upstream. [0]: https://pulp.plan.io/issues/132