test.unit.common.test_db.TestDatabaseBroker - AssertionError: DatabaseError not raised

Bug #1977890 reported by Corey Bryant
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
New
Undecided
Unassigned

Bug Description

$ tox -e py310

====================================================================== FAIL: test_get (test.unit.common.test_db.TestDatabaseBroker) ----------------------------------------------------------------------
Traceback (most recent call last):
  File "/root/swift/test/unit/common/test_db.py", line 845, in test_get with self.assertRaises(sqlite3.DatabaseError) as raised, \
AssertionError: DatabaseError not raised
    'DatabaseError not raised' = <unittest.case._AssertRaisesContext object at 0x7f84506ffb50>.test_case._formatMessage(<unittest.case._AssertRaisesContext object at 0x7f84506ffb50>.'DatabaseError not raised', 'DatabaseError not raised')
>> raise <unittest.case._AssertRaisesContext object at 0x7f84506ffb50>.test_case.failureException('DatabaseError not raised')

I saw this on Ubuntu Kinetic.

--- a/test/unit/common/test_db.py
+++ b/test/unit/common/test_db.py
@@ -842,8 +842,7 @@ class TestDatabaseBroker(unittest.TestCase):
                  os.path.join(dbpath, '1.db'))
             broker = DatabaseBroker(os.path.join(dbpath, '1.db'))
             broker.db_type = 'test'
- with self.assertRaises(sqlite3.DatabaseError) as raised, \
- broker.get() as conn:
+ with broker.get() as conn:
                 conn.execute('SELECT * FROM test')
             self.assertEqual(
                 str(raised.exception),

To get some more details I ran with the patch above:

===================================================================== FAIL: test_get (test.unit.common.test_db.TestDatabaseBroker)
----------------------------------------------------------------------
Traceback (most recent call last): File "/root/swift/test/unit/common/test_db.py", line 848, in test_get
    self.assertEqual(
AssertionError: "DB connection error (/tmp/tmpkbvo93l_/1.[21 chars]xist" != 'Quarantined /tmp/tmpkbvo93l_/dev/dbs/par[74 chars]base' + Quarantined /tmp/tmpkbvo93l_/dev/dbs/par/pre/db to /tmp/tmpkbvo93l_/dev/quarantined/tests/db due to malformed database- DB connection error (/tmp/tmpkbvo93l_/1.db, 0): - DB doesn't exist
    """Fail immediately, with the given message.""" >> raise self.failureException('"DB connection error (/tmp/tmpkbvo93l_/1.[21 chars]xist" != \'Quarantined /tmp/tmpkbvo93l_/dev/dbs/par[74 chars]base\'\n+ Quarantined /tmp/tmpkbvo93l_/dev/dbs/par/pre/db to /tmp/tmpkbvo93l_/dev/quarantined/tests/db due to malformed database- DB connection error (/tmp/tmpkbvo93l_/1.db, 0):\n- DB doesn\'t exist')

It seems the db doesn't exist.

Further checks show the db does exist:
glob output for /tmp/tmphmc65kh6/dev/dbs/par/pre/db/*: ['/tmp/tmphmc65kh6/dev/dbs/par/pre/db/1.db']

However, it almost seems to be attempting to access os.path.join(self.testdir, '1.db') on line 848 instead of os.path.join(dbpath, '1.db').

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.