1
0
mirror of https://github.com/containers/ramalama.git synced 2026-02-05 06:46:39 +01:00

test_serve.py: pull model before testing non-existent image behavior

If the requested model is missing, "ramalama serve --pull never" will exit with
"Error: <model> does not exist" and returncode 22. To test the behavior of a
non-existent image reference, the requested model must already be available locally.

Signed-off-by: Mike Bonnet <mikeb@redhat.com>
This commit is contained in:
Mike Bonnet
2026-01-21 10:19:25 -08:00
parent 617f57bde6
commit d7872a0a92

View File

@@ -734,6 +734,10 @@ def test_serve_api(caplog):
@skip_if_gh_actions_darwin
def test_serve_with_non_existing_images():
with RamalamaExecWorkspace() as ctx:
# If the requested model is missing, "ramalama serve --pull never" will exit with
# "Error: <model> does not exist" and returncode 22. To test the behavior of a
# non-existent image reference, the requested model must already be available locally.
ctx.check_call(["ramalama", "pull", "tiny"])
with pytest.raises(CalledProcessError) as exc_info:
ctx.check_output(["ramalama", "serve", "--image", "bogus", "--pull", "never", "tiny"], stderr=STDOUT)
assert exc_info.value.returncode == 125