From bcc20fc94e7d9f741ad24cbc8ecd3ca531f79457 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hozza?= Date: Tue, 6 Aug 2024 14:29:06 +0200 Subject: [PATCH] test_depsolve.py: test that not enabled repos are not used MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- tools/test/test_depsolve.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tools/test/test_depsolve.py b/tools/test/test_depsolve.py index ab7c93f2..baed89c0 100644 --- a/tools/test/test_depsolve.py +++ b/tools/test/test_depsolve.py @@ -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",