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.
This commit is contained in:
Achilleas Koutsou 2024-05-27 18:29:46 +02:00 committed by Michael Vogt
parent 5c171f0e8c
commit a7955e6af3

View file

@ -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