Make sure system installed packages are up-to-date before running tests.

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
Pedro Algarvio 2023-06-16 10:48:56 +01:00 committed by Pedro Algarvio
parent 464c4e5eb2
commit 28d2987b63
2 changed files with 16 additions and 0 deletions

View file

@ -44,6 +44,21 @@ def grains(sminion):
return sminion.opts["grains"].copy()
@pytest.fixture(scope="module", autouse=True)
def _system_up_to_date(
grains,
shell,
):
if grains["os_family"] == "Debian":
ret = shell.run("apt", "update")
assert ret.returncode == 0
ret = shell.run("apt", "upgrade", "-y")
assert ret.returncode == 0
elif grains["os_family"] == "Redhat":
ret = shell.run("yum", "update", "-y")
assert ret.returncode == 0
def pytest_addoption(parser):
"""
register argparse-style options and ini-style config values.

View file

@ -19,6 +19,7 @@ def test_salt_upgrade(salt_call_cli, salt_minion, install_salt):
assert install.returncode == 0
use_lib = salt_call_cli.run("--local", "github.get_repo_info", repo)
assert "Authentication information could" in use_lib.stderr
# upgrade Salt from previous version and test
install_salt.install(upgrade=True)
ret = salt_call_cli.run("test.ping")