Skip to content

Commit

Permalink
Skip problematic test on Debian 10
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
  • Loading branch information
s0undt3ch committed Sep 14, 2023
1 parent 89bc5ca commit 9b9accb
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
17 changes: 12 additions & 5 deletions tests/pytests/functional/modules/test_aptpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import salt.modules.gpg as gpg
import salt.utils.files
import salt.utils.stringutils
import salt.version
from tests.support.mock import Mock, patch

pytestmark = [
Expand Down Expand Up @@ -82,8 +83,12 @@ def configure_loader_modules(minion_opts):
}


@pytest.fixture()
def revert_repo_file(tmp_path):
@pytest.fixture
def revert_repo_file(tmp_path, grains):
if grains["os"] == "Debian" and grains["osmajorrelease"] == 10:
if salt.version.__saltstack_version__.info >= (3006, 0):
pytest.fail("Remove this whole Debian 10 check. It's only meant for 3005.x")
pytest.skip("Skipped on Debian 10 due to old AMI having issues")
try:
repo_file = pathlib.Path("/etc") / "apt" / "sources.list"
backup = tmp_path / "repo_backup"
Expand Down Expand Up @@ -270,13 +275,15 @@ def test_mod_repo_no_file(tmp_path, revert_repo_file):
assert comp in ret


@pytest.fixture()
@pytest.fixture
def add_key(request, get_key_file):
""" """
key = Key(request.param)
key.add_key()
yield request.param
key.del_key()
try:
yield request.param
finally:
key.del_key()


@pytest.mark.parametrize("get_key_file", KEY_FILES, indirect=True)
Expand Down
7 changes: 6 additions & 1 deletion tests/pytests/functional/modules/test_pkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import salt.utils.path
import salt.utils.pkg
import salt.utils.platform
import salt.version
from saltfactories.utils.functional import Loaders

log = logging.getLogger(__name__)
Expand Down Expand Up @@ -210,10 +211,14 @@ def test_mod_del_repo_multiline_values(modules):

@pytest.mark.flaky(max_runs=4)
@pytest.mark.requires_salt_modules("pkg.owner")
def test_owner(modules):
def test_owner(modules, grains):
"""
test finding the package owning a file
"""
if grains["os"] == "Debian" and grains["osmajorrelease"] == 10:
if salt.version.__saltstack_version__.info >= (3006, 0):
pytest.fail("Remove this whole Debian 10 check. It's only meant for 3005.x")
pytest.skip("Skipped on Debian 10 due to old AMI having issues")
func = "pkg.owner"
ret = modules.pkg.owner("/bin/ls")
assert len(ret) != 0
Expand Down
9 changes: 8 additions & 1 deletion tests/pytests/functional/states/pkgrepo/test_debian.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import attr
import pytest
import salt.utils.files
import salt.version
from tests.conftest import CODE_DIR

try:
Expand Down Expand Up @@ -541,10 +542,16 @@ def test_repo_present_absent_trailing_slash_uri(pkgrepo, trailing_slash_repo_fil


@pytest.mark.requires_salt_states("pkgrepo.managed", "pkgrepo.absent")
def test_repo_present_absent_no_trailing_slash_uri(pkgrepo, trailing_slash_repo_file):
def test_repo_present_absent_no_trailing_slash_uri(
pkgrepo, trailing_slash_repo_file, grains
):
"""
test adding a repo with a trailing slash in the uri
"""
if grains["os"] == "Debian" and grains["osmajorrelease"] == 10:
if salt.version.__saltstack_version__.info >= (3006, 0):
pytest.fail("Remove this whole Debian 10 check. It's only meant for 3005.x")
pytest.skip("Skipped on Debian 10 due to old AMI having issues")
# without the trailing slash
repo_content = "deb http://www.deb-multimedia.org stable main"
# initial creation
Expand Down

0 comments on commit 9b9accb

Please sign in to comment.