From f1d50c0ce2d15265820b420be20efbc11898bbb8 Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Sat, 13 Jul 2024 16:11:30 -0700 Subject: [PATCH] Fix pkg tests on arch --- tests/pytests/functional/states/test_pkg.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/pytests/functional/states/test_pkg.py b/tests/pytests/functional/states/test_pkg.py index 01d6d5c7f5f..f1980abf20c 100644 --- a/tests/pytests/functional/states/test_pkg.py +++ b/tests/pytests/functional/states/test_pkg.py @@ -4,6 +4,7 @@ tests for pkg state import logging import os +import subprocess import time import pytest @@ -38,6 +39,16 @@ def refresh_db(grains, modules): pytest.fail("Package database locked after 60 seconds, bailing out") +@pytest.fixture(scope="module", autouse=True) +def refresh_keys(grains, modules): + if grains["os_family"] == "Arch": + # We should be running this periodically when building new test runner + # images, otherwise this could take several minuets to complete. + proc = subprocess.run(["pacman-key", "--refresh-keys"], check=False) + if proc.returncode != 0: + pytest.fail("pacman-key --refresh-keys command failed.") + + @pytest.fixture def PKG_TARGETS(grains): _PKG_TARGETS = ["figlet", "sl"]