Revert "ostree: introduce optional subpath feature"
This reverts commit 3bb5bedd8e as it
introduces problems in the caching system used by `osbuild` [1]
[1]: https://github.com/osbuild/osbuild/issues/2009
This commit is contained in:
parent
a6b64860b3
commit
b2ec2cd5ee
3 changed files with 8 additions and 49 deletions
|
|
@ -1,6 +1,5 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import os
|
||||
import pathlib
|
||||
import tempfile
|
||||
|
||||
|
|
@ -28,12 +27,11 @@ def test_ostree_source_exists(tmp_path, sources_service):
|
|||
assert sources_service.exists("sha256:" + commit, None)
|
||||
|
||||
|
||||
def make_test_sources(proto, port, fake_commit, subpaths, **secrets):
|
||||
def make_test_sources(proto, port, fake_commit, **secrets):
|
||||
sources = {
|
||||
fake_commit: {
|
||||
"remote": {
|
||||
"url": f"{proto}://localhost:{port}",
|
||||
"subpaths": subpaths,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -44,9 +42,7 @@ def make_test_sources(proto, port, fake_commit, subpaths, **secrets):
|
|||
|
||||
def make_repo(root):
|
||||
with tempfile.TemporaryDirectory() as empty_tmpdir:
|
||||
ostree.cli("init", "--mode=archive", f"--repo={root}")
|
||||
os.mknod(os.path.join(empty_tmpdir, "a.txt"))
|
||||
os.mknod(os.path.join(empty_tmpdir, "b.txt"))
|
||||
ostree.cli("init", f"--repo={root}")
|
||||
return ostree.cli("commit", f"--repo={root}", "--orphan", empty_tmpdir).stdout.rstrip()
|
||||
|
||||
|
||||
|
|
@ -57,27 +53,12 @@ def test_ostree_pull_plain(tmp_path, sources_service):
|
|||
fake_commit = make_repo(fake_httpd_root)
|
||||
|
||||
with http_serve_directory(fake_httpd_root) as httpd:
|
||||
test_sources = make_test_sources("http", httpd.server_port, fake_commit, [])
|
||||
test_sources = make_test_sources("http", httpd.server_port, fake_commit)
|
||||
sources_service.setup({"cache": tmp_path, "options": {}})
|
||||
sources_service.fetch_all(test_sources)
|
||||
assert sources_service.exists("sha256:" + fake_commit, None)
|
||||
|
||||
|
||||
@pytest.mark.skipif(not has_executable("ostree"), reason="need ostree")
|
||||
def test_ostree_pull_subtree(tmp_path, sources_service, capsys):
|
||||
fake_httpd_root = tmp_path / "fake-httpd-root"
|
||||
fake_httpd_root.mkdir(exist_ok=True)
|
||||
fake_commit = make_repo(fake_httpd_root)
|
||||
|
||||
with http_serve_directory(fake_httpd_root) as httpd:
|
||||
test_sources = make_test_sources("http", httpd.server_port, fake_commit, ["/b.txt"])
|
||||
sources_service.setup({"cache": tmp_path, "options": {}})
|
||||
sources_service.fetch_all(test_sources)
|
||||
assert sources_service.exists("sha256:" + fake_commit, None)
|
||||
|
||||
assert "--subpath=/b.txt" in capsys.readouterr().err
|
||||
|
||||
|
||||
@pytest.mark.skipif(not has_executable("ostree"), reason="need ostree")
|
||||
def test_ostree_pull_plain_mtls(tmp_path, sources_service, monkeypatch):
|
||||
fake_httpd_root = tmp_path / "fake-httpd-root"
|
||||
|
|
@ -92,7 +73,7 @@ def test_ostree_pull_plain_mtls(tmp_path, sources_service, monkeypatch):
|
|||
|
||||
with https_serve_directory(fake_httpd_root, cert1, key1) as httpd:
|
||||
monkeypatch.setenv("OSBUILD_SOURCES_OSTREE_INSECURE", "1")
|
||||
test_sources = make_test_sources("https", httpd.server_port, fake_commit, [], name="org.osbuild.mtls")
|
||||
test_sources = make_test_sources("https", httpd.server_port, fake_commit, name="org.osbuild.mtls")
|
||||
sources_service.setup({"cache": tmp_path, "options": {}})
|
||||
sources_service.fetch_all(test_sources)
|
||||
assert sources_service.exists("sha256:" + fake_commit, None)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue