cassandra tests are failing in the swh-environment build
the swh-environment tests are failing with this error: Copied from https://jenkins.softwareheritage.org/job/DENV/job/tests/1884/consoleFull
20:27:51 ____________ TestCassandraStorage.test_directory_add_atomic[batch] _____________
20:27:51
20:27:51 self = <swh.storage.tests.test_cassandra.TestCassandraStorage object at 0x7fcef54fb5c0>
20:27:51 swh_storage = <swh.storage.cassandra.storage.CassandraStorage object at 0x7fcec52eae80>
20:27:51 sample_data = <swh.storage.tests.storage_data.StorageData object at 0x7fcec0724a58>
20:27:51 mocker = <pytest_mock.plugin.MockerFixture object at 0x7fcec0724588>
20:27:51 insert_algo = 'batch'
20:27:51
20:27:51 @pytest.mark.parametrize("insert_algo", DIRECTORY_ENTRIES_INSERT_ALGOS)
20:27:51 def test_directory_add_atomic(self, swh_storage, sample_data, mocker, insert_algo):
20:27:51 """Checks that a crash occurring after some directory entries were written
20:27:51 does not cause the directory to be (partially) visible.
20:27:51 ie. checks directories are added somewhat atomically."""
20:27:51 # Disable the journal writer, it would detect the CrashyEntry exception too
20:27:51 # early for this test to be relevant
20:27:51 swh_storage.journal_writer.journal = None
20:27:51 mocker.patch.object(swh_storage, "_directory_entries_insert_algo", insert_algo)
20:27:51
20:27:51 class CrashyEntry(DirectoryEntry):
20:27:51 def __init__(self):
20:27:51 pass
20:27:51
20:27:51 def to_dict(self):
20:27:51 return {**directory.entries[0].to_dict(), "perms": "abcde"}
20:27:51
20:27:51 directory = self._directory_with_entries(sample_data, BATCH_INSERT_MAX_SIZE)
20:27:51 entries = directory.entries
20:27:51 > directory = attr.evolve(directory, entries=entries + (CrashyEntry(),))
20:27:51
20:27:51 swh/storage/tests/test_cassandra.py:550:
20:27:51 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
20:27:51 ../.venv/lib/python3.7/site-packages/attr/_funcs.py:343: in evolve
20:27:51 return cls(**changes)
20:27:51 <attrs generated init swh.model.model.Directory>:6: in __init__
20:27:51 __attr_validator_entries(self, __attr_entries, self.entries)
20:27:51 ../.venv/lib/python3.7/site-packages/attr/_make.py:2975: in __call__
20:27:51 v(inst, attr, value)
20:27:51 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
20:27:51
20:27:51 self = <[TypeError("a bytes-like object is required, not '_Nothing'") raised in repr()] Directory object at 0x7fcfec1c1248>
20:27:51 attribute = Attribute(name='entries', default=NOTHING, validator=_AndValidator(_validators=(<function type_validator.<locals>.vali...ype=typing.Tuple[swh.model.model.DirectoryEntry, ...], converter=None, kw_only=False, inherited=False, on_setattr=None)
20:27:51 value = (DirectoryEntry(name=b'file 0', type='file', target=hash_to_bytes('d81cc0710eb6cf9efd5b920a8453e1e07157b6cd'),...=b'file 5', type='file', target=hash_to_bytes('d81cc0710eb6cf9efd5b920a8453e1e07157b6cd'), perms=0o40000), ...)
20:27:51
20:27:51 @entries.validator
20:27:51 def check_entries(self, attribute, value):
20:27:51 seen = set()
20:27:51 for entry in value:
20:27:51 > if entry.name in seen:
20:27:51 E AttributeError: name
20:27:51
20:27:51 ../swh-model/swh/model/model.py:796: AttributeError
Migrated from T3776 (view on Phabricator)