From a7955e6af30bf02779c88ccdea8381e3ba5e95a2 Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Mon, 27 May 2024 18:29:46 +0200 Subject: [PATCH] tools/test: check for *filelists* in depsolve repodata When the filelists are enabled in the optional metadata, the local cache for the depsolve will include a filelist file for each repository. Count the files matching *filelists* using glob() and compare them with the number of repositories when the option is enabled. When the option is not enabled, there should be no filelists. --- tools/test/test_depsolve.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/test/test_depsolve.py b/tools/test/test_depsolve.py index b8233943..83aa947a 100644 --- a/tools/test/test_depsolve.py +++ b/tools/test/test_depsolve.py @@ -5,6 +5,7 @@ import pathlib import socket import subprocess as sp import sys +from glob import glob from tempfile import TemporaryDirectory import pytest @@ -278,3 +279,11 @@ def test_depsolve(tmp_path, repo_servers, dnf_cmd, detect_fn, test_case): for repo in res["repos"].values(): assert repo["gpgkeys"] == [TEST_KEY + repo["id"]] assert repo["sslverify"] is False + + # if opt_metadata includes 'filelists', then each repository 'repodata' must include a file that matches + # *filelists* + n_filelist_files = len(glob(f"{cache_dir}/*/repodata/*filelists*")) + if "filelists" in opt_metadata: + assert n_filelist_files == len(REPO_PATHS) + else: + assert n_filelist_files == 0