diff --git a/.github/workflows/flake8.yaml b/.github/workflows/flake8.yaml index b7b33ad..41a7f63 100644 --- a/.github/workflows/flake8.yaml +++ b/.github/workflows/flake8.yaml @@ -5,7 +5,7 @@ on: jobs: flake8-lint: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 name: flake8 lint steps: - name: Setup python for flake8 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 5a801e0..6b6d919 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -8,28 +8,31 @@ on: jobs: test: name: test ${{ matrix.py }} - ${{ matrix.netapi }} - ${{ matrix.salt }} - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 strategy: fail-fast: false matrix: py: - - "3.7" - "3.8" - "3.9" - "3.10" + - "3.11" netapi: - "cherrypy" - "tornado" salt: - - "v3004.2" - - "v3005.1" - - "v3006.0" + - "v3006.9" + - "v3007.1" - "master" exclude: - - py: "3.10" - salt: "v3004.2" - - py: "3.10" - salt: "v3005.1" + - py: "3.8" + salt: "v3007.1" + - py: "3.9" + salt: "v3007.1" + - py: "3.8" + salt: "master" + - py: "3.9" + salt: "master" steps: - name: Setup python for test ${{ matrix.py }} uses: actions/setup-python@v4 diff --git a/tests/conftest.py b/tests/conftest.py index 5cf86aa..c033e9e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import, unicode_literals, print_function +from __future__ import absolute_import, print_function, unicode_literals # Import python libraries import logging @@ -9,11 +9,11 @@ import tempfile import textwrap -# Import Salt Libraries -import salt.utils.yaml as yaml - # Import pytest libraries import pytest + +# Import Salt Libraries +import salt.utils.yaml as yaml from pytestskipmarkers.utils import ports from saltfactories.utils import random_string, running_username @@ -21,7 +21,6 @@ import pepper import pepper.script - log = logging.getLogger(__name__) @@ -240,6 +239,16 @@ def session_master_config_overrides(request, salt_api_port, salt_api_backend): } +@pytest.helpers.register +def remove_stale_minion_key(master, minion_id): + """Helper to remove a stale minion key.""" + key_path = os.path.join(master.config["pki_dir"], "minions", minion_id) + if os.path.exists(key_path): + os.unlink(key_path) + else: + log.debug("The minion(id=%r) key was not found at %s", minion_id, key_path) + + @pytest.fixture(scope='session') def session_minion_factory(session_master_factory): """Return a factory for a randomly named minion connected to master.""" diff --git a/tests/requirements.txt b/tests/requirements.txt index b6a15e2..e4bdf27 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -2,10 +2,11 @@ mock pytest>=6.0.0 pytest-rerunfailures pytest-cov -pytest-salt-factories==0.912.2 +pytest-salt-factories==1.0.4 CherryPy -setuptools_scm +setuptools_scm==7.1.0 importlib-metadata<5.0.0 -pyzmq<=20.0.0 ; python_version < "3.6" -pyzmq>=17.0.0 ; python_version < "3.9" -pyzmq>19.0.2 ; python_version >= "3.9" +pyzmq>=25.1.2 ; python_version < '3.13' +pyzmq>=26.2.0 ; python_version >= '3.13' +cryptography>=42.0.0; python_version < '3.13' +cryptography==42.0.2; python_version >= '3.13' diff --git a/tox.ini b/tox.ini index 35df1fa..a5dacb9 100644 --- a/tox.ini +++ b/tox.ini @@ -1,15 +1,13 @@ [tox] -envlist = py{3.7,3.8,3.9}-{cherrypy,tornado}-{v3004.2,v3005.1,v3006.0,master},py{3.10}-{cherrypy,tornado}-{v3006.0,master},coverage,flake8 +envlist = py{3.8,3.9}-{cherrypy,tornado}-{v3006.9,v3007.1},py{3.10,3.11}-{cherrypy,tornado}-{v3006.9,v3007.1,master},coverage,flake8 skip_missing_interpreters = true skipsdist = false [testenv] passenv = TOXENV, CI, TRAVIS, TRAVIS_*, CODECOV_* deps = -r{toxinidir}/tests/requirements.txt - v3004.2: salt==3004.2 - v3004.2: jinja2<3.1 - v3005.1: salt==3005.1 - v3006.0: salt==3006.0 + v3006.9: salt==3006.9 + v3007.1: salt==3007.1 master: git+https://github.com/saltstack/salt.git@master#egg=salt changedir = {toxinidir} @@ -45,7 +43,7 @@ commands = codecov --file "{toxworkdir}/coverage.xml" [testenv:http] skip_install = True -basepython = python36 +basepython = python39 deps = changedir = {toxinidir}/htmlcov commands = python -m http.server