mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-19 15:28:28 +01:00
dvc: include cache urls in info output. (#4848)
* dvc: include cache urls in info output. Show cache urls for external and remote cache in the info output to assist in diagnosis of issues. Fixes #4574. * Remove unnecessary constant check for generator expression. * Add remotes and caches in version command for better diagnosis. * Fix flaky unit test to be runtime independent by using regex search. * Use Cache.by_scheme() for enumerating supported caches. * Add get_cloud_schemes routine for retrieval of configured remote schemes. Add tests for local remote and remote:// scheme for info. * Cleanup unused code. * info: refactor remote parsing Co-authored-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
co-authored by
Ruslan Kuprieiev
parent
251a3269c2
commit
6324bd8a69
@@ -11,4 +11,6 @@ def test_(tmp_dir, dvc, scm, caplog):
|
||||
assert re.search(f"Platform: {PYTHON_VERSION_REGEX} on .*", caplog.text)
|
||||
assert re.search(r"Supports: .*", caplog.text)
|
||||
assert re.search(r"Cache types: .*", caplog.text)
|
||||
assert re.search(r"Caches: local", caplog.text)
|
||||
assert re.search(r"Remotes: None", caplog.text)
|
||||
assert "Repo: dvc, git" in caplog.text
|
||||
|
||||
@@ -53,6 +53,38 @@ def test_info_in_broken_git_repo(tmp_dir, dvc, scm, caplog):
|
||||
assert "Repo: dvc, git (broken)" in dvc_info
|
||||
|
||||
|
||||
def test_caches(tmp_dir, dvc, caplog):
|
||||
tmp_dir.add_remote(
|
||||
name="sshcache", url="ssh://example.com/path", default=False
|
||||
)
|
||||
with tmp_dir.dvc.config.edit() as conf:
|
||||
conf["cache"]["ssh"] = "sshcache"
|
||||
|
||||
dvc_info = get_dvc_info()
|
||||
|
||||
# Order of cache types is runtime dependent
|
||||
assert re.search("Caches: (local, ssh|ssh, local)", dvc_info)
|
||||
|
||||
|
||||
def test_remotes_empty(tmp_dir, dvc, caplog):
|
||||
# No remotes are configured
|
||||
dvc_info = get_dvc_info()
|
||||
|
||||
assert "Remotes: None" in dvc_info
|
||||
|
||||
|
||||
def test_remotes(tmp_dir, dvc, caplog):
|
||||
tmp_dir.add_remote(name="server", url="ssh://localhost", default=False)
|
||||
tmp_dir.add_remote(
|
||||
name="r1", url="azure://example.com/path", default=False
|
||||
)
|
||||
tmp_dir.add_remote(name="r2", url="remote://server/path", default=False)
|
||||
|
||||
dvc_info = get_dvc_info()
|
||||
|
||||
assert re.search("Remotes: (ssh, azure|azure, ssh)", dvc_info)
|
||||
|
||||
|
||||
@pytest.mark.skipif(psutil is None, reason="No psutil.")
|
||||
def test_fs_info_in_repo(tmp_dir, dvc, caplog):
|
||||
os.mkdir(dvc.cache.local.cache_dir)
|
||||
|
||||
Reference in New Issue
Block a user