cache: move 3.x data objects into files/md5/ prefix

This commit is contained in:
Peter Rowlands
2023-06-09 15:49:44 +03:00
committed by Ruslan Kuprieiev
parent 528eab0418
commit 603f5fdba1
22 changed files with 195 additions and 70 deletions
+19 -7
View File
@@ -17,7 +17,7 @@ def test_get_url_external(tmp_dir, erepo_dir, cloud):
# Using file url to force clone to tmp repo
repo_url = f"file://{erepo_dir.as_posix()}"
expected_url = (cloud / "ac/bd18db4cc2f85cedef654fccc4a4d8").url
expected_url = (cloud / "files" / "md5" / "ac/bd18db4cc2f85cedef654fccc4a4d8").url
assert api.get_url("foo", repo=repo_url) == expected_url
@@ -166,16 +166,24 @@ def test_get_url_granular(tmp_dir, dvc, cloud):
tmp_dir.add_remote(config=cloud.config)
tmp_dir.dvc_gen({"dir": {"foo": "foo", "bar": "bar", "nested": {"file": "file"}}})
expected_url = (cloud / "5f" / "c28ea78987408341668eba6525ebd1.dir").url
expected_url = (
cloud / "files" / "md5" / "5f" / "c28ea78987408341668eba6525ebd1.dir"
).url
assert api.get_url("dir") == expected_url
expected_url = (cloud / "ac" / "bd18db4cc2f85cedef654fccc4a4d8").url
expected_url = (
cloud / "files" / "md5" / "ac" / "bd18db4cc2f85cedef654fccc4a4d8"
).url
assert api.get_url("dir/foo") == expected_url
expected_url = (cloud / "37" / "b51d194a7513e45b56f6524f2d51f2").url
expected_url = (
cloud / "files" / "md5" / "37" / "b51d194a7513e45b56f6524f2d51f2"
).url
assert api.get_url("dir/bar") == expected_url
expected_url = (cloud / "8c" / "7dd922ad47494fc02c388e12c00eac").url
expected_url = (
cloud / "files" / "md5" / "8c" / "7dd922ad47494fc02c388e12c00eac"
).url
assert api.get_url(os.path.join("dir", "nested", "file")) == expected_url
@@ -186,10 +194,14 @@ def test_get_url_subrepos(tmp_dir, scm, local_cloud):
subrepo.dvc_gen({"dir": {"foo": "foo"}, "bar": "bar"}, commit="add files")
subrepo.dvc.push()
expected_url = os.fspath(local_cloud / "ac" / "bd18db4cc2f85cedef654fccc4a4d8")
expected_url = os.fspath(
local_cloud / "files" / "md5" / "ac" / "bd18db4cc2f85cedef654fccc4a4d8"
)
assert api.get_url(os.path.join("subrepo", "dir", "foo")) == expected_url
expected_url = os.fspath(local_cloud / "37" / "b51d194a7513e45b56f6524f2d51f2")
expected_url = os.fspath(
local_cloud / "files" / "md5" / "37" / "b51d194a7513e45b56f6524f2d51f2"
)
assert api.get_url("subrepo/bar") == expected_url