Page MenuHomeSoftware Heritage

Jenkins > .tox.py3.lib.python3.7.site-packages.swh.storage.tests.test_cassandra.TestCassandraStorage::test_directory_add_atomic
Failed

TEST RESULT

Run At
Aug 26 2021, 11:53 AM
Details
self = <swh.storage.tests.test_cassandra.TestCassandraStorage object at 0x7f2a623dcd68> swh_storage = <swh.storage.cassandra.storage.CassandraStorage object at 0x7f2a5e9f17b8> sample_data = <swh.storage.tests.storage_data.StorageData object at 0x7f2a5e9eef98> mocker = <pytest_mock.plugin.MockerFixture object at 0x7f2a5e9eec88> def test_directory_add_atomic(self, swh_storage, sample_data, mocker): """Checks that a crash occurring after some directory entries were written does not cause the directory to be (partially) visible. ie. checks directories are added somewhat atomically.""" # Disable the journal writer, it would detect the CrashyEntry exception too # early for this test to be relevant swh_storage.journal_writer.journal = None class MyException(Exception): pass class CrashyEntry(DirectoryEntry): def __init__(self): pass def to_dict(self): raise MyException() directory = sample_data.directory3 entries = directory.entries directory = attr.evolve(directory, entries=entries + (CrashyEntry(),)) with pytest.raises(MyException): swh_storage.directory_add([directory]) # This should have written some of the entries to the database: entry_rows = swh_storage._cql_runner.directory_entry_get([directory.id]) > assert {row.name for row in entry_rows} == {entry.name for entry in entries} E AssertionError: assert set() == {b'foo', b'hello', b'subdir'} E Extra items in the right set: E b'subdir' E b'foo' E b'hello' E Full diff: E - {b'foo', b'hello', b'subdir'} E + set() .tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_cassandra.py:516: AssertionError