sources: skip ostree tests if no ostree binary if found
This commit skips the ostree tests if no ostree binary is available.
This commit is contained in:
parent
bca7fb1418
commit
add78e7f47
1 changed files with 7 additions and 0 deletions
|
|
@ -3,18 +3,23 @@
|
||||||
import pathlib
|
import pathlib
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from osbuild.testutil import has_executable
|
||||||
from osbuild.testutil.net import http_serve_directory, https_serve_directory
|
from osbuild.testutil.net import http_serve_directory, https_serve_directory
|
||||||
from osbuild.util import ostree
|
from osbuild.util import ostree
|
||||||
|
|
||||||
SOURCES_NAME = "org.osbuild.ostree"
|
SOURCES_NAME = "org.osbuild.ostree"
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(not has_executable("ostree"), reason="need ostree")
|
||||||
def test_ostree_source_not_exists(tmp_path, sources_service):
|
def test_ostree_source_not_exists(tmp_path, sources_service):
|
||||||
checksum = "sha256:1111111111111111111111111111111111111111111111111111111111111111"
|
checksum = "sha256:1111111111111111111111111111111111111111111111111111111111111111"
|
||||||
sources_service.setup({"cache": tmp_path, "options": {}})
|
sources_service.setup({"cache": tmp_path, "options": {}})
|
||||||
assert not sources_service.exists(checksum, None)
|
assert not sources_service.exists(checksum, None)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(not has_executable("ostree"), reason="need ostree")
|
||||||
def test_ostree_source_exists(tmp_path, sources_service):
|
def test_ostree_source_exists(tmp_path, sources_service):
|
||||||
sources_service.setup({"cache": tmp_path, "options": {}})
|
sources_service.setup({"cache": tmp_path, "options": {}})
|
||||||
root = tmp_path / "org.osbuild.ostree" / "repo"
|
root = tmp_path / "org.osbuild.ostree" / "repo"
|
||||||
|
|
@ -41,6 +46,7 @@ def make_repo(root):
|
||||||
return ostree.cli("commit", f"--repo={root}", "--orphan", empty_tmpdir).stdout.rstrip()
|
return ostree.cli("commit", f"--repo={root}", "--orphan", empty_tmpdir).stdout.rstrip()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(not has_executable("ostree"), reason="need ostree")
|
||||||
def test_ostree_pull_plain(tmp_path, sources_service):
|
def test_ostree_pull_plain(tmp_path, sources_service):
|
||||||
fake_httpd_root = tmp_path / "fake-httpd-root"
|
fake_httpd_root = tmp_path / "fake-httpd-root"
|
||||||
fake_httpd_root.mkdir(exist_ok=True)
|
fake_httpd_root.mkdir(exist_ok=True)
|
||||||
|
|
@ -53,6 +59,7 @@ def test_ostree_pull_plain(tmp_path, sources_service):
|
||||||
assert sources_service.exists("sha256:" + fake_commit, None)
|
assert sources_service.exists("sha256:" + fake_commit, None)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(not has_executable("ostree"), reason="need ostree")
|
||||||
def test_ostree_pull_plain_mtls(tmp_path, sources_service, monkeypatch):
|
def test_ostree_pull_plain_mtls(tmp_path, sources_service, monkeypatch):
|
||||||
fake_httpd_root = tmp_path / "fake-httpd-root"
|
fake_httpd_root = tmp_path / "fake-httpd-root"
|
||||||
fake_httpd_root.mkdir(exist_ok=True)
|
fake_httpd_root.mkdir(exist_ok=True)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue