From ae36b15f85fe86c49be2f5f20b9dee7147d28539 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Thu, 31 Dec 2020 07:23:30 +0000 Subject: [PATCH] Replace the `@slowTest` decorator with the `slow_test` pytest marker --- tests/conftest.py | 10 +++++-- tests/pytests/functional/pillar/test_gpg.py | 3 +-- tests/pytests/integration/cli/test_matcher.py | 26 +----------------- tests/pytests/integration/cli/test_salt.py | 11 +++----- .../pytests/integration/cli/test_salt_auth.py | 5 +--- .../pytests/integration/cli/test_salt_call.py | 27 +++++-------------- tests/pytests/integration/cli/test_salt_cp.py | 10 +++---- .../pytests/integration/cli/test_salt_key.py | 20 +++----------- .../integration/cli/test_salt_master.py | 19 ++++++------- .../integration/cli/test_salt_minion.py | 19 ++++++------- .../integration/cli/test_salt_proxy.py | 6 ++--- .../pytests/integration/cli/test_salt_run.py | 16 ++++------- .../integration/cli/test_salt_syndic.py | 12 ++++----- .../modules/saltutil/test_grains.py | 3 +-- .../modules/saltutil/test_modules.py | 9 +++---- .../modules/saltutil/test_pillar.py | 3 +-- .../modules/saltutil/test_wheel.py | 9 +++---- .../pytests/integration/modules/test_file.py | 11 ++++---- .../integration/modules/test_pillar.py | 13 +-------- .../modules/test_rpmbuild_pkgbuild.py | 3 +-- .../integration/modules/test_sysmod.py | 4 +-- .../pytests/integration/modules/test_virt.py | 6 ++--- tests/pytests/integration/proxy/test_shell.py | 15 +++++------ .../pytests/integration/proxy/test_simple.py | 3 +-- .../pytests/integration/runners/test_cache.py | 13 +++------ tests/pytests/integration/sdb/test_etcd_db.py | 7 +++-- tests/pytests/integration/sdb/test_vault.py | 9 +++---- tests/pytests/integration/ssh/test_pillar.py | 7 +++-- tests/pytests/integration/states/test_cron.py | 3 +-- tests/pytests/integration/states/test_file.py | 3 +-- .../blackout/test_minion_blackout.py | 7 +++-- .../multimaster/beacons/test_inotify.py | 3 +-- tests/pytests/scenarios/setup/test_install.py | 6 +---- tests/pytests/scenarios/setup/test_man.py | 3 +-- 34 files changed, 110 insertions(+), 214 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 29829ffba250..7186436226b9 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -242,10 +242,14 @@ def pytest_configure(config): config.addinivalue_line( "markers", "requires_sshd_server: Mark test that require an SSH server running" ) + config.addinivalue_line( + "markers", + "slow_test: Mark test as being slow. These tests are skipped by default unless `--run-slow` is passed", + ) # Make sure the test suite "knows" this is a pytest test run RUNTIME_VARS.PYTEST_SESSION = True - # "Flag" the slotTest decorator if we're skipping slow tests or not + # "Flag" the slowTest decorator if we're skipping slow tests or not os.environ["SLOW_TESTS"] = str(config.getoption("--run-slow")) @@ -464,7 +468,9 @@ def pytest_runtest_setup(item): item._skipped_by_mark = True pytest.skip(PRE_PYTEST_SKIP_REASON) - if saltfactories.utils.compat.has_unittest_attr(item, "__slow_test__"): + if saltfactories.utils.compat.has_unittest_attr( + item, "__slow_test__" + ) or item.get_closest_marker("slow_test"): if item.config.getoption("--run-slow") is False: item._skipped_by_mark = True pytest.skip("Slow tests are disabled!") diff --git a/tests/pytests/functional/pillar/test_gpg.py b/tests/pytests/functional/pillar/test_gpg.py index 0f9a8d650aed..f12e8ae3ad65 100644 --- a/tests/pytests/functional/pillar/test_gpg.py +++ b/tests/pytests/functional/pillar/test_gpg.py @@ -8,7 +8,6 @@ import salt.pillar import salt.utils.stringutils from saltfactories.utils.processes import ProcessResult -from tests.support.helpers import slowTest pytestmark = [ pytest.mark.windows_whitelisted, @@ -271,7 +270,7 @@ def test_decrypt_pillar_default_renderer(salt_master, grains): assert ret == GPG_PILLAR_DECRYPTED -@slowTest +@pytest.mark.slow_test def test_decrypt_pillar_alternate_delimiter(salt_master, grains): """ Test recursive decryption of secrets:vault using a pipe instead of a diff --git a/tests/pytests/integration/cli/test_matcher.py b/tests/pytests/integration/cli/test_matcher.py index 4a6616129570..77e844f87979 100644 --- a/tests/pytests/integration/cli/test_matcher.py +++ b/tests/pytests/integration/cli/test_matcher.py @@ -1,8 +1,8 @@ import pytest import salt.defaults.exitcodes -from tests.support.helpers import slowTest pytestmark = [ + pytest.mark.slow_test, pytest.mark.windows_whitelisted, ] @@ -76,7 +76,6 @@ def pillar_tree(base_env_pillar_tree_root_dir, salt_minion, salt_sub_minion, sal assert ret.json[salt_sub_minion.id] is True -@slowTest def test_list(salt_cli, salt_minion, salt_sub_minion): """ test salt -L matcher @@ -94,7 +93,6 @@ def test_list(salt_cli, salt_minion, salt_sub_minion): assert salt_sub_minion.id in ret.json -@slowTest def test_compound_min_with_grain(salt_cli, salt_minion, salt_sub_minion): """ test salt compound matcher @@ -105,7 +103,6 @@ def test_compound_min_with_grain(salt_cli, salt_minion, salt_sub_minion): assert salt_sub_minion.id not in ret.json -@slowTest def test_compound_and_not_grain(salt_cli, salt_minion, salt_sub_minion): ret = salt_cli.run("-C", "test.ping", minion_tgt="min* and not G@test_grain:foo") assert ret.exitcode == 0 @@ -113,7 +110,6 @@ def test_compound_and_not_grain(salt_cli, salt_minion, salt_sub_minion): assert salt_sub_minion.id not in ret.json -@slowTest def test_compound_not_grain(salt_cli, salt_minion, salt_sub_minion): ret = salt_cli.run("-C", "test.ping", minion_tgt="min* not G@test_grain:foo") assert ret.exitcode == 0 @@ -121,7 +117,6 @@ def test_compound_not_grain(salt_cli, salt_minion, salt_sub_minion): assert salt_sub_minion.id not in ret.json -@slowTest def test_compound_pcre_grain_and_grain(salt_cli, salt_minion, salt_sub_minion): match = "P@test_grain:^cheese$ and * and G@test_grain:cheese" ret = salt_cli.run("-C", "test.ping", minion_tgt=match) @@ -129,7 +124,6 @@ def test_compound_pcre_grain_and_grain(salt_cli, salt_minion, salt_sub_minion): assert salt_sub_minion.id not in ret.json -@slowTest def test_compound_list_and_pcre_minion(salt_cli, salt_minion, salt_sub_minion): match = "L@{} and E@.*".format(salt_sub_minion.id) ret = salt_cli.run("-C", "test.ping", minion_tgt=match) @@ -137,7 +131,6 @@ def test_compound_list_and_pcre_minion(salt_cli, salt_minion, salt_sub_minion): assert salt_minion.id not in ret.json -@slowTest def test_compound_not_sub_minion(salt_cli, salt_minion, salt_sub_minion): ret = salt_cli.run( "-C", "test.ping", minion_tgt="not {}".format(salt_sub_minion.id) @@ -147,7 +140,6 @@ def test_compound_not_sub_minion(salt_cli, salt_minion, salt_sub_minion): assert salt_sub_minion.id not in ret.json -@slowTest def test_compound_all_and_not_grains(salt_cli, salt_minion, salt_sub_minion): ret = salt_cli.run( "-C", "test.ping", minion_tgt="* and ( not G@test_grain:cheese )" @@ -157,7 +149,6 @@ def test_compound_all_and_not_grains(salt_cli, salt_minion, salt_sub_minion): assert salt_sub_minion.id in ret.json -@slowTest def test_compound_grain_regex(salt_cli, salt_minion, salt_sub_minion): ret = salt_cli.run("-C", "test.ping", minion_tgt="G%@planets%merc*") assert ret.exitcode == 0 @@ -165,7 +156,6 @@ def test_compound_grain_regex(salt_cli, salt_minion, salt_sub_minion): assert salt_sub_minion.id not in ret.json -@slowTest def test_coumpound_pcre_grain_regex(salt_cli, salt_minion, salt_sub_minion): ret = salt_cli.run("-C", "test.ping", minion_tgt="P%@planets%^(mercury|saturn)$") assert ret.exitcode == 0 @@ -173,7 +163,6 @@ def test_coumpound_pcre_grain_regex(salt_cli, salt_minion, salt_sub_minion): assert salt_sub_minion.id in ret.json -@slowTest def test_compound_pillar(salt_cli, salt_minion, salt_sub_minion, pillar_tree): # FYI, This test was previously being skipped because it was unreliable ret = salt_cli.run("-C", "test.ping", minion_tgt="I%@companions%three%sarah*") @@ -182,7 +171,6 @@ def test_compound_pillar(salt_cli, salt_minion, salt_sub_minion, pillar_tree): assert salt_sub_minion.id in ret.json -@slowTest def test_compound_pillar_pcre(salt_cli, salt_minion, salt_sub_minion, pillar_tree): # FYI, This test was previously being skipped because it was unreliable ret = salt_cli.run("-C", "test.ping", minion_tgt="J%@knights%^(Lancelot|Galahad)$") @@ -210,7 +198,6 @@ def test_compound_nodegroup(salt_cli, salt_minion, salt_sub_minion): assert salt_sub_minion.id not in ret.json -@slowTest def test_nodegroup(salt_cli, salt_minion, salt_sub_minion): """ test salt nodegroup matcher @@ -242,7 +229,6 @@ def test_nodegroup(salt_cli, salt_minion, salt_sub_minion): assert salt_sub_minion.id in ret.json -@slowTest def test_nodegroup_list(salt_cli, salt_minion, salt_sub_minion): ret = salt_cli.run("-N", "test.ping", minion_tgt="list_group") assert ret.exitcode == 0 @@ -265,7 +251,6 @@ def test_nodegroup_list(salt_cli, salt_minion, salt_sub_minion): assert salt_sub_minion.id not in ret.json -@slowTest def test_glob(salt_cli, salt_minion, salt_sub_minion): """ test salt glob matcher @@ -281,7 +266,6 @@ def test_glob(salt_cli, salt_minion, salt_sub_minion): assert salt_sub_minion.id in ret.json -@slowTest def test_regex(salt_cli, salt_minion, salt_sub_minion): """ test salt regex matcher @@ -296,7 +280,6 @@ def test_regex(salt_cli, salt_minion, salt_sub_minion): assert salt_sub_minion.id in ret.json -@slowTest def test_grain(salt_cli, salt_master, salt_minion, salt_sub_minion): """ test salt grain matcher @@ -364,7 +347,6 @@ def test_grain(salt_cli, salt_master, salt_minion, salt_sub_minion): assert salt_sub_minion.id in ret.json -@slowTest def test_regrain(salt_cli, salt_minion, salt_sub_minion): """ test salt grain matcher @@ -379,7 +361,6 @@ def test_regrain(salt_cli, salt_minion, salt_sub_minion): assert salt_minion.id not in ret.json -@slowTest def test_pillar(salt_cli, salt_minion, salt_sub_minion, pillar_tree): """ test pillar matcher @@ -413,7 +394,6 @@ def test_pillar(salt_cli, salt_minion, salt_sub_minion, pillar_tree): assert salt_sub_minion.id in ret.json -@slowTest def test_repillar(salt_cli, salt_minion, salt_sub_minion, pillar_tree): """ test salt pillar PCRE matcher @@ -430,7 +410,6 @@ def test_repillar(salt_cli, salt_minion, salt_sub_minion, pillar_tree): assert salt_sub_minion.id in ret.json -@slowTest def test_ipcidr(salt_cli, salt_minion, salt_sub_minion): ret = salt_cli.run("network.subnets", minion_tgt=salt_minion.id) assert ret.exitcode == 0 @@ -445,7 +424,6 @@ def test_ipcidr(salt_cli, salt_minion, salt_sub_minion): assert salt_sub_minion.id in ret.json -@slowTest def test_static(salt_cli, salt_minion, salt_sub_minion): """ test salt static call @@ -456,7 +434,6 @@ def test_static(salt_cli, salt_minion, salt_sub_minion): assert salt_minion.id in ret.stdout -@slowTest def test_salt_documentation(salt_cli, salt_minion): """ Test to see if we're supporting --doc @@ -466,7 +443,6 @@ def test_salt_documentation(salt_cli, salt_minion): assert "test.ping" in ret.json -@slowTest def test_salt_documentation_too_many_arguments(salt_cli, salt_minion): """ Test to see if passing additional arguments shows an error diff --git a/tests/pytests/integration/cli/test_salt.py b/tests/pytests/integration/cli/test_salt.py index 27627e900c82..4ab2ad69c86f 100644 --- a/tests/pytests/integration/cli/test_salt.py +++ b/tests/pytests/integration/cli/test_salt.py @@ -16,14 +16,15 @@ import pytest import salt.defaults.exitcodes import salt.utils.path -from tests.support.helpers import slowTest log = logging.getLogger(__name__) -pytestmark = pytest.mark.windows_whitelisted +pytestmark = [ + pytest.mark.slow_test, + pytest.mark.windows_whitelisted, +] -@slowTest def test_context_retcode_salt(salt_cli, salt_minion): """ Test that a nonzero retcode set in the context dunder will cause the @@ -36,7 +37,6 @@ def test_context_retcode_salt(salt_cli, salt_minion): assert ret.exitcode == salt.defaults.exitcodes.EX_GENERIC, ret -@slowTest def test_salt_error(salt_cli, salt_minion): """ Test that we return the expected retcode when a minion function raises @@ -86,7 +86,6 @@ def test_salt_error(salt_cli, salt_minion): assert ret.exitcode == salt.defaults.exitcodes.EX_GENERIC, ret -@slowTest def test_missing_minion(salt_cli, salt_master, salt_minion): """ Test that a minion which doesn't respond results in a nonzeo exit code @@ -113,7 +112,6 @@ def test_missing_minion(salt_cli, salt_master, salt_minion): ) -@slowTest def test_exit_status_unknown_argument(salt_cli): """ Ensure correct exit status when an unknown argument is passed to salt CLI. @@ -126,7 +124,6 @@ def test_exit_status_unknown_argument(salt_cli): assert "no such option: --unknown-argument" in ret.stderr -@slowTest def test_exit_status_correct_usage(salt_cli, salt_minion): """ Ensure correct exit status when salt CLI starts correctly. diff --git a/tests/pytests/integration/cli/test_salt_auth.py b/tests/pytests/integration/cli/test_salt_auth.py index 590a6fb5cbfb..d7631c6849aa 100644 --- a/tests/pytests/integration/cli/test_salt_auth.py +++ b/tests/pytests/integration/cli/test_salt_auth.py @@ -9,11 +9,11 @@ import pytest import salt.utils.platform import salt.utils.pycrypto -from tests.support.helpers import slowTest log = logging.getLogger(__name__) pytestmark = [ + pytest.mark.slow_test, pytest.mark.skip_if_not_root, pytest.mark.destructive_test, pytest.mark.skip_on_windows, @@ -74,7 +74,6 @@ def saltadm_account(sminion, saltops_group): sminion.functions.user.delete(USERB, remove=True) -@slowTest def test_pam_auth_valid_user(salt_minion, salt_cli, saltdev_account): """ test that pam auth mechanism works with a valid user @@ -94,7 +93,6 @@ def test_pam_auth_valid_user(salt_minion, salt_cli, saltdev_account): assert ret.json is True -@slowTest def test_pam_auth_invalid_user(salt_minion, salt_cli, saltdev_account): """ test pam auth mechanism errors for an invalid user @@ -112,7 +110,6 @@ def test_pam_auth_invalid_user(salt_minion, salt_cli, saltdev_account): assert ret.stdout == "Authentication error occurred." -@slowTest def test_pam_auth_valid_group(salt_minion, salt_cli, saltadm_account): """ test that pam auth mechanism works for a valid group diff --git a/tests/pytests/integration/cli/test_salt_call.py b/tests/pytests/integration/cli/test_salt_call.py index ec59e6a26c4c..95b3495f074c 100644 --- a/tests/pytests/integration/cli/test_salt_call.py +++ b/tests/pytests/integration/cli/test_salt_call.py @@ -19,21 +19,23 @@ import salt.utils.json import salt.utils.platform import salt.utils.yaml -from tests.support.helpers import PRE_PYTEST_SKIP, PRE_PYTEST_SKIP_REASON, slowTest +from tests.support.helpers import PRE_PYTEST_SKIP, PRE_PYTEST_SKIP_REASON from tests.support.runtests import RUNTIME_VARS +pytestmark = [ + pytest.mark.slow_test, + pytest.mark.windows_whitelisted, +] + log = logging.getLogger(__name__) -pytestmark = pytest.mark.windows_whitelisted -@slowTest def test_fib(salt_call_cli): ret = salt_call_cli.run("test.fib", "3") assert ret.exitcode == 0 assert ret.json[0] == 2 -@slowTest def test_fib_txt_output(salt_call_cli): ret = salt_call_cli.run("--output=txt", "test.fib", "3") assert ret.exitcode == 0 @@ -44,7 +46,6 @@ def test_fib_txt_output(salt_call_cli): ) -@slowTest @pytest.mark.parametrize("indent", [-1, 0, 1]) def test_json_out_indent(salt_call_cli, indent): ret = salt_call_cli.run("--out=json", "--out-indent={}".format(indent), "test.ping") @@ -60,7 +61,6 @@ def test_json_out_indent(salt_call_cli, indent): assert ret.stdout == expected_output -@slowTest def test_local_sls_call(salt_call_cli): fileroot = os.path.join(RUNTIME_VARS.FILES, "file", "base") ret = salt_call_cli.run( @@ -73,7 +73,6 @@ def test_local_sls_call(salt_call_cli): assert state_run_dict["changes"]["ret"] == "hello" -@slowTest def test_local_salt_call(salt_call_cli): """ This tests to make sure that salt-call does not execute the @@ -94,7 +93,6 @@ def test_local_salt_call(salt_call_cli): assert contents.count("foo") == 1, contents -@slowTest @pytest.mark.skip_on_windows(reason=PRE_PYTEST_SKIP_REASON) def test_user_delete_kw_output(salt_call_cli): ret = salt_call_cli.run("-d", "user.delete", _timeout=120) @@ -105,7 +103,6 @@ def test_user_delete_kw_output(salt_call_cli): assert expected_output in ret.stdout -@slowTest def test_salt_documentation_too_many_arguments(salt_call_cli): """ Test to see if passing additional arguments shows an error @@ -115,7 +112,6 @@ def test_salt_documentation_too_many_arguments(salt_call_cli): assert "You can only get documentation for one method at one time" in ret.stderr -@slowTest def test_issue_6973_state_highstate_exit_code(salt_call_cli): """ If there is no tops/master_tops or state file matches @@ -134,7 +130,6 @@ def test_issue_6973_state_highstate_exit_code(salt_call_cli): assert expected_comment in ret.stdout -@slowTest @PRE_PYTEST_SKIP def test_issue_15074_output_file_append(salt_call_cli): @@ -163,7 +158,6 @@ def test_issue_15074_output_file_append(salt_call_cli): assert second_run_output == first_run_output + first_run_output -@slowTest @PRE_PYTEST_SKIP def test_issue_14979_output_file_permissions(salt_call_cli): with pytest.helpers.temp_file(name="issue-14979") as output_file: @@ -202,7 +196,6 @@ def test_issue_14979_output_file_permissions(salt_call_cli): assert stat1.st_mode != stat3.st_mode -@slowTest @pytest.mark.skip_on_windows(reason="This test does not apply on Win") def test_42116_cli_pillar_override(salt_call_cli): ret = salt_call_cli.run( @@ -219,7 +212,6 @@ def test_42116_cli_pillar_override(salt_call_cli): ) -@slowTest def test_pillar_items_masterless( salt_minion, salt_call_cli, base_env_pillar_tree_root_dir ): @@ -260,7 +252,6 @@ def test_pillar_items_masterless( assert ret.json["monty"] == "python" -@slowTest def test_masterless_highstate(salt_call_cli): """ test state.highstate in masterless mode @@ -273,7 +264,6 @@ def test_masterless_highstate(salt_call_cli): assert state_run_dict["__id__"] == destpath -@slowTest @pytest.mark.skip_on_windows def test_syslog_file_not_found(salt_minion, salt_call_cli): """ @@ -305,7 +295,6 @@ def test_syslog_file_not_found(salt_minion, salt_call_cli): os.chdir(old_cwd) -@slowTest @PRE_PYTEST_SKIP @pytest.mark.skip_on_windows def test_return(salt_call_cli, salt_run_cli): @@ -328,7 +317,6 @@ def test_return(salt_call_cli, salt_run_cli): assert ret.json[target] == "returnTOmaster" -@slowTest def test_exit_status_unknown_argument(salt_call_cli): """ Ensure correct exit status when an unknown argument is passed to salt CLI. @@ -339,7 +327,6 @@ def test_exit_status_unknown_argument(salt_call_cli): assert "no such option: --unknown-argument" in ret.stderr -@slowTest def test_exit_status_correct_usage(salt_call_cli): """ Ensure correct exit status when salt CLI starts correctly. @@ -349,7 +336,6 @@ def test_exit_status_correct_usage(salt_call_cli): assert ret.exitcode == salt.defaults.exitcodes.EX_OK, ret -@slowTest def test_context_retcode_salt_call(salt_call_cli): """ Test that a nonzero retcode set in the context dunder will cause the @@ -381,7 +367,6 @@ def test_context_retcode_salt_call(salt_call_cli): assert ret.exitcode == salt.defaults.exitcodes.EX_STATE_COMPILER_ERROR, ret -@slowTest def test_salt_call_error(salt_call_cli): """ Test that we return the expected retcode when a minion function raises diff --git a/tests/pytests/integration/cli/test_salt_cp.py b/tests/pytests/integration/cli/test_salt_cp.py index fa318a21a853..45747aba0511 100644 --- a/tests/pytests/integration/cli/test_salt_cp.py +++ b/tests/pytests/integration/cli/test_salt_cp.py @@ -1,9 +1,6 @@ """ - :codeauthor: Pedro Algarvio (pedro@algarvio.me) - - - tests.integration.shell.cp - ~~~~~~~~~~~~~~~~~~~~~~~~~~ +tests.integration.shell.cp +~~~~~~~~~~~~~~~~~~~~~~~~~~ """ @@ -13,7 +10,6 @@ import pytest import salt.utils.files -from tests.support.helpers import slowTest from tests.support.runtests import RUNTIME_VARS log = logging.getLogger(__name__) @@ -35,7 +31,7 @@ def dest_testfile(): dst.unlink() -@slowTest +@pytest.mark.slow_test @pytest.mark.windows_whitelisted def test_cp_testfile(salt_minion, salt_cp_cli, source_testfile, dest_testfile): """ diff --git a/tests/pytests/integration/cli/test_salt_key.py b/tests/pytests/integration/cli/test_salt_key.py index 0edb2cf86c34..3ec87fe5802a 100644 --- a/tests/pytests/integration/cli/test_salt_key.py +++ b/tests/pytests/integration/cli/test_salt_key.py @@ -9,9 +9,11 @@ import salt.utils.pycrypto import salt.utils.yaml from saltfactories.utils import random_string -from tests.support.helpers import slowTest -pytestmark = pytest.mark.windows_whitelisted +pytestmark = [ + pytest.mark.slow_test, + pytest.mark.windows_whitelisted, +] USERA = "saltdev-key" USERA_PWD = "saltdev" @@ -47,7 +49,6 @@ def saltdev_account(sminion): sminion.functions.user.delete(USERA, remove=True) -@slowTest def test_remove_key(salt_master, salt_key_cli): """ test salt-key -d usage @@ -90,7 +91,6 @@ def test_remove_key(salt_master, salt_key_cli): os.unlink(key) -@slowTest @pytest.mark.skip_if_not_root @pytest.mark.destructive_test @pytest.mark.skip_on_windows(reason="PAM is not supported on Windows") @@ -146,7 +146,6 @@ def test_remove_key_eauth(salt_key_cli, salt_master, saltdev_account): os.unlink(key) -@slowTest @pytest.mark.parametrize("key_type", ("acc", "pre", "den", "un", "rej")) def test_list_accepted_args(salt_key_cli, key_type): """ @@ -162,7 +161,6 @@ def test_list_accepted_args(salt_key_cli, key_type): assert "error:" in ret.stderr -@slowTest def test_list_all(salt_key_cli, salt_minion, salt_sub_minion): """ test salt-key -L @@ -178,7 +176,6 @@ def test_list_all(salt_key_cli, salt_minion, salt_sub_minion): assert ret.json == expected -@slowTest def test_list_all_yaml_out(salt_key_cli, salt_minion, salt_sub_minion): """ test salt-key -L --out=yaml @@ -195,7 +192,6 @@ def test_list_all_yaml_out(salt_key_cli, salt_minion, salt_sub_minion): assert output == expected -@slowTest def test_list_all_raw_out(salt_key_cli, salt_minion, salt_sub_minion): """ test salt-key -L --out=raw @@ -212,7 +208,6 @@ def test_list_all_raw_out(salt_key_cli, salt_minion, salt_sub_minion): assert output == expected -@slowTest def test_list_acc(salt_key_cli, salt_minion, salt_sub_minion): """ test salt-key -l acc @@ -223,7 +218,6 @@ def test_list_acc(salt_key_cli, salt_minion, salt_sub_minion): assert ret.json == expected -@slowTest @pytest.mark.skip_if_not_root @pytest.mark.destructive_test @pytest.mark.skip_on_windows(reason="PAM is not supported on Windows") @@ -239,7 +233,6 @@ def test_list_acc_eauth(salt_key_cli, saltdev_account, salt_minion, salt_sub_min assert ret.json == expected -@slowTest @pytest.mark.skip_if_not_root @pytest.mark.destructive_test @pytest.mark.skip_on_windows(reason="PAM is not supported on Windows") @@ -263,7 +256,6 @@ def test_list_acc_eauth_bad_creds(salt_key_cli, saltdev_account): ) -@slowTest def test_list_acc_wrong_eauth(salt_key_cli): """ test salt-key -l with wrong eauth @@ -285,7 +277,6 @@ def test_list_acc_wrong_eauth(salt_key_cli): ) -@slowTest def test_list_un(salt_key_cli): """ test salt-key -l un @@ -296,7 +287,6 @@ def test_list_un(salt_key_cli): assert ret.json == expected -@slowTest def test_keys_generation(salt_key_cli): with pytest.helpers.temp_directory() as tempdir: ret = salt_key_cli.run("--gen-keys", "minibar", "--gen-keys-dir", tempdir) @@ -310,7 +300,6 @@ def test_keys_generation(salt_key_cli): os.chmod(os.path.join(tempdir, filename), 0o700) -@slowTest def test_keys_generation_keysize_min(salt_key_cli): with pytest.helpers.temp_directory() as tempdir: ret = salt_key_cli.run( @@ -320,7 +309,6 @@ def test_keys_generation_keysize_min(salt_key_cli): assert "error: The minimum value for keysize is 2048" in ret.stderr -@slowTest def test_keys_generation_keysize_max(salt_key_cli): with pytest.helpers.temp_directory() as tempdir: ret = salt_key_cli.run( diff --git a/tests/pytests/integration/cli/test_salt_master.py b/tests/pytests/integration/cli/test_salt_master.py index 6c6af500dfdf..45b03fe706f8 100644 --- a/tests/pytests/integration/cli/test_salt_master.py +++ b/tests/pytests/integration/cli/test_salt_master.py @@ -1,9 +1,6 @@ """ - :codeauthor: Pedro Algarvio (pedro@algarvio.me) - - - tests.integration.shell.master - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +tests.integration.shell.master +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ """ @@ -14,11 +11,14 @@ import salt.defaults.exitcodes from saltfactories.exceptions import FactoryNotStarted from saltfactories.utils import random_string -from tests.support.helpers import PRE_PYTEST_SKIP_REASON, slowTest +from tests.support.helpers import PRE_PYTEST_SKIP_REASON -log = logging.getLogger(__name__) +pytestmark = [ + pytest.mark.slow_test, + pytest.mark.windows_whitelisted, +] -pytestmark = pytest.mark.windows_whitelisted +log = logging.getLogger(__name__) @pytest.fixture @@ -26,7 +26,6 @@ def master_id(): return random_string("master-") -@slowTest @pytest.mark.skip_on_windows(reason="Windows does not do user checks") def test_exit_status_unknown_user(salt_factories, master_id): """ @@ -44,7 +43,6 @@ def test_exit_status_unknown_user(salt_factories, master_id): assert "The user is not available." in exc.value.stderr, exc.value -@slowTest def test_exit_status_unknown_argument(salt_factories, master_id): """ Ensure correct exit status when an unknown argument is passed to salt-master. @@ -57,7 +55,6 @@ def test_exit_status_unknown_argument(salt_factories, master_id): assert "no such option: --unknown-argument" in exc.value.stderr, exc.value -@slowTest @pytest.mark.skip_on_windows(reason=PRE_PYTEST_SKIP_REASON) def test_exit_status_correct_usage(salt_factories, master_id): factory = salt_factories.get_salt_master_daemon(master_id) diff --git a/tests/pytests/integration/cli/test_salt_minion.py b/tests/pytests/integration/cli/test_salt_minion.py index 8a215bece10b..c746e73d09d9 100644 --- a/tests/pytests/integration/cli/test_salt_minion.py +++ b/tests/pytests/integration/cli/test_salt_minion.py @@ -1,9 +1,6 @@ """ - :codeauthor: Pedro Algarvio (pedro@algarvio.me) - - - tests.integration.shell.minion - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +tests.integration.shell.minion +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ """ @@ -15,11 +12,14 @@ import salt.defaults.exitcodes from saltfactories.exceptions import FactoryNotStarted from saltfactories.utils import random_string -from tests.support.helpers import PRE_PYTEST_SKIP_REASON, slowTest +from tests.support.helpers import PRE_PYTEST_SKIP_REASON -log = logging.getLogger(__name__) +pytestmark = [ + pytest.mark.slow_test, + pytest.mark.windows_whitelisted, +] -pytestmark = pytest.mark.windows_whitelisted +log = logging.getLogger(__name__) @pytest.fixture @@ -38,7 +38,6 @@ def minion_id(salt_factories, salt_master): os.unlink(minion_key_file) -@slowTest @pytest.mark.skip_on_windows(reason="Windows does not do user checks") def test_exit_status_unknown_user(salt_master, minion_id): """ @@ -54,7 +53,6 @@ def test_exit_status_unknown_user(salt_master, minion_id): assert "The user is not available." in exc.value.stderr, exc.value -@slowTest def test_exit_status_unknown_argument(salt_master, minion_id): """ Ensure correct exit status when an unknown argument is passed to salt-minion. @@ -68,7 +66,6 @@ def test_exit_status_unknown_argument(salt_master, minion_id): assert "no such option: --unknown-argument" in exc.value.stderr, exc.value -@slowTest @pytest.mark.skip_on_windows(reason=PRE_PYTEST_SKIP_REASON) def test_exit_status_correct_usage(salt_master, minion_id): factory = salt_master.get_salt_minion_daemon( diff --git a/tests/pytests/integration/cli/test_salt_proxy.py b/tests/pytests/integration/cli/test_salt_proxy.py index e22a9d7dede2..25733d2bb996 100644 --- a/tests/pytests/integration/cli/test_salt_proxy.py +++ b/tests/pytests/integration/cli/test_salt_proxy.py @@ -14,7 +14,7 @@ import salt.defaults.exitcodes from saltfactories.exceptions import FactoryNotStarted from saltfactories.utils import random_string -from tests.support.helpers import PRE_PYTEST_SKIP_REASON, slowTest +from tests.support.helpers import PRE_PYTEST_SKIP_REASON log = logging.getLogger(__name__) @@ -30,7 +30,7 @@ def proxy_minion_id(salt_factories, salt_master): pytest.helpers.remove_stale_minion_key(salt_master, _proxy_minion_id) -@slowTest +@pytest.mark.slow_test def test_exit_status_no_proxyid(salt_master, proxy_minion_id): """ Ensure correct exit status when --proxyid argument is missing. @@ -62,7 +62,7 @@ def test_exit_status_unknown_user(salt_master, proxy_minion_id): assert "The user is not available." in exc.value.stderr, exc.value -@slowTest +@pytest.mark.slow_test def test_exit_status_unknown_argument(salt_master, proxy_minion_id): """ Ensure correct exit status when an unknown argument is passed to diff --git a/tests/pytests/integration/cli/test_salt_run.py b/tests/pytests/integration/cli/test_salt_run.py index 11bd7e842754..51b91411ef70 100644 --- a/tests/pytests/integration/cli/test_salt_run.py +++ b/tests/pytests/integration/cli/test_salt_run.py @@ -10,13 +10,15 @@ import salt.utils.platform import salt.utils.pycrypto import salt.utils.yaml -from tests.support.helpers import slowTest + +pytestmark = [ + pytest.mark.slow_test, + pytest.mark.windows_whitelisted, +] USERA = "saltdev-runner" USERA_PWD = "saltdev" -pytestmark = pytest.mark.windows_whitelisted - @pytest.fixture(scope="module") def saltdev_account(sminion): @@ -43,7 +45,6 @@ def salt_run_cli(salt_master): return salt_master.get_salt_run_cli(default_timeout=120) -@slowTest def test_in_docs(salt_run_cli): """ test the salt-run docs system @@ -58,7 +59,6 @@ def test_in_docs(salt_run_cli): assert "network.wollist:" in ret.stdout -@slowTest def test_not_in_docs(salt_run_cli): """ test the salt-run docs system @@ -67,7 +67,6 @@ def test_not_in_docs(salt_run_cli): assert "jobs.SaltException:" not in ret.stdout -@slowTest def test_salt_documentation_too_many_arguments(salt_run_cli): """ Test to see if passing additional arguments shows an error @@ -77,7 +76,6 @@ def test_salt_documentation_too_many_arguments(salt_run_cli): assert "You can only get documentation for one method at one time" in ret.stderr -@slowTest def test_exit_status_unknown_argument(salt_run_cli): """ Ensure correct exit status when an unknown argument is passed to salt-run. @@ -88,7 +86,6 @@ def test_exit_status_unknown_argument(salt_run_cli): assert "no such option: --unknown-argument" in ret.stderr -@slowTest def test_exit_status_correct_usage(salt_run_cli): """ Ensure correct exit status when salt-run starts correctly. @@ -97,7 +94,6 @@ def test_exit_status_correct_usage(salt_run_cli): assert ret.exitcode == salt.defaults.exitcodes.EX_OK, ret -@slowTest @pytest.mark.skip_if_not_root @pytest.mark.parametrize("flag", ["--auth", "--eauth", "--external-auth", "-a"]) @pytest.mark.skip_on_windows(reason="PAM is not supported on Windows") @@ -124,7 +120,6 @@ def test_salt_run_with_eauth_all_args(salt_run_cli, saltdev_account, flag): assert ret.json == expected, ret -@slowTest @pytest.mark.skip_if_not_root @pytest.mark.skip_on_windows(reason="PAM is not supported on Windows") def test_salt_run_with_eauth_bad_passwd(salt_run_cli, saltdev_account): @@ -148,7 +143,6 @@ def test_salt_run_with_eauth_bad_passwd(salt_run_cli, saltdev_account): ) -@slowTest def test_salt_run_with_wrong_eauth(salt_run_cli): """ test salt-run with wrong eauth parameter diff --git a/tests/pytests/integration/cli/test_salt_syndic.py b/tests/pytests/integration/cli/test_salt_syndic.py index d4de58a8d103..44ac40abc90b 100644 --- a/tests/pytests/integration/cli/test_salt_syndic.py +++ b/tests/pytests/integration/cli/test_salt_syndic.py @@ -14,11 +14,14 @@ import salt.defaults.exitcodes from saltfactories.exceptions import FactoryNotStarted from saltfactories.utils import random_string -from tests.support.helpers import PRE_PYTEST_SKIP, PRE_PYTEST_SKIP_REASON, slowTest +from tests.support.helpers import PRE_PYTEST_SKIP, PRE_PYTEST_SKIP_REASON -log = logging.getLogger(__name__) +pytestmark = [ + pytest.mark.slow_test, + pytest.mark.windows_whitelisted, +] -pytestmark = pytest.mark.windows_whitelisted +log = logging.getLogger(__name__) @pytest.fixture @@ -37,7 +40,6 @@ def syndic_id(salt_factories, salt_master): os.unlink(syndic_key_file) -@slowTest @PRE_PYTEST_SKIP @pytest.mark.skip_on_windows(reason="Windows does not do user checks") def test_exit_status_unknown_user(salt_master, syndic_id): @@ -55,7 +57,6 @@ def test_exit_status_unknown_user(salt_master, syndic_id): assert "The user is not available." in exc.value.stderr, exc.value -@slowTest @PRE_PYTEST_SKIP def test_exit_status_unknown_argument(salt_master, syndic_id): """ @@ -71,7 +72,6 @@ def test_exit_status_unknown_argument(salt_master, syndic_id): assert "no such option: --unknown-argument" in exc.value.stderr, exc.value -@slowTest @PRE_PYTEST_SKIP @pytest.mark.skip_on_windows(reason=PRE_PYTEST_SKIP_REASON) def test_exit_status_correct_usage(salt_master, syndic_id): diff --git a/tests/pytests/integration/modules/saltutil/test_grains.py b/tests/pytests/integration/modules/saltutil/test_grains.py index 6758f2e02b21..d0a489937412 100644 --- a/tests/pytests/integration/modules/saltutil/test_grains.py +++ b/tests/pytests/integration/modules/saltutil/test_grains.py @@ -1,10 +1,9 @@ import pytest -from tests.support.helpers import slowTest pytestmark = [pytest.mark.windows_whitelisted] -@slowTest +@pytest.mark.slow_test def test_sync_grains(salt_call_cli): ret = salt_call_cli.run("saltutil.sync_grains") assert ret.exitcode == 0 diff --git a/tests/pytests/integration/modules/saltutil/test_modules.py b/tests/pytests/integration/modules/saltutil/test_modules.py index 97020e34d5e8..9c73726075db 100644 --- a/tests/pytests/integration/modules/saltutil/test_modules.py +++ b/tests/pytests/integration/modules/saltutil/test_modules.py @@ -4,7 +4,6 @@ import pytest -from tests.support.helpers import slowTest pytestmark = [pytest.mark.windows_whitelisted] @@ -25,7 +24,7 @@ def refresh_pillar(salt_call_cli, salt_minion, salt_sub_minion): assert ret.json -@slowTest +@pytest.mark.slow_test def test_sync_all(salt_call_cli): """ Test syncing all ModuleCase @@ -63,7 +62,7 @@ def test_sync_all(salt_call_cli): assert ret.json == expected_return -@slowTest +@pytest.mark.slow_test def test_sync_all_whitelist(salt_call_cli): """ Test syncing all ModuleCase with whitelist @@ -95,7 +94,7 @@ def test_sync_all_whitelist(salt_call_cli): assert ret.json == expected_return -@slowTest +@pytest.mark.slow_test def test_sync_all_blacklist(salt_call_cli): """ Test syncing all ModuleCase with blacklist @@ -139,7 +138,7 @@ def test_sync_all_blacklist(salt_call_cli): assert ret.json == expected_return -@slowTest +@pytest.mark.slow_test def test_sync_all_blacklist_and_whitelist(salt_call_cli): """ Test syncing all ModuleCase with whitelist and blacklist diff --git a/tests/pytests/integration/modules/saltutil/test_pillar.py b/tests/pytests/integration/modules/saltutil/test_pillar.py index 32732a12bfe8..e1808cf1d04c 100644 --- a/tests/pytests/integration/modules/saltutil/test_pillar.py +++ b/tests/pytests/integration/modules/saltutil/test_pillar.py @@ -8,7 +8,6 @@ import pytest import salt.defaults.events -from tests.support.helpers import slowTest log = logging.getLogger(__name__) @@ -33,7 +32,7 @@ def event_listener(salt_factories): return salt_factories.event_listener -@slowTest +@pytest.mark.slow_test @pytest.mark.parametrize("sync_refresh", [False, True]) def test_pillar_refresh( salt_minion, diff --git a/tests/pytests/integration/modules/saltutil/test_wheel.py b/tests/pytests/integration/modules/saltutil/test_wheel.py index 2fb5e6e27215..52115b7e0d4b 100644 --- a/tests/pytests/integration/modules/saltutil/test_wheel.py +++ b/tests/pytests/integration/modules/saltutil/test_wheel.py @@ -7,7 +7,6 @@ import shutil import pytest -from tests.support.helpers import slowTest pytestmark = [pytest.mark.windows_whitelisted] @@ -39,7 +38,7 @@ def refresh_pillar(salt_cli, salt_minion, salt_sub_minion): assert ret.json[salt_sub_minion.id] is True -@slowTest +@pytest.mark.slow_test def test_wheel_just_function(salt_call_cli, salt_minion, salt_sub_minion): """ Tests using the saltutil.wheel function when passing only a function. @@ -51,7 +50,7 @@ def test_wheel_just_function(salt_call_cli, salt_minion, salt_sub_minion): assert salt_sub_minion.id in ret.json["return"] -@slowTest +@pytest.mark.slow_test def test_wheel_with_arg(salt_call_cli): """ Tests using the saltutil.wheel function when passing a function and an arg. @@ -61,7 +60,7 @@ def test_wheel_with_arg(salt_call_cli): assert ret.json["return"] == {} -@slowTest +@pytest.mark.slow_test def test_wheel_no_arg_raise_error(salt_call_cli): """ Tests using the saltutil.wheel function when passing a function that requires @@ -71,7 +70,7 @@ def test_wheel_no_arg_raise_error(salt_call_cli): assert ret.exitcode == 0 -@slowTest +@pytest.mark.slow_test def test_wheel_with_kwarg(salt_call_cli): """ Tests using the saltutil.wheel function when passing a function and a kwarg. diff --git a/tests/pytests/integration/modules/test_file.py b/tests/pytests/integration/modules/test_file.py index d3c7e2a1d2bc..26feb9b6be8d 100644 --- a/tests/pytests/integration/modules/test_file.py +++ b/tests/pytests/integration/modules/test_file.py @@ -3,11 +3,10 @@ """ import pytest import salt.states.file -from tests.support.helpers import slowTest @pytest.mark.parametrize("verify_ssl", [True, False]) -@slowTest +@pytest.mark.slow_test def test_get_source_sum_verify_ssl_false( salt_call_cli, tmpdir, ssl_webserver, verify_ssl ): @@ -34,7 +33,7 @@ def test_get_source_sum_verify_ssl_false( @pytest.mark.parametrize("verify_ssl", [True, False]) -@slowTest +@pytest.mark.slow_test def test_get_managed_verify_ssl(salt_call_cli, tmpdir, ssl_webserver, verify_ssl): """ test verify_ssl with get_managed @@ -65,7 +64,7 @@ def test_get_managed_verify_ssl(salt_call_cli, tmpdir, ssl_webserver, verify_ssl @pytest.mark.parametrize("verify_ssl", [True, False]) -@slowTest +@pytest.mark.slow_test def test_manage_file_verify_ssl(salt_call_cli, tmpdir, ssl_webserver, verify_ssl): """ test verify_ssl with manage_file @@ -95,7 +94,7 @@ def test_manage_file_verify_ssl(salt_call_cli, tmpdir, ssl_webserver, verify_ssl @pytest.mark.parametrize("verify_ssl", [True, False]) -@slowTest +@pytest.mark.slow_test def test_check_managed_changes_verify_ssl( salt_call_cli, tmpdir, ssl_webserver, verify_ssl ): @@ -129,7 +128,7 @@ def test_check_managed_changes_verify_ssl( @pytest.mark.parametrize("verify_ssl", [True, False]) -@slowTest +@pytest.mark.slow_test def test_check_file_meta_verify_ssl(salt_call_cli, tmpdir, ssl_webserver, verify_ssl): """ test verify_ssl with check_file_meta diff --git a/tests/pytests/integration/modules/test_pillar.py b/tests/pytests/integration/modules/test_pillar.py index 959c8ec422d0..8a7f37cbc818 100644 --- a/tests/pytests/integration/modules/test_pillar.py +++ b/tests/pytests/integration/modules/test_pillar.py @@ -3,9 +3,9 @@ import attr import pytest -from tests.support.helpers import slowTest pytestmark = [ + pytest.mark.slow_test, pytest.mark.windows_whitelisted, ] @@ -53,7 +53,6 @@ def pillar_tree(base_env_pillar_tree_root_dir, salt_minion, salt_call_cli): assert ret.json is True -@slowTest def test_data(salt_call_cli, pillar_tree): """ pillar.data @@ -74,7 +73,6 @@ def test_data(salt_call_cli, pillar_tree): assert pillar["class"] == "other" -@slowTest def test_issue_5449_report_actual_file_roots_in_pillar( salt_call_cli, pillar_tree, base_env_state_tree_root_dir ): @@ -93,7 +91,6 @@ def test_issue_5449_report_actual_file_roots_in_pillar( ] -@slowTest def test_ext_cmd_yaml(salt_call_cli, pillar_tree): """ pillar.data for ext_pillar cmd.yaml @@ -105,7 +102,6 @@ def test_ext_cmd_yaml(salt_call_cli, pillar_tree): assert pillar["ext_spam"] == "eggs" -@slowTest def test_issue_5951_actual_file_roots_in_opts( salt_call_cli, pillar_tree, base_env_state_tree_root_dir ): @@ -119,7 +115,6 @@ def test_issue_5951_actual_file_roots_in_opts( ] -@slowTest def test_pillar_items(salt_call_cli, pillar_tree): """ Test to ensure we get expected output @@ -135,7 +130,6 @@ def test_pillar_items(salt_call_cli, pillar_tree): assert pillar_items["knights"] == ["Lancelot", "Galahad", "Bedevere", "Robin"] -@slowTest def test_pillar_command_line(salt_call_cli, pillar_tree): """ Test to ensure when using pillar override @@ -209,7 +203,6 @@ def key_pillar(salt_minion, salt_cli, base_env_pillar_tree_root_dir): ) -@slowTest def test_pillar_refresh_pillar_raw(salt_cli, salt_minion, key_pillar): """ Validate the minion's pillar.raw call behavior for new pillars @@ -239,7 +232,6 @@ def test_pillar_refresh_pillar_raw(salt_cli, salt_minion, key_pillar): assert val is True, repr(val) -@slowTest def test_pillar_refresh_pillar_get(salt_cli, salt_minion, key_pillar): """ Validate the minion's pillar.get call behavior for new pillars @@ -270,7 +262,6 @@ def test_pillar_refresh_pillar_get(salt_cli, salt_minion, key_pillar): assert val is True, repr(val) -@slowTest def test_pillar_refresh_pillar_item(salt_cli, salt_minion, key_pillar): """ Validate the minion's pillar.item call behavior for new pillars @@ -304,7 +295,6 @@ def test_pillar_refresh_pillar_item(salt_cli, salt_minion, key_pillar): assert val[key] is True -@slowTest def test_pillar_refresh_pillar_items(salt_cli, salt_minion, key_pillar): """ Validate the minion's pillar.item call behavior for new pillars @@ -327,7 +317,6 @@ def test_pillar_refresh_pillar_items(salt_cli, salt_minion, key_pillar): assert val[key] is True -@slowTest def test_pillar_refresh_pillar_ping(salt_cli, salt_minion, key_pillar): """ Validate the minion's test.ping does not update pillars diff --git a/tests/pytests/integration/modules/test_rpmbuild_pkgbuild.py b/tests/pytests/integration/modules/test_rpmbuild_pkgbuild.py index 6da4409f81cd..d431d7ad9cba 100644 --- a/tests/pytests/integration/modules/test_rpmbuild_pkgbuild.py +++ b/tests/pytests/integration/modules/test_rpmbuild_pkgbuild.py @@ -10,7 +10,6 @@ import textwrap import pytest -from tests.support.helpers import slowTest from tests.support.runtests import RUNTIME_VARS GPG_TEST_PRIV_KEY = """-----BEGIN PGP PRIVATE KEY BLOCK----- @@ -334,7 +333,7 @@ def gpg_agent(request, gpghome): ) -@slowTest +@pytest.mark.slow_test def test_make_repo(grains, gpghome, repodir, gpg_agent, salt_call_cli, pillar_tree): """ test make repo, signing rpm diff --git a/tests/pytests/integration/modules/test_sysmod.py b/tests/pytests/integration/modules/test_sysmod.py index d15d2750a97b..77686132082c 100644 --- a/tests/pytests/integration/modules/test_sysmod.py +++ b/tests/pytests/integration/modules/test_sysmod.py @@ -1,10 +1,10 @@ import fnmatch import re -from tests.support.helpers import slowTest +import pytest -@slowTest +@pytest.mark.slow_test def test_valid_docs(salt_call_cli): """ Make sure no functions are exposed that don't have valid docstrings diff --git a/tests/pytests/integration/modules/test_virt.py b/tests/pytests/integration/modules/test_virt.py index 25e4166c9c05..938163bdad1e 100644 --- a/tests/pytests/integration/modules/test_virt.py +++ b/tests/pytests/integration/modules/test_virt.py @@ -7,7 +7,7 @@ import pytest from saltfactories.utils import cli_scripts -from tests.support.helpers import skip_if_binaries_missing, slowTest +from tests.support.helpers import skip_if_binaries_missing from tests.support.virt import SaltVirtMinionContainerFactory docker = pytest.importorskip("docker") @@ -158,7 +158,7 @@ def salt_cli(salt_master, virt_minion_0, virt_minion_1): @skip_if_binaries_missing("docker") -@slowTest +@pytest.mark.slow_test class TestVirtTest: """ Test virt routines @@ -415,7 +415,7 @@ def prep_virt(salt_cli, virt_minion_0, virt_minion_1, virt_domain): @skip_if_binaries_missing("docker") -@slowTest +@pytest.mark.slow_test class TestVirtMigrateTest: def test_define_xml_path(self, salt_cli, virt_minion_0, virt_domain): """ diff --git a/tests/pytests/integration/proxy/test_shell.py b/tests/pytests/integration/proxy/test_shell.py index 9671ea28c6d3..4cd35099c066 100644 --- a/tests/pytests/integration/proxy/test_shell.py +++ b/tests/pytests/integration/proxy/test_shell.py @@ -13,7 +13,6 @@ import salt.proxy.dummy import salt.utils.path import salt.utils.platform -from tests.support.helpers import slowTest log = logging.getLogger(__name__) @@ -31,7 +30,7 @@ def salt_call_cli(salt_proxy): return salt_proxy.get_salt_call_cli(default_timeout=120) -@slowTest +@pytest.mark.slow_test def test_can_it_ping(salt_call_cli): """ Ensure the proxy can ping @@ -41,7 +40,7 @@ def test_can_it_ping(salt_call_cli): assert ret.json is True -@slowTest +@pytest.mark.slow_test def test_list_pkgs(salt_call_cli): """ Package test 1, really just tests that the virtual function capability @@ -53,7 +52,7 @@ def test_list_pkgs(salt_call_cli): assert package_name in ret.json -@slowTest +@pytest.mark.slow_test def test_upgrade(salt_call_cli): ret = salt_call_cli.run("pkg.upgrade") assert ret.exitcode == 0, ret @@ -68,14 +67,14 @@ def service_name(): return random.choice(list(salt.proxy.dummy._initial_state()["services"])) -@slowTest +@pytest.mark.slow_test def test_service_list(salt_call_cli, service_name): ret = salt_call_cli.run("service.list") assert ret.exitcode == 0, ret assert service_name in ret.json -@slowTest +@pytest.mark.slow_test def test_service_start(salt_call_cli): ret = salt_call_cli.run("service.start", "samba") assert ret.exitcode == 0, ret @@ -84,14 +83,14 @@ def test_service_start(salt_call_cli): assert ret.json is True -@slowTest +@pytest.mark.slow_test def test_service_get_all(salt_call_cli, service_name): ret = salt_call_cli.run("service.get_all") assert ret.exitcode == 0, ret assert service_name in ret.json -@slowTest +@pytest.mark.slow_test def test_grains_items(salt_call_cli): ret = salt_call_cli.run("grains.items") assert ret.exitcode == 0, ret diff --git a/tests/pytests/integration/proxy/test_simple.py b/tests/pytests/integration/proxy/test_simple.py index 33d4d2417411..c12f563c43e5 100644 --- a/tests/pytests/integration/proxy/test_simple.py +++ b/tests/pytests/integration/proxy/test_simple.py @@ -4,7 +4,6 @@ import os import pytest -from tests.support.helpers import slowTest @pytest.fixture(scope="module") @@ -95,7 +94,7 @@ def test_state_apply(salt_cli, salt_proxy): assert value["result"] is True -@slowTest +@pytest.mark.slow_test def test_state_highstate(salt_cli, salt_proxy): ret = salt_cli.run("state.highstate", minion_tgt=salt_proxy.id) for value in ret.json.values(): diff --git a/tests/pytests/integration/runners/test_cache.py b/tests/pytests/integration/runners/test_cache.py index 03ac45954e40..8d23f007bb4a 100644 --- a/tests/pytests/integration/runners/test_cache.py +++ b/tests/pytests/integration/runners/test_cache.py @@ -5,7 +5,10 @@ import logging import pytest -from tests.support.helpers import slowTest + +pytestmark = [ + pytest.mark.slow_test, +] log = logging.getLogger(__name__) @@ -49,7 +52,6 @@ def pillar_tree(base_env_pillar_tree_root_dir, salt_minion, salt_sub_minion, sal assert ret.json[salt_sub_minion.id] is True -@slowTest def test_cache(salt_run_cli): """ Store, list, fetch, then flush data @@ -81,7 +83,6 @@ def test_cache(salt_run_cli): assert "test_cache" not in ret.json -@slowTest def test_cache_invalid(salt_run_cli): """ Store, list, fetch, then flush data @@ -92,7 +93,6 @@ def test_cache_invalid(salt_run_cli): assert "Passed invalid arguments:" in ret.stdout -@slowTest def test_grains(salt_run_cli, pillar_tree, salt_minion): """ Test cache.grains @@ -102,7 +102,6 @@ def test_grains(salt_run_cli, pillar_tree, salt_minion): assert salt_minion.id in ret.json -@slowTest def test_pillar(salt_run_cli, pillar_tree, salt_minion, salt_sub_minion): """ Test cache.pillar @@ -113,7 +112,6 @@ def test_pillar(salt_run_cli, pillar_tree, salt_minion, salt_sub_minion): assert salt_sub_minion.id not in ret.json -@slowTest def test_pillar_no_tgt(salt_run_cli, pillar_tree, salt_minion, salt_sub_minion): """ Test cache.pillar when no tgt is @@ -126,7 +124,6 @@ def test_pillar_no_tgt(salt_run_cli, pillar_tree, salt_minion, salt_sub_minion): assert salt_sub_minion.id in ret.json -@slowTest def test_pillar_minion_noexist(salt_run_cli, pillar_tree, salt_minion, salt_sub_minion): """ Test cache.pillar when the target does not exist @@ -137,7 +134,6 @@ def test_pillar_minion_noexist(salt_run_cli, pillar_tree, salt_minion, salt_sub_ assert salt_sub_minion.id not in ret.json -@slowTest def test_pillar_minion_tgt_type_pillar( salt_run_cli, pillar_tree, salt_minion, salt_sub_minion ): @@ -151,7 +147,6 @@ def test_pillar_minion_tgt_type_pillar( assert salt_sub_minion.id in ret.json -@slowTest def test_mine(salt_run_cli, salt_minion): """ Test cache.mine diff --git a/tests/pytests/integration/sdb/test_etcd_db.py b/tests/pytests/integration/sdb/test_etcd_db.py index b6097a831ea6..2b4933969d97 100644 --- a/tests/pytests/integration/sdb/test_etcd_db.py +++ b/tests/pytests/integration/sdb/test_etcd_db.py @@ -5,7 +5,6 @@ import logging import pytest -from tests.support.helpers import slowTest log = logging.getLogger(__name__) @@ -80,7 +79,7 @@ def pillar_tree(base_env_pillar_tree_root_dir, salt_minion): yield -@slowTest +@pytest.mark.slow_test def test_sdb(salt_call_cli): ret = salt_call_cli.run( "sdb.set", uri="sdb://sdbetcd/secret/test/test_sdb/foo", value="bar" @@ -95,7 +94,7 @@ def test_sdb(salt_call_cli): assert ret.json == "bar" -@slowTest +@pytest.mark.slow_test def test_sdb_runner(salt_run_cli): ret = salt_run_cli.run( "sdb.set", uri="sdb://sdbetcd/secret/test/test_sdb_runner/foo", value="bar" @@ -110,7 +109,7 @@ def test_sdb_runner(salt_run_cli): assert ret.stdout == "bar" -@slowTest +@pytest.mark.slow_test def test_config(salt_call_cli, pillar_tree): ret = salt_call_cli.run( "sdb.set", uri="sdb://sdbetcd/secret/test/test_pillar_sdb/foo", value="bar" diff --git a/tests/pytests/integration/sdb/test_vault.py b/tests/pytests/integration/sdb/test_vault.py index d537482bcbae..7dc4c5541702 100644 --- a/tests/pytests/integration/sdb/test_vault.py +++ b/tests/pytests/integration/sdb/test_vault.py @@ -10,7 +10,6 @@ import pytest import salt.utils.path from saltfactories.utils.processes import ProcessResult -from tests.support.helpers import slowTest from tests.support.runtests import RUNTIME_VARS log = logging.getLogger(__name__) @@ -186,7 +185,7 @@ def vault_container_version(request, salt_call_cli, vault_port): assert state_run["result"] is True -@slowTest +@pytest.mark.slow_test def test_sdb(salt_call_cli): ret = salt_call_cli.run( "sdb.set", uri="sdb://sdbvault/secret/test/test_sdb/foo", value="bar" @@ -199,7 +198,7 @@ def test_sdb(salt_call_cli): assert ret.json == "bar" -@slowTest +@pytest.mark.slow_test def test_sdb_runner(salt_run_cli): ret = salt_run_cli.run( "sdb.set", uri="sdb://sdbvault/secret/test/test_sdb_runner/foo", value="bar" @@ -214,7 +213,7 @@ def test_sdb_runner(salt_run_cli): assert ret.stdout == "bar" -@slowTest +@pytest.mark.slow_test def test_config(salt_call_cli, pillar_tree): ret = salt_call_cli.run( "sdb.set", uri="sdb://sdbvault/secret/test/test_pillar_sdb/foo", value="bar" @@ -227,7 +226,7 @@ def test_config(salt_call_cli, pillar_tree): assert ret.json == "bar" -@slowTest +@pytest.mark.slow_test def test_sdb_kv2_kvv2_path_local(salt_call_cli, vault_container_version): if vault_container_version != "1.3.1": pytest.skip("Test not applicable to vault {}".format(vault_container_version)) diff --git a/tests/pytests/integration/ssh/test_pillar.py b/tests/pytests/integration/ssh/test_pillar.py index 5168f4c0bde8..1c39adee8034 100644 --- a/tests/pytests/integration/ssh/test_pillar.py +++ b/tests/pytests/integration/ssh/test_pillar.py @@ -1,5 +1,4 @@ import pytest -from tests.support.helpers import slowTest pytestmark = [ pytest.mark.skip_on_windows(reason="salt-ssh not available on Windows"), @@ -34,7 +33,7 @@ def pillar_tree(base_env_pillar_tree_root_dir): yield -@slowTest +@pytest.mark.slow_test def test_pillar_items(salt_ssh_cli, pillar_tree): """ test pillar.items with salt-ssh @@ -49,7 +48,7 @@ def test_pillar_items(salt_ssh_cli, pillar_tree): assert pillar_items["knights"] == ["Lancelot", "Galahad", "Bedevere", "Robin"] -@slowTest +@pytest.mark.slow_test def test_pillar_get(salt_ssh_cli, pillar_tree): """ test pillar.get with salt-ssh @@ -60,7 +59,7 @@ def test_pillar_get(salt_ssh_cli, pillar_tree): assert ret.json == "python" -@slowTest +@pytest.mark.slow_test def test_pillar_get_doesnotexist(salt_ssh_cli, pillar_tree): """ test pillar.get when pillar does not exist with salt-ssh diff --git a/tests/pytests/integration/states/test_cron.py b/tests/pytests/integration/states/test_cron.py index fc843445bdda..59cfe91f9b7d 100644 --- a/tests/pytests/integration/states/test_cron.py +++ b/tests/pytests/integration/states/test_cron.py @@ -7,7 +7,6 @@ import pytest import salt.utils.platform -from tests.support.helpers import slowTest log = logging.getLogger(__name__) @@ -24,7 +23,7 @@ def cron_account(): subprocess.run(command, check=False) -@slowTest +@pytest.mark.slow_test @pytest.mark.skip_on_windows @pytest.mark.skip_if_not_root @pytest.mark.skip_if_binaries_missing("crontab") diff --git a/tests/pytests/integration/states/test_file.py b/tests/pytests/integration/states/test_file.py index 51395d970163..0d139b85aae0 100644 --- a/tests/pytests/integration/states/test_file.py +++ b/tests/pytests/integration/states/test_file.py @@ -2,7 +2,6 @@ Tests for the file state """ import pytest -from tests.support.helpers import slowTest @pytest.fixture(scope="module") @@ -42,7 +41,7 @@ def pillar_tree(base_env_pillar_tree_root_dir, salt_minion, salt_call_cli): assert ret.json is True -@slowTest +@pytest.mark.slow_test def test_verify_ssl_skip_verify_false(salt_call_cli, tmpdir, ssl_webserver): """ test verify_ssl when its False and True when managing diff --git a/tests/pytests/scenarios/blackout/test_minion_blackout.py b/tests/pytests/scenarios/blackout/test_minion_blackout.py index 8c92166e4628..821b3d053d41 100644 --- a/tests/pytests/scenarios/blackout/test_minion_blackout.py +++ b/tests/pytests/scenarios/blackout/test_minion_blackout.py @@ -6,7 +6,6 @@ import logging import pytest -from tests.support.helpers import slowTest log = logging.getLogger(__name__) @@ -15,7 +14,7 @@ ] -@slowTest +@pytest.mark.slow_test def test_blackout(salt_cli, blackout, salt_minion_1): """ Test that basic minion blackout functionality works @@ -32,7 +31,7 @@ def test_blackout(salt_cli, blackout, salt_minion_1): assert ret.json is True -@slowTest +@pytest.mark.slow_test def test_blackout_whitelist(salt_cli, blackout, salt_minion_1): """ Test that minion blackout whitelist works @@ -56,7 +55,7 @@ def test_blackout_whitelist(salt_cli, blackout, salt_minion_1): assert ret.json[0] == 13 -@slowTest +@pytest.mark.slow_test def test_blackout_nonwhitelist(salt_cli, blackout, salt_minion_1): """ Test that minion refuses to run non-whitelisted functions during diff --git a/tests/pytests/scenarios/multimaster/beacons/test_inotify.py b/tests/pytests/scenarios/multimaster/beacons/test_inotify.py index 27aae9380fe7..b636696338c2 100644 --- a/tests/pytests/scenarios/multimaster/beacons/test_inotify.py +++ b/tests/pytests/scenarios/multimaster/beacons/test_inotify.py @@ -5,7 +5,6 @@ import pytest import salt.config import salt.version -from tests.support.helpers import slowTest try: import pyinotify # pylint: disable=unused-import @@ -86,7 +85,7 @@ def setup_beacons(mm_master_1_salt_cli, salt_mm_minion_1, inotify_test_path): ) -@slowTest +@pytest.mark.slow_test def test_beacons_duplicate_53344( event_listener, inotify_test_path, diff --git a/tests/pytests/scenarios/setup/test_install.py b/tests/pytests/scenarios/setup/test_install.py index ba697e4f73f3..3c8501e38a63 100644 --- a/tests/pytests/scenarios/setup/test_install.py +++ b/tests/pytests/scenarios/setup/test_install.py @@ -12,18 +12,17 @@ import salt.utils.platform import salt.version from salt.modules.virtualenv_mod import KNOWN_BINARY_NAMES -from tests.support.helpers import slowTest from tests.support.runtests import RUNTIME_VARS log = logging.getLogger(__name__) pytestmark = [ + pytest.mark.slow_test, pytest.mark.windows_whitelisted, pytest.mark.skip_if_binaries_missing(*KNOWN_BINARY_NAMES, check_all=False), ] -@slowTest def test_wheel(virtualenv, cache_dir): """ test building and installing a bdist_wheel package @@ -92,7 +91,6 @@ def test_wheel(virtualenv, cache_dir): assert salt_generated_version_file_path.is_file() -@slowTest def test_egg(virtualenv, cache_dir): """ test building and installing a bdist_egg package @@ -194,7 +192,6 @@ def test_egg(virtualenv, cache_dir): and sys.version_info < (3, 6), reason="Skip on python 3.5", ) -@slowTest def test_sdist(virtualenv, cache_dir): """ test building and installing a sdist package @@ -282,7 +279,6 @@ def test_sdist(virtualenv, cache_dir): ) -@slowTest def test_setup_install(virtualenv, cache_dir): """ test installing directly from source diff --git a/tests/pytests/scenarios/setup/test_man.py b/tests/pytests/scenarios/setup/test_man.py index 8d810e48209b..5168009775d1 100644 --- a/tests/pytests/scenarios/setup/test_man.py +++ b/tests/pytests/scenarios/setup/test_man.py @@ -8,17 +8,16 @@ import pytest import salt.utils.platform from salt.modules.virtualenv_mod import KNOWN_BINARY_NAMES -from tests.support.helpers import slowTest from tests.support.runtests import RUNTIME_VARS pytestmark = [ + pytest.mark.slow_test, pytest.mark.skip_on_windows, pytest.mark.skip_on_aix, pytest.mark.skip_if_binaries_missing(*KNOWN_BINARY_NAMES, check_all=False), ] -@slowTest def test_man_pages(virtualenv): """ Make sure that man pages are installed