test_depsolve.py: test that not enabled repos are not used

Add a test case, that the repositories not enabled for a transaction are
not really used to depsolve its package specs. This is a common use case
for osbuild-composer, where the custom repositories specified by the
user are enabled only for the second transaction and not for the first
one (when depsolving the image base package set). This is important, so
that the user can't possibly replace important packages shipped by
the "system" repositories (e.g. kernel, systemd, etc.) with versions
from their custom repositories.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
Tomáš Hozza 2024-08-06 14:29:06 +02:00 committed by Tomáš Hozza
parent 64b102c297
commit bcc20fc94e

View file

@ -172,6 +172,34 @@ test_cases = [
},
},
},
# Test that repositories not enabled for the transaction are not used
# This test should result in an error because the package is not available in the enabled repositories
{
"id": "error_pkg_not_in_enabled_repos",
"transactions": [
{
"package-specs": [
"filesystem",
"pkg-with-no-deps",
],
"repo-ids": [
"baseos",
]
},
{
"package-specs": [
"tmux",
],
"repo-ids": [
"baseos",
"custom",
]
}
],
"error": True,
"error_kind": "MarkingErrors",
"error_reason_re": r".*pkg-with-no-deps.*",
},
# Test depsolving error due to non-existing package
{
"id": "error_non_existing_pkg",