From e84dbda01035f6f8f59635d5bf9ed95ce14d39e4 Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Sun, 13 Aug 2023 14:36:38 -0700 Subject: [PATCH] Put channel tests under channel not transport --- tests/pytests/functional/channel/conftest.py | 41 ++++++++++++++++++ .../server => channel}/test_req_channel.py | 0 .../functional/transport/server/conftest.py | 42 ------------------- 3 files changed, 41 insertions(+), 42 deletions(-) rename tests/pytests/functional/{transport/server => channel}/test_req_channel.py (100%) delete mode 100644 tests/pytests/functional/transport/server/conftest.py diff --git a/tests/pytests/functional/channel/conftest.py b/tests/pytests/functional/channel/conftest.py index 62e53c27fb4..4aeb7956ee9 100644 --- a/tests/pytests/functional/channel/conftest.py +++ b/tests/pytests/functional/channel/conftest.py @@ -2,6 +2,7 @@ import ctypes import multiprocessing import pytest +from saltfactories.utils import random_string import salt.crypt import salt.master @@ -24,3 +25,43 @@ def _prepare_aes(): finally: if old_aes: salt.master.SMaster.secrets["aes"] = old_aes + + +def transport_ids(value): + return "Transport({})".format(value) + + +@pytest.fixture(params=("zeromq", "tcp"), ids=transport_ids) +def transport(request): + return request.param + + +@pytest.fixture +def salt_master(salt_factories, transport): + config_defaults = { + "transport": transport, + "auto_accept": True, + "sign_pub_messages": False, + } + factory = salt_factories.salt_master_daemon( + random_string("server-{}-master-".format(transport)), + defaults=config_defaults, + ) + return factory + + +@pytest.fixture +def salt_minion(salt_master, transport): + config_defaults = { + "transport": transport, + "master_ip": "127.0.0.1", + "master_port": salt_master.config["ret_port"], + "auth_timeout": 5, + "auth_tries": 1, + "master_uri": "tcp://127.0.0.1:{}".format(salt_master.config["ret_port"]), + } + factory = salt_master.salt_minion_daemon( + random_string("server-{}-minion-".format(transport)), + defaults=config_defaults, + ) + return factory diff --git a/tests/pytests/functional/transport/server/test_req_channel.py b/tests/pytests/functional/channel/test_req_channel.py similarity index 100% rename from tests/pytests/functional/transport/server/test_req_channel.py rename to tests/pytests/functional/channel/test_req_channel.py diff --git a/tests/pytests/functional/transport/server/conftest.py b/tests/pytests/functional/transport/server/conftest.py deleted file mode 100644 index 3ed15c015e4..00000000000 --- a/tests/pytests/functional/transport/server/conftest.py +++ /dev/null @@ -1,42 +0,0 @@ -import pytest -from saltfactories.utils import random_string - - -def transport_ids(value): - return "Transport({})".format(value) - - -@pytest.fixture(params=("zeromq", "tcp"), ids=transport_ids) -def transport(request): - return request.param - - -@pytest.fixture -def salt_master(salt_factories, transport): - config_defaults = { - "transport": transport, - "auto_accept": True, - "sign_pub_messages": False, - } - factory = salt_factories.salt_master_daemon( - random_string("server-{}-master-".format(transport)), - defaults=config_defaults, - ) - return factory - - -@pytest.fixture -def salt_minion(salt_master, transport): - config_defaults = { - "transport": transport, - "master_ip": "127.0.0.1", - "master_port": salt_master.config["ret_port"], - "auth_timeout": 5, - "auth_tries": 1, - "master_uri": "tcp://127.0.0.1:{}".format(salt_master.config["ret_port"]), - } - factory = salt_master.salt_minion_daemon( - random_string("server-{}-minion-".format(transport)), - defaults=config_defaults, - ) - return factory