swh_storage = <MagicMock id='139645739558168'>, up_to_date_graph = False
snapshot = True, release = True
@pytest.mark.graph
@pytest.mark.parametrize(
"snapshot,up_to_date_graph,release",
list(itertools.product([False], [True, False], [False])) # no snp implies no rel
+ list(itertools.product([True], [True, False], [True, False])),
)
def test_graph_revisions(swh_storage, up_to_date_graph, snapshot, release):
from swh.graph.naive_client import NaiveClient as GraphClient
(cnt1, cnt2, dir1, dir2, rev1, rev2, rel2, snp, nodes, edges) = get_objects(
up_to_date_graph, release=release,
)
# Add all objects to storage
swh_storage.content_add([cnt1, cnt2])
swh_storage.directory_add([dir1, dir2])
swh_storage.revision_add([rev1, rev2])
swh_storage.release_add([rel2])
swh_storage.snapshot_add([snp])
# Add spy on swh_storage, to make sure revision_log is not called
# (the graph must be used instead)
swh_storage = unittest.mock.MagicMock(wraps=swh_storage)
# Add all objects to graph
swh_graph = unittest.mock.Mock(wraps=GraphClient(nodes=nodes, edges=edges))
# Cook
backend = InMemoryVaultBackend()
if snapshot:
cooker_name = "snapshot_gitbare"
cooked_id = snp.id
else:
cooker_name = "revision_gitbare"
cooked_id = rev2.id
cooker = GitBareCooker(
cooker_name, cooked_id, backend=backend, storage=swh_storage, graph=swh_graph,
)
cooker.cook()
# Get bundle
> bundle = backend.fetch(cooker_name, cooked_id)
.tox/py3/lib/python3.7/site-packages/swh/vault/tests/test_git_bare_cooker.py:205:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/vault/in_memory_backend.py:22: in fetch
return self._cache.get(obj_type, hash_to_bytes(obj_id))
.tox/py3/lib/python3.7/site-packages/swh/vault/cache.py:27: in get
return self.objstorage.get(hashutil.hash_to_bytes(sid))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <swh.objstorage.backends.in_memory.InMemoryObjStorage object at 0x7f01cf4d36a0>
obj_id = b'\xa4\x82H,\xf4\x13W\x01<\x13\xfd:&0\xfe\x08\x03+\x1df', args = ()
kwargs = {}
def get(self, obj_id, *args, **kwargs):
if obj_id not in self:
> raise ObjNotFoundError(obj_id)
E swh.objstorage.exc.ObjNotFoundError: object not found: b'\xa4\x82H,\xf4\x13W\x01<\x13\xfd:&0\xfe\x08\x03+\x1df'
.tox/py3/lib/python3.7/site-packages/swh/objstorage/backends/in_memory.py:46: ObjNotFoundError
TEST RESULT
TEST RESULT
- Run At
- Aug 5 2021, 12:45 PM