Replace @destructiveTest with @pytest.mark.destructive_test

This commit is contained in:
Pedro Algarvio 2021-01-30 09:03:57 +00:00
parent 97339ca26e
commit 967d26a7fc
86 changed files with 400 additions and 440 deletions

View file

@ -4,9 +4,9 @@ Tests for the Openstack Cloud Provider
import logging
import pytest
from tests.integration.cloud.helpers.cloud_test_base import TIMEOUT, CloudTest
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest
from tests.support.mixins import SaltReturnAssertsMixin
from tests.support.unit import skipIf
@ -42,7 +42,7 @@ class OpenstackTest(ModuleCase, SaltReturnAssertsMixin):
endpoint = "http://localhost:35357/v2.0"
token = "administrator"
@destructiveTest
@pytest.mark.destructive_test
def test_aaa_setup_keystone_endpoint(self):
ret = self.run_state(
"keystone.service_present",
@ -128,7 +128,7 @@ class OpenstackTest(ModuleCase, SaltReturnAssertsMixin):
)
self.assertTrue(ret["keystone_|-demo_|-demo_|-user_present"]["result"])
@destructiveTest
@pytest.mark.destructive_test
def test_zzz_teardown_keystone_endpoint(self):
ret = self.run_state(
"keystone.user_absent",
@ -188,7 +188,7 @@ class OpenstackTest(ModuleCase, SaltReturnAssertsMixin):
ret["keystone_|-keystone_|-keystone_|-service_absent"]["result"]
)
@destructiveTest
@pytest.mark.destructive_test
def test_libcloud_auth_v3(self):
driver = OpenStackIdentity_3_0_Connection(
auth_url="http://localhost:5000",

View file

@ -2,14 +2,13 @@ import pytest
import salt.utils.path
import salt.utils.platform
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest
from tests.support.sminion import create_sminion
from tests.support.unit import skipIf
@skipIf(not salt.utils.platform.is_windows(), "Tests for only Windows")
@destructiveTest
@pytest.mark.windows_whitelisted
@pytest.mark.destructive_test
class ChocolateyModuleTest(ModuleCase):
"""
Validate Chocolatey module

View file

@ -10,7 +10,6 @@ import salt.utils.user
from tests.support.case import ModuleCase
from tests.support.helpers import (
dedent,
destructiveTest,
skip_if_binaries_missing,
skip_if_not_root,
slowTest,
@ -236,7 +235,7 @@ class CMDModuleTest(ModuleCase):
ret = self.run_function("cmd.script", [script, args], cwd=tmp_cwd)
self.assertEqual(ret["stdout"], args)
@destructiveTest
@pytest.mark.destructive_test
def test_tty(self):
"""
cmd.tty
@ -361,7 +360,7 @@ class CMDModuleTest(ModuleCase):
self.assertEqual(result["retcode"], 0, errmsg)
self.assertEqual(result["stdout"], expected_result, errmsg)
@destructiveTest
@pytest.mark.destructive_test
@skip_if_not_root
@skipIf(salt.utils.platform.is_windows(), "skip windows, uses unix commands")
@slowTest
@ -383,7 +382,7 @@ class CMDModuleTest(ModuleCase):
self.assertNotEqual(user_id, runas_root_id)
self.assertEqual(root_id, runas_root_id)
@destructiveTest
@pytest.mark.destructive_test
@skip_if_not_root
@skipIf(salt.utils.platform.is_windows(), "skip windows, uses unix commands")
@slowTest
@ -407,7 +406,7 @@ class CMDModuleTest(ModuleCase):
).rstrip("\n")
self.assertEqual(tmp_cwd, cwd_runas)
@destructiveTest
@pytest.mark.destructive_test
@skip_if_not_root
@skipIf(not salt.utils.platform.is_darwin(), "applicable to MacOS only")
@slowTest
@ -425,7 +424,7 @@ class CMDModuleTest(ModuleCase):
# profile.
self.assertNotEqual("/bin:/usr/bin", user_path)
@destructiveTest
@pytest.mark.destructive_test
@skip_if_not_root
@skipIf(not salt.utils.platform.is_darwin(), "applicable to MacOS only")
@slowTest
@ -457,7 +456,7 @@ class CMDModuleTest(ModuleCase):
@skipIf(salt.utils.platform.is_windows(), "minion is windows")
@skip_if_not_root
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_runas(self):
"""

View file

@ -4,15 +4,15 @@ import shutil
import pytest
import salt.utils.platform
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, slowTest
from tests.support.helpers import slowTest
from tests.support.unit import skipIf
@destructiveTest
@pytest.mark.windows_whitelisted
@skipIf(salt.utils.platform.is_darwin(), "No mtab on Darwin")
@skipIf(salt.utils.platform.is_freebsd(), "No mtab on FreeBSD")
@skipIf(salt.utils.platform.is_windows(), "No mtab on Windows")
@pytest.mark.destructive_test
class DiskModuleVirtualizationTest(ModuleCase):
"""
Test to make sure we return a clean result under Docker. Refs #8976

View file

@ -6,9 +6,10 @@ import random
import string
import sys
import pytest
import salt.utils.path
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, slowTest
from tests.support.helpers import slowTest
from tests.support.mixins import SaltReturnAssertsMixin
from tests.support.pytest.helpers import temp_state_file
from tests.support.runtests import RUNTIME_VARS
@ -22,8 +23,8 @@ def _random_name(prefix=""):
return ret
@destructiveTest
@skipIf(not salt.utils.path.which("dockerd"), "Docker not installed")
@pytest.mark.destructive_test
class DockerCallTestCase(ModuleCase, SaltReturnAssertsMixin):
"""
Test docker_container states

View file

@ -6,7 +6,7 @@ import pytest
import salt.utils.path
from salt.ext.tornado.httpclient import HTTPClient
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, slowTest
from tests.support.helpers import slowTest
from tests.support.unit import skipIf
@ -20,9 +20,9 @@ def check_status():
return False
@destructiveTest
@skipIf(not salt.utils.path.which("gem"), "Gem is not available")
@pytest.mark.windows_whitelisted
@pytest.mark.destructive_test
class GemModuleTest(ModuleCase):
"""
Validate gem module

View file

@ -3,13 +3,7 @@ import salt.utils.files
import salt.utils.platform
import salt.utils.stringutils
from tests.support.case import ModuleCase
from tests.support.helpers import (
destructiveTest,
random_string,
runs_on,
skip_if_not_root,
slowTest,
)
from tests.support.helpers import random_string, runs_on, skip_if_not_root, slowTest
from tests.support.unit import skipIf
if not salt.utils.platform.is_windows():
@ -17,7 +11,7 @@ if not salt.utils.platform.is_windows():
@skip_if_not_root
@destructiveTest
@pytest.mark.destructive_test
@pytest.mark.windows_whitelisted
@runs_on(kernel=("Linux", "Windows"))
class GroupModuleTest(ModuleCase):
@ -91,7 +85,7 @@ class GroupModuleTest(ModuleCase):
if gid not in busy_gids:
return gid
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_add(self):
"""
@ -105,7 +99,7 @@ class GroupModuleTest(ModuleCase):
# try adding the group again
self.assertFalse(self.run_function("group.add", [self._group], gid=self._gid))
@destructiveTest
@pytest.mark.destructive_test
@skipIf(salt.utils.platform.is_windows(), "Skip on Windows")
@slowTest
def test_add_system_group(self):
@ -123,7 +117,7 @@ class GroupModuleTest(ModuleCase):
# try adding the group again
self.assertFalse(self.run_function("group.add", [self._group]))
@destructiveTest
@pytest.mark.destructive_test
@skipIf(salt.utils.platform.is_windows(), "Skip on Windows")
@slowTest
def test_add_system_group_gid(self):
@ -141,7 +135,7 @@ class GroupModuleTest(ModuleCase):
# try adding the group again
self.assertFalse(self.run_function("group.add", [self._group, gid]))
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_delete(self):
"""

View file

@ -4,17 +4,12 @@ integration tests for shadow linux
import os
import pytest
import salt.modules.linux_shadow
import salt.utils.files
import salt.utils.platform
from tests.support.case import ModuleCase
from tests.support.helpers import (
destructiveTest,
flaky,
random_string,
skip_if_not_root,
slowTest,
)
from tests.support.helpers import flaky, random_string, skip_if_not_root, slowTest
from tests.support.unit import skipIf
@ -37,7 +32,7 @@ class ShadowModuleTest(ModuleCase):
self._test_user = random_string("tu-", uppercase=False)
self._password = salt.modules.linux_shadow.gen_password("Password1234")
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_info(self):
"""
@ -54,7 +49,7 @@ class ShadowModuleTest(ModuleCase):
ret = self.run_function("shadow.info", [self._no_user])
self.assertEqual(ret["name"], "")
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_del_password(self):
"""
@ -72,7 +67,7 @@ class ShadowModuleTest(ModuleCase):
# User does not exist
self.assertFalse(self.run_function("shadow.del_password", [self._no_user]))
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_set_password(self):
"""
@ -91,7 +86,7 @@ class ShadowModuleTest(ModuleCase):
self.run_function("shadow.set_password", [self._no_user, self._password])
)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_set_inactdays(self):
"""
@ -108,7 +103,7 @@ class ShadowModuleTest(ModuleCase):
# User does not exist (set_inactdays return None is user does not exist)
self.assertFalse(self.run_function("shadow.set_inactdays", [self._no_user, 12]))
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_set_maxdays(self):
"""
@ -123,7 +118,7 @@ class ShadowModuleTest(ModuleCase):
# User does not exist (set_inactdays return None is user does not exist)
self.assertFalse(self.run_function("shadow.set_maxdays", [self._no_user, 12]))
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_set_mindays(self):
"""
@ -139,7 +134,7 @@ class ShadowModuleTest(ModuleCase):
self.assertFalse(self.run_function("shadow.set_mindays", [self._no_user, 12]))
@flaky
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_lock_password(self):
"""
@ -155,7 +150,7 @@ class ShadowModuleTest(ModuleCase):
# User does not exist (set_inactdays return None is user does not exist)
self.assertFalse(self.run_function("shadow.lock_password", [self._no_user]))
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_unlock_password(self):
"""
@ -171,7 +166,7 @@ class ShadowModuleTest(ModuleCase):
# User does not exist (set_inactdays return None is user does not exist)
self.assertFalse(self.run_function("shadow.unlock_password", [self._no_user]))
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_set_warndays(self):
"""
@ -186,7 +181,7 @@ class ShadowModuleTest(ModuleCase):
# User does not exist (set_inactdays return None is user does not exist)
self.assertFalse(self.run_function("shadow.set_warndays", [self._no_user, 12]))
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_set_date(self):
"""
@ -205,7 +200,7 @@ class ShadowModuleTest(ModuleCase):
self.run_function("shadow.set_date", [self._no_user, "2016-08-19"])
)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_set_expire(self):
"""
@ -224,7 +219,7 @@ class ShadowModuleTest(ModuleCase):
self.run_function("shadow.set_expire", [self._no_user, "2016-08-25"])
)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_set_del_root_password(self):
"""

View file

@ -1,7 +1,7 @@
import pytest
import salt.utils.platform
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, requires_salt_modules, slowTest
from tests.support.helpers import requires_salt_modules, slowTest
from tests.support.unit import skipIf
@ -30,7 +30,7 @@ class LocaleModuleTest(ModuleCase):
locale = self.run_function("locale.get_locale")
self.assertNotIn("Unsupported platform!", locale)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_gen_locale(self):
# Make sure charmaps are available on test system before attempting
@ -50,7 +50,7 @@ class LocaleModuleTest(ModuleCase):
ret = self.run_function("locale.gen_locale", [new_locale])
self.assertTrue(ret)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_set_locale(self):
original_locale = self.run_function("locale.get_locale")

View file

@ -2,13 +2,14 @@
:codeauthor: Nicole Thomas <nicole@saltstack.com>
"""
import pytest
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, runs_on, skip_if_not_root, slowTest
from tests.support.helpers import runs_on, skip_if_not_root, slowTest
OSA_SCRIPT = "/usr/bin/osascript"
@destructiveTest
@pytest.mark.destructive_test
@skip_if_not_root
@runs_on(kernel="Darwin")
class MacAssistiveTest(ModuleCase):

View file

@ -2,10 +2,10 @@
:codeauthor: Nicole Thomas <nicole@saltstack.com>
"""
import pytest
from salt.exceptions import CommandExecutionError
from tests.support.case import ModuleCase
from tests.support.helpers import (
destructiveTest,
runs_on,
skip_if_binaries_missing,
skip_if_not_root,
@ -18,10 +18,10 @@ ADD_PKG = "algol68g"
DEL_PKG = "acme"
@destructiveTest
@skip_if_not_root
@skip_if_binaries_missing("brew")
@runs_on(kernel="Darwin")
@pytest.mark.destructive_test
class BrewModuleTest(ModuleCase):
"""
Integration tests for the brew module

View file

@ -2,11 +2,12 @@
Integration tests for the mac_desktop execution module.
"""
import pytest
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, runs_on, skip_if_not_root, slowTest
from tests.support.helpers import runs_on, skip_if_not_root, slowTest
@destructiveTest
@pytest.mark.destructive_test
@skip_if_not_root
@runs_on(kernel="Darwin")
class MacDesktopTestCase(ModuleCase):

View file

@ -2,15 +2,10 @@
:codeauthor: Nicole Thomas <nicole@saltstack.com>
"""
import pytest
from salt.exceptions import CommandExecutionError
from tests.support.case import ModuleCase
from tests.support.helpers import (
destructiveTest,
random_string,
runs_on,
skip_if_not_root,
slowTest,
)
from tests.support.helpers import random_string, runs_on, skip_if_not_root, slowTest
# Create group name strings for tests
ADD_GROUP = random_string("RS-", lowercase=False)
@ -20,9 +15,9 @@ ADD_USER = random_string("RS-", lowercase=False)
REP_USER_GROUP = random_string("RS-", lowercase=False)
@destructiveTest
@skip_if_not_root
@runs_on(kernel="Darwin")
@pytest.mark.destructive_test
class MacGroupModuleTest(ModuleCase):
"""
Integration tests for the mac_group module

View file

@ -4,13 +4,14 @@ Validate the mac-keychain module
import os
import pytest
from salt.exceptions import CommandExecutionError
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, runs_on, skip_if_not_root, slowTest
from tests.support.helpers import runs_on, skip_if_not_root, slowTest
from tests.support.runtests import RUNTIME_VARS
@destructiveTest
@pytest.mark.destructive_test
@skip_if_not_root
@runs_on(kernel="Darwin")
class MacKeychainModuleTest(ModuleCase):

View file

@ -4,9 +4,9 @@ integration tests for mac_pkgutil
import os
import pytest
from tests.support.case import ModuleCase
from tests.support.helpers import (
destructiveTest,
requires_system_grains,
runs_on,
skip_if_binaries_missing,
@ -71,7 +71,7 @@ class MacPkgutilModuleTest(ModuleCase):
# Test Package is not installed
self.assertFalse(self.run_function("pkgutil.is_installed", ["spongebob"]))
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_install_forget(self):
"""

View file

@ -2,13 +2,9 @@
integration tests for mac_ports
"""
import pytest
from tests.support.case import ModuleCase
from tests.support.helpers import (
destructiveTest,
runs_on,
skip_if_binaries_missing,
skip_if_not_root,
)
from tests.support.helpers import runs_on, skip_if_binaries_missing, skip_if_not_root
@skip_if_not_root
@ -35,7 +31,7 @@ class MacPortsModuleTest(ModuleCase):
if not self.AGREE_INSTALLED:
self.run_function("pkg.remove", ["agree"])
@destructiveTest
@pytest.mark.destructive_test
def test_list_pkgs(self):
"""
Test pkg.list_pkgs
@ -44,7 +40,7 @@ class MacPortsModuleTest(ModuleCase):
self.assertIsInstance(self.run_function("pkg.list_pkgs"), dict)
self.assertIn("agree", self.run_function("pkg.list_pkgs"))
@destructiveTest
@pytest.mark.destructive_test
def test_latest_version(self):
"""
Test pkg.latest_version
@ -54,7 +50,7 @@ class MacPortsModuleTest(ModuleCase):
self.assertIsInstance(result, dict)
self.assertIn("agree", result)
@destructiveTest
@pytest.mark.destructive_test
def test_remove(self):
"""
Test pkg.remove
@ -64,7 +60,7 @@ class MacPortsModuleTest(ModuleCase):
self.assertIsInstance(removed, dict)
self.assertIn("agree", removed)
@destructiveTest
@pytest.mark.destructive_test
def test_install(self):
"""
Test pkg.install
@ -82,7 +78,7 @@ class MacPortsModuleTest(ModuleCase):
self.run_function("pkg.list_upgrades", refresh=False), dict
)
@destructiveTest
@pytest.mark.destructive_test
def test_upgrade_available(self):
"""
Test pkg.upgrade_available
@ -98,7 +94,7 @@ class MacPortsModuleTest(ModuleCase):
"""
self.assertTrue(self.run_function("pkg.refresh_db"))
@destructiveTest
@pytest.mark.destructive_test
def test_upgrade(self):
"""
Test pkg.upgrade

View file

@ -2,9 +2,9 @@
integration tests for mac_power
"""
import pytest
from tests.support.case import ModuleCase
from tests.support.helpers import (
destructiveTest,
flaky,
runs_on,
skip_if_binaries_missing,
@ -39,7 +39,7 @@ class MacPowerModuleTest(ModuleCase):
self.run_function("power.set_display_sleep", [self.DISPLAY_SLEEP])
self.run_function("power.set_harddisk_sleep", [self.HARD_DISK_SLEEP])
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_computer_sleep(self):
"""
@ -73,7 +73,7 @@ class MacPowerModuleTest(ModuleCase):
self.run_function("power.set_computer_sleep", [True]),
)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_display_sleep(self):
"""
@ -107,7 +107,7 @@ class MacPowerModuleTest(ModuleCase):
self.run_function("power.set_display_sleep", [True]),
)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_harddisk_sleep(self):
"""

View file

@ -4,10 +4,10 @@ integration tests for mac_service
import plistlib
import pytest
import salt.utils.files
from tests.support.case import ModuleCase
from tests.support.helpers import (
destructiveTest,
runs_on,
skip_if_binaries_missing,
skip_if_not_root,
@ -99,7 +99,7 @@ class MacServiceModuleTest(ModuleCase):
"Service not found", self.run_function("service.list", ["spongebob"])
)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_enable(self):
"""
@ -111,7 +111,7 @@ class MacServiceModuleTest(ModuleCase):
"Service not found", self.run_function("service.enable", ["spongebob"])
)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_disable(self):
"""
@ -123,7 +123,7 @@ class MacServiceModuleTest(ModuleCase):
"Service not found", self.run_function("service.disable", ["spongebob"])
)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_start(self):
"""
@ -137,7 +137,7 @@ class MacServiceModuleTest(ModuleCase):
"Service not found", self.run_function("service.start", ["spongebob"])
)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_stop(self):
"""
@ -149,7 +149,7 @@ class MacServiceModuleTest(ModuleCase):
"Service not found", self.run_function("service.stop", ["spongebob"])
)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_status(self):
"""
@ -182,7 +182,7 @@ class MacServiceModuleTest(ModuleCase):
self.assertFalse(self.run_function("service.missing", [self.SERVICE_NAME]))
self.assertTrue(self.run_function("service.missing", ["spongebob"]))
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_enabled(self):
"""
@ -196,7 +196,7 @@ class MacServiceModuleTest(ModuleCase):
self.assertTrue(self.run_function("service.enabled", ["spongebob"]))
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_disabled(self):
"""

View file

@ -4,9 +4,9 @@ integration tests for mac_shadow
import datetime
import pytest
from tests.support.case import ModuleCase
from tests.support.helpers import (
destructiveTest,
random_string,
runs_on,
skip_if_binaries_missing,
@ -51,7 +51,7 @@ class MacShadowModuleTest(ModuleCase):
ret = self.run_function("shadow.info", [NO_USER])
self.assertEqual(ret["name"], "")
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_get_account_created(self):
"""
@ -69,7 +69,7 @@ class MacShadowModuleTest(ModuleCase):
"ERROR: User not found: {}".format(NO_USER),
)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_get_last_change(self):
"""
@ -87,7 +87,7 @@ class MacShadowModuleTest(ModuleCase):
"ERROR: User not found: {}".format(NO_USER),
)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_get_login_failed_last(self):
"""
@ -105,7 +105,7 @@ class MacShadowModuleTest(ModuleCase):
"ERROR: User not found: {}".format(NO_USER),
)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_get_login_failed_count(self):
"""
@ -122,7 +122,7 @@ class MacShadowModuleTest(ModuleCase):
"ERROR: User not found: {}".format(NO_USER),
)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_get_set_maxdays(self):
"""
@ -143,7 +143,7 @@ class MacShadowModuleTest(ModuleCase):
"ERROR: User not found: {}".format(NO_USER),
)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_get_set_change(self):
"""
@ -168,7 +168,7 @@ class MacShadowModuleTest(ModuleCase):
"ERROR: User not found: {}".format(NO_USER),
)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_get_set_expire(self):
"""
@ -193,7 +193,7 @@ class MacShadowModuleTest(ModuleCase):
"ERROR: User not found: {}".format(NO_USER),
)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_del_password(self):
"""
@ -209,7 +209,7 @@ class MacShadowModuleTest(ModuleCase):
"ERROR: User not found: {}".format(NO_USER),
)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_set_password(self):
"""

View file

@ -2,9 +2,9 @@
integration tests for mac_softwareupdate
"""
import pytest
from tests.support.case import ModuleCase
from tests.support.helpers import (
destructiveTest,
runs_on,
skip_if_binaries_missing,
skip_if_not_root,
@ -62,7 +62,7 @@ class MacSoftwareUpdateModuleTest(ModuleCase):
# is the correct type, dict
self.assertIsInstance(self.run_function("softwareupdate.list_available"), dict)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_ignore(self):
"""
@ -82,7 +82,7 @@ class MacSoftwareUpdateModuleTest(ModuleCase):
self.assertIn("spongebob", self.run_function("softwareupdate.list_ignored"))
self.assertIn("squidward", self.run_function("softwareupdate.list_ignored"))
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_schedule(self):
"""
@ -97,7 +97,7 @@ class MacSoftwareUpdateModuleTest(ModuleCase):
self.assertTrue(self.run_function("softwareupdate.schedule_enable", [False]))
self.assertFalse(self.run_function("softwareupdate.schedule_enabled"))
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_update(self):
"""
@ -130,7 +130,7 @@ class MacSoftwareUpdateModuleTest(ModuleCase):
"""
self.assertIsInstance(self.run_function("softwareupdate.list_downloads"), list)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_download(self):
"""
@ -145,7 +145,7 @@ class MacSoftwareUpdateModuleTest(ModuleCase):
self.run_function("softwareupdate.download", ["spongebob"]),
)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_download_all(self):
"""
@ -153,7 +153,7 @@ class MacSoftwareUpdateModuleTest(ModuleCase):
"""
self.assertIsInstance(self.run_function("softwareupdate.download_all"), list)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_get_set_reset_catalog(self):
"""

View file

@ -5,17 +5,18 @@
import os
import random
import pytest
import salt.utils.files
from salt.exceptions import CommandExecutionError
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, runs_on, skip_if_not_root, slowTest
from tests.support.helpers import runs_on, skip_if_not_root, slowTest
# Module Variables
ASSIGN_CMD = "net.inet.icmp.icmplim"
CONFIG = "/etc/sysctl.conf"
@destructiveTest
@pytest.mark.destructive_test
@skip_if_not_root
@runs_on(kernel="Darwin")
class DarwinSysctlModuleTest(ModuleCase):

View file

@ -7,7 +7,6 @@ import logging
import pytest
from tests.support.case import ModuleCase
from tests.support.helpers import (
destructiveTest,
flaky,
random_string,
runs_on,
@ -67,7 +66,7 @@ class MacSystemModuleTest(ModuleCase):
"system.set_disable_keyboard_on_lock", [self.KEYBOARD_DISABLED]
)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_get_set_remote_login(self):
"""
@ -96,7 +95,7 @@ class MacSystemModuleTest(ModuleCase):
self.run_function("system.set_remote_login", ["spongebob"]),
)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_get_set_remote_events(self):
"""
@ -125,7 +124,7 @@ class MacSystemModuleTest(ModuleCase):
self.run_function("system.set_remote_events", ["spongebob"]),
)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_get_set_subnet_name(self):
"""
@ -253,7 +252,7 @@ class MacSystemComputerNameTest(ModuleCase):
# something similar again we may want to skip this gain until we
# investigate
# @skipIf(salt.utils.platform.is_darwin() and six.PY3, 'This test hangs on OS X on Py3. Skipping until #53566 is merged.')
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_get_set_computer_name(self):
"""

View file

@ -11,9 +11,9 @@ Time sync do the following:
import datetime
import pytest
from tests.support.case import ModuleCase
from tests.support.helpers import (
destructiveTest,
flaky,
runs_on,
skip_if_binaries_missing,
@ -66,7 +66,7 @@ class MacTimezoneModuleTest(ModuleCase):
True,
"Skip until we can figure out why modifying the system clock causes ZMQ errors",
)
@destructiveTest
@pytest.mark.destructive_test
def test_get_set_date(self):
"""
Test timezone.get_date
@ -97,7 +97,7 @@ class MacTimezoneModuleTest(ModuleCase):
True,
"Skip until we can figure out why modifying the system clock causes ZMQ errors",
)
@destructiveTest
@pytest.mark.destructive_test
def test_set_time(self):
"""
Test timezone.set_time
@ -115,7 +115,7 @@ class MacTimezoneModuleTest(ModuleCase):
True,
"Skip until we can figure out why modifying the system clock causes ZMQ errors",
)
@destructiveTest
@pytest.mark.destructive_test
def test_get_set_zone(self):
"""
Test timezone.get_zone
@ -135,7 +135,7 @@ class MacTimezoneModuleTest(ModuleCase):
True,
"Skip until we can figure out why modifying the system clock causes ZMQ errors",
)
@destructiveTest
@pytest.mark.destructive_test
def test_get_offset(self):
"""
Test timezone.get_offset
@ -152,7 +152,7 @@ class MacTimezoneModuleTest(ModuleCase):
True,
"Skip until we can figure out why modifying the system clock causes ZMQ errors",
)
@destructiveTest
@pytest.mark.destructive_test
def test_get_set_zonecode(self):
"""
Test timezone.get_zonecode
@ -180,7 +180,7 @@ class MacTimezoneModuleTest(ModuleCase):
True,
"Skip until we can figure out why modifying the system clock causes ZMQ errors",
)
@destructiveTest
@pytest.mark.destructive_test
def test_zone_compare(self):
"""
Test timezone.zone_compare
@ -193,7 +193,7 @@ class MacTimezoneModuleTest(ModuleCase):
True,
"Skip until we can figure out why modifying the system clock causes ZMQ errors",
)
@destructiveTest
@pytest.mark.destructive_test
def test_get_set_using_network_time(self):
"""
Test timezone.get_using_network_time
@ -209,7 +209,7 @@ class MacTimezoneModuleTest(ModuleCase):
True,
"Skip until we can figure out why modifying the system clock causes ZMQ errors",
)
@destructiveTest
@pytest.mark.destructive_test
def test_get_set_time_server(self):
"""
Test timezone.get_time_server

View file

@ -4,16 +4,11 @@
import os
import pytest
import salt.utils.files
from salt.exceptions import CommandExecutionError
from tests.support.case import ModuleCase
from tests.support.helpers import (
destructiveTest,
random_string,
runs_on,
skip_if_not_root,
slowTest,
)
from tests.support.helpers import random_string, runs_on, skip_if_not_root, slowTest
# Create user strings for tests
ADD_USER = random_string("RS-", lowercase=False)
@ -22,9 +17,9 @@ PRIMARY_GROUP_USER = random_string("RS-", lowercase=False)
CHANGE_USER = random_string("RS-", lowercase=False)
@destructiveTest
@skip_if_not_root
@runs_on(kernel="Darwin")
@pytest.mark.destructive_test
class MacUserModuleTest(ModuleCase):
"""
Integration tests for the mac_user module

View file

@ -1,16 +1,16 @@
"""
Validate the mac-defaults module
"""
import pytest
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, runs_on, skip_if_not_root
from tests.support.helpers import runs_on, skip_if_not_root
DEFAULT_DOMAIN = "com.apple.AppleMultitouchMouse"
DEFAULT_KEY = "MouseHorizontalScroll"
DEFAULT_VALUE = "0"
@destructiveTest
@pytest.mark.destructive_test
@skip_if_not_root
@runs_on(kernel="Darwin")
class MacDefaultsModuleTest(ModuleCase):

View file

@ -4,7 +4,6 @@ import pytest
import salt.utils.path
from salt.modules import mysql as mysqlmod
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest
from tests.support.mixins import SaltReturnAssertsMixin
from tests.support.unit import skipIf
@ -34,7 +33,7 @@ class MysqlModuleDbTest(ModuleCase, SaltReturnAssertsMixin):
user = "root"
password = "poney"
@destructiveTest
@pytest.mark.destructive_test
def setUp(self):
"""
Test presence of MySQL server, enforce a root password
@ -119,7 +118,7 @@ class MysqlModuleDbTest(ModuleCase, SaltReturnAssertsMixin):
True, ret, "Problem while removing db for db name: '{}'".format(db_name)
)
@destructiveTest
@pytest.mark.destructive_test
def test_database_creation_level1(self):
"""
Create database, test presence, then drop db. All theses with complex names.
@ -218,7 +217,7 @@ class MysqlModuleDbTest(ModuleCase, SaltReturnAssertsMixin):
connection_pass=self.password,
)
@destructiveTest
@pytest.mark.destructive_test
def test_mysql_dbname_character_percent(self):
"""
Play with the '%' character problems
@ -274,7 +273,7 @@ class MysqlModuleDbTest(ModuleCase, SaltReturnAssertsMixin):
)
self.assertEqual(True, ret)
@destructiveTest
@pytest.mark.destructive_test
def test_database_creation_utf8(self):
"""
Test support of utf8 in database names
@ -330,7 +329,7 @@ class MysqlModuleDbTest(ModuleCase, SaltReturnAssertsMixin):
saltenv={"LC_ALL": "en_US.utf8"},
)
@destructiveTest
@pytest.mark.destructive_test
def test_database_maintenance(self):
"""
Test maintenance operations on a created database
@ -652,7 +651,7 @@ class MysqlModuleUserTest(ModuleCase, SaltReturnAssertsMixin):
user = "root"
password = "poney"
@destructiveTest
@pytest.mark.destructive_test
def setUp(self):
"""
Test presence of MySQL server, enforce a root password
@ -777,7 +776,7 @@ class MysqlModuleUserTest(ModuleCase, SaltReturnAssertsMixin):
),
)
@destructiveTest
@pytest.mark.destructive_test
def test_user_management(self):
"""
Test various users creation settings
@ -1339,7 +1338,7 @@ class MysqlModuleUserGrantTest(ModuleCase, SaltReturnAssertsMixin):
"user4": {"name": "user \xe6\xa8\x99", "pwd": "\xe6\xa8\x99\xe6\xa8\x99"},
}
@destructiveTest
@pytest.mark.destructive_test
def setUp(self):
"""
Test presence of MySQL server, enforce a root password, create users
@ -1417,7 +1416,7 @@ class MysqlModuleUserGrantTest(ModuleCase, SaltReturnAssertsMixin):
connection_pass=self.password,
)
@destructiveTest
@pytest.mark.destructive_test
def tearDown(self):
"""
Removes created users and db
@ -1513,7 +1512,7 @@ class MysqlModuleUserGrantTest(ModuleCase, SaltReturnAssertsMixin):
).format(user, grant, repr(ret)),
)
@destructiveTest
@pytest.mark.destructive_test
def testGrants(self):
"""
Test user grant methods
@ -1713,7 +1712,7 @@ class MysqlModuleFileQueryTest(ModuleCase, SaltReturnAssertsMixin):
password = "poney"
testdb = "test_file_query"
@destructiveTest
@pytest.mark.destructive_test
def setUp(self):
"""
Test presence of MySQL server, enforce a root password, create users
@ -1754,7 +1753,7 @@ class MysqlModuleFileQueryTest(ModuleCase, SaltReturnAssertsMixin):
connection_db="mysql",
)
@destructiveTest
@pytest.mark.destructive_test
def tearDown(self):
"""
Removes created users and db
@ -1767,7 +1766,7 @@ class MysqlModuleFileQueryTest(ModuleCase, SaltReturnAssertsMixin):
connection_db="mysql",
)
@destructiveTest
@pytest.mark.destructive_test
def test_update_file_query(self):
"""
Test query without any output
@ -1785,7 +1784,7 @@ class MysqlModuleFileQueryTest(ModuleCase, SaltReturnAssertsMixin):
ret.pop("query time")
self.assertEqual(ret, {"rows affected": 2})
@destructiveTest
@pytest.mark.destructive_test
def test_select_file_query(self):
"""
Test query with table output

View file

@ -7,16 +7,12 @@ import re
import shutil
import time
import pytest
import salt.modules.nilrt_ip as ip
import salt.utils.files
import salt.utils.platform
from tests.support.case import ModuleCase
from tests.support.helpers import (
destructiveTest,
requires_system_grains,
runs_on,
skip_if_not_root,
)
from tests.support.helpers import requires_system_grains, runs_on, skip_if_not_root
from tests.support.unit import skipIf
try:
@ -34,10 +30,10 @@ INTERFACE_FOR_TEST = "eth1"
@skip_if_not_root
@destructiveTest
@skipIf(not pyiface, "The python pyiface package is not installed")
@skipIf(not CaseInsensitiveDict, "The python package requests is not installed")
@runs_on(os_family="NILinuxRT", reason="Tests applicable only to NILinuxRT")
@pytest.mark.destructive_test
class NilrtIpModuleTest(ModuleCase):
"""
Validate the nilrt_ip module
@ -275,7 +271,7 @@ class NilrtIpModuleTest(ModuleCase):
self.assertEqual(interface["ipv4"]["requestmode"], "dhcp_linklocal")
break
@destructiveTest
@pytest.mark.destructive_test
def test_dhcp_disable(self):
"""
Test cases:
@ -310,7 +306,7 @@ class NilrtIpModuleTest(ModuleCase):
self.assertEqual(interface["ipv4"]["requestmode"], "dhcp_linklocal")
break
@destructiveTest
@pytest.mark.destructive_test
def test_dhcp_static(self):
"""
Test cases:
@ -360,7 +356,7 @@ class NilrtIpModuleTest(ModuleCase):
self.assertEqual(interface["ipv4"]["requestmode"], "dhcp_linklocal")
break
@destructiveTest
@pytest.mark.destructive_test
def test_static_disable(self):
"""
Test cases:

View file

@ -7,7 +7,6 @@ import salt.utils.pkg
import salt.utils.platform
from tests.support.case import ModuleCase
from tests.support.helpers import (
destructiveTest,
requires_network,
requires_salt_modules,
requires_salt_states,
@ -76,7 +75,7 @@ class PkgModuleTest(ModuleCase, SaltReturnAssertsMixin):
self.assertEqual(self.run_function(func, eq), 0)
self.assertEqual(self.run_function(func, gt), 1)
@destructiveTest
@pytest.mark.destructive_test
@requires_salt_modules("pkg.mod_repo", "pkg.del_repo", "pkg.get_repo")
@requires_network()
@requires_system_grains
@ -213,7 +212,7 @@ class PkgModuleTest(ModuleCase, SaltReturnAssertsMixin):
ret = self.run_function(func, ["/usr/local/bin/salt-call"])
self.assertNotEqual(len(ret), 0)
@destructiveTest
@pytest.mark.destructive_test
@requires_salt_modules("pkg.version", "pkg.install", "pkg.remove")
@requires_network()
@slowTest
@ -241,7 +240,7 @@ class PkgModuleTest(ModuleCase, SaltReturnAssertsMixin):
test_install()
test_remove()
@destructiveTest
@pytest.mark.destructive_test
@requires_salt_modules(
"pkg.hold",
"pkg.unhold",
@ -296,7 +295,7 @@ class PkgModuleTest(ModuleCase, SaltReturnAssertsMixin):
ret = self.run_state("pkg.removed", name=versionlock_pkg)
self.assertSaltTrueReturn(ret)
@destructiveTest
@pytest.mark.destructive_test
@requires_salt_modules("pkg.refresh_db")
@requires_network()
@requires_system_grains
@ -360,7 +359,7 @@ class PkgModuleTest(ModuleCase, SaltReturnAssertsMixin):
self.assertIn(self.pkg, keys)
@skipIf(True, "Temporary Skip - Causes centos 8 test to fail")
@destructiveTest
@pytest.mark.destructive_test
@requires_network()
@requires_salt_modules(
"pkg.refresh_db",
@ -440,7 +439,7 @@ class PkgModuleTest(ModuleCase, SaltReturnAssertsMixin):
ret = self.run_function(func, args)
self.assertNotEqual(ret, {})
@destructiveTest
@pytest.mark.destructive_test
@skipIf(
salt.utils.platform.is_darwin(),
"The jenkins user is equivalent to root on mac, causing the test to be unrunnable",

View file

@ -5,18 +5,14 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
import pytest
from tests.support.case import ModuleCase
from tests.support.helpers import (
destructiveTest,
random_string,
runs_on,
skip_if_not_root,
)
from tests.support.helpers import random_string, runs_on, skip_if_not_root
@runs_on(kernel="FreeBSD")
class PwUserModuleTest(ModuleCase):
@destructiveTest
@pytest.mark.destructive_test
@skip_if_not_root
def test_groups_includes_primary(self):
# Let's create a user, which usually creates the group matching the name

View file

@ -3,11 +3,11 @@ import salt.utils.path
import salt.utils.platform
import salt.utils.systemd
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, flaky, slowTest
from tests.support.helpers import flaky, slowTest
from tests.support.unit import skipIf
@destructiveTest
@pytest.mark.destructive_test
@pytest.mark.windows_whitelisted
class ServiceModuleTest(ModuleCase):
"""

View file

@ -2,18 +2,19 @@
Integration tests for the docker swarm modules
"""
import pytest
import salt.utils.path
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, slowTest
from tests.support.helpers import slowTest
from tests.support.mixins import SaltReturnAssertsMixin
from tests.support.unit import skipIf
@destructiveTest
@skipIf(
not any(salt.utils.path.which(exe) for exe in ("dockerd", "docker")),
"Docker not installed",
)
@pytest.mark.destructive_test
class SwarmCallTestCase(ModuleCase, SaltReturnAssertsMixin):
"""
Test docker swarm states

View file

@ -1,7 +1,7 @@
import sys
import pytest
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest
from tests.support.unit import skipIf
@ -23,7 +23,7 @@ class SysrcModuleTest(ModuleCase):
)
@skipIf(not sys.platform.startswith("freebsd"), "FreeBSD specific")
@destructiveTest
@pytest.mark.destructive_test
def test_set(self):
ret = self.run_function("sysrc.set", ["test_var", "1"])
self.assertIsInstance(
@ -41,7 +41,7 @@ class SysrcModuleTest(ModuleCase):
self.assertEqual("test_var removed", ret)
@skipIf(not sys.platform.startswith("freebsd"), "FreeBSD specific")
@destructiveTest
@pytest.mark.destructive_test
def test_set_bool(self):
ret = self.run_function("sysrc.set", ["test_var", True])
self.assertIsInstance(

View file

@ -12,13 +12,7 @@ import salt.utils.files
import salt.utils.path
import salt.utils.platform
from tests.support.case import ModuleCase
from tests.support.helpers import (
destructiveTest,
flaky,
runs_on,
skip_if_not_root,
slowTest,
)
from tests.support.helpers import flaky, runs_on, skip_if_not_root, slowTest
from tests.support.unit import skipIf
log = logging.getLogger(__name__)
@ -192,7 +186,7 @@ class SystemModuleTest(ModuleCase):
msg = "Difference in times is too large. Now: {} Fake: {}".format(t1, t2)
self.assertTrue(self._same_times(t1, t2, seconds_diff=2), msg=msg)
@destructiveTest
@pytest.mark.destructive_test
@skip_if_not_root
@slowTest
def test_set_system_date_time(self):
@ -211,7 +205,7 @@ class SystemModuleTest(ModuleCase):
self.assertTrue(result and self._same_times(time_now, cmp_time), msg=msg)
self._test_hwclock_sync()
@destructiveTest
@pytest.mark.destructive_test
@skip_if_not_root
@slowTest
def test_set_system_date_time_utc(self):
@ -231,7 +225,7 @@ class SystemModuleTest(ModuleCase):
self.assertTrue(self._same_times(time_now, cmp_time), msg=msg)
self._test_hwclock_sync()
@destructiveTest
@pytest.mark.destructive_test
@skip_if_not_root
@slowTest
def test_set_system_date_time_utcoffset_east(self):
@ -253,7 +247,7 @@ class SystemModuleTest(ModuleCase):
self.assertTrue(self._same_times(time_now, cmp_time), msg=msg)
self._test_hwclock_sync()
@destructiveTest
@pytest.mark.destructive_test
@skip_if_not_root
@slowTest
def test_set_system_date_time_utcoffset_west(self):
@ -276,7 +270,7 @@ class SystemModuleTest(ModuleCase):
self._test_hwclock_sync()
@flaky
@destructiveTest
@pytest.mark.destructive_test
@skip_if_not_root
@slowTest
def test_set_system_time(self):
@ -297,7 +291,7 @@ class SystemModuleTest(ModuleCase):
self.assertTrue(self._same_times(time_now, cmp_time), msg=msg)
self._test_hwclock_sync()
@destructiveTest
@pytest.mark.destructive_test
@skip_if_not_root
@slowTest
def test_set_system_date(self):
@ -340,7 +334,7 @@ class SystemModuleTest(ModuleCase):
data = mach_info.read()
self.assertIn(res, data.decode("string_escape"))
@destructiveTest
@pytest.mark.destructive_test
@skip_if_not_root
@slowTest
def test_set_computer_desc(self):
@ -355,7 +349,7 @@ class SystemModuleTest(ModuleCase):
self.assertTrue(ret)
self.assertIn(desc, computer_desc)
@destructiveTest
@pytest.mark.destructive_test
@skip_if_not_root
@slowTest
def test_set_computer_desc_multiline(self):
@ -411,7 +405,7 @@ class WinSystemModuleTest(ModuleCase):
name = socket.gethostname()
self.assertEqual(name, ret)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_set_computer_desc(self):
"""
@ -491,7 +485,7 @@ class WinSystemModuleTimeSettingTest(ModuleCase):
log.error("Re-syncing time failed")
@skipIf(True, "WAR ROOM 7/18/2019, unit test?")
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_set_system_time(self):
"""
@ -505,7 +499,7 @@ class WinSystemModuleTimeSettingTest(ModuleCase):
self.assertEqual(new_time, test_time)
@skipIf(True, "WAR ROOM 7/18/2019, unit test?")
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_set_system_date(self):
"""

View file

@ -5,9 +5,9 @@ Linux and Solaris are supported
"""
import pytest
import salt.utils.platform
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest
from tests.support.unit import skipIf
try:
@ -65,7 +65,7 @@ class TimezoneWindowsModuleTest(ModuleCase):
ret = self.run_function("timezone.get_hwclock")
self.assertIn(ret, timescale)
@destructiveTest
@pytest.mark.destructive_test
def test_get_zone(self):
"""
test timezone.set_zone, get_zone and zone_compare

View file

@ -1,7 +1,6 @@
import pytest
from tests.support.case import ModuleCase
from tests.support.helpers import (
destructiveTest,
random_string,
requires_system_grains,
runs_on,
@ -10,9 +9,9 @@ from tests.support.helpers import (
)
@destructiveTest
@skip_if_not_root
@runs_on(kernel="Linux")
@pytest.mark.destructive_test
class UseraddModuleTestLinux(ModuleCase):
@requires_system_grains
@slowTest
@ -81,10 +80,10 @@ class UseraddModuleTestLinux(ModuleCase):
raise
@destructiveTest
@skip_if_not_root
@runs_on(kernel="Windows")
@pytest.mark.windows_whitelisted
@pytest.mark.destructive_test
class UseraddModuleTestWindows(ModuleCase):
def setUp(self):
self.user_name = random_string("RS-", lowercase=False)

View file

@ -5,9 +5,10 @@ Integration tests for the vault execution module
import logging
import time
import pytest
import salt.utils.path
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, slowTest
from tests.support.helpers import slowTest
from tests.support.runtests import RUNTIME_VARS
from tests.support.sminion import create_sminion
from tests.support.unit import SkipTest, skipIf
@ -17,9 +18,9 @@ log = logging.getLogger(__name__)
VAULT_BINARY_PATH = salt.utils.path.which("vault")
@destructiveTest
@skipIf(not salt.utils.path.which("dockerd"), "Docker not installed")
@skipIf(not VAULT_BINARY_PATH, "Vault not installed")
@pytest.mark.destructive_test
class VaultTestCase(ModuleCase):
"""
Test vault module
@ -138,9 +139,9 @@ class VaultTestCase(ModuleCase):
}
@destructiveTest
@skipIf(not salt.utils.path.which("dockerd"), "Docker not installed")
@skipIf(not salt.utils.path.which("vault"), "Vault not installed")
@pytest.mark.destructive_test
class VaultTestCaseCurrent(ModuleCase):
"""
Test vault module against current vault

View file

@ -1,7 +1,7 @@
import pytest
import salt.utils.platform
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, slowTest
from tests.support.helpers import slowTest
from tests.support.unit import skipIf
@ -12,8 +12,8 @@ class WinDNSTest(ModuleCase):
Test for salt.modules.win_dns_client
"""
@destructiveTest
@slowTest
@pytest.mark.destructive_test
def test_add_remove_dns(self):
"""
Test add and removing a dns server

View file

@ -1,9 +1,9 @@
import os
import pytest
import salt.utils.files
import salt.utils.platform
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest
from tests.support.runtests import RUNTIME_VARS
from tests.support.unit import skipIf
@ -36,7 +36,7 @@ class DscModuleTest(ModuleCase):
os.remove(self.psd1file)
super().tearDown()
@destructiveTest
@pytest.mark.destructive_test
def test_compile_config(self):
ret = self.run_function(
"dsc.compile_config",

View file

@ -1,7 +1,7 @@
import pytest
import salt.utils.platform
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, slowTest
from tests.support.helpers import slowTest
from tests.support.unit import skipIf
@ -24,7 +24,7 @@ class FirewallTest(ModuleCase):
else:
self.assertTrue(self.run_function("firewall.disable", profile=net))
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_firewall_get_config(self):
"""
@ -39,7 +39,7 @@ class FirewallTest(ModuleCase):
self.assertTrue(ret[net])
self._pre_firewall_status(pre_run)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_firewall_disable(self):
"""
@ -57,7 +57,7 @@ class FirewallTest(ModuleCase):
self.assertFalse(ret)
self._pre_firewall_status(pre_run)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_firewall_enable(self):
"""
@ -87,7 +87,7 @@ class FirewallTest(ModuleCase):
for check in checks:
self.assertIn(check, ret[rule])
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_firewall_add_delete_rule(self):
"""

View file

@ -2,11 +2,12 @@ import logging
import os
import re
import pytest
import salt.utils.files
import salt.utils.platform
import salt.utils.win_reg as reg
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, random_string
from tests.support.helpers import random_string
from tests.support.runtests import RUNTIME_VARS
from tests.support.unit import skipIf
@ -312,7 +313,7 @@ class WinLgpoTest(ModuleCase):
)
log.debug("ret from archive.unzip == %s", ret)
@destructiveTest
@pytest.mark.destructive_test
def test_set_user_policy_point_and_print_restrictions(self):
"""
Test setting/unsetting/changing the PointAndPrint_Restrictions user policy
@ -361,7 +362,7 @@ class WinLgpoTest(ModuleCase):
policy_class="User",
)
@destructiveTest
@pytest.mark.destructive_test
def test_set_computer_policy_NTP_Client(self):
"""
Test setting/unsetting/changing NTP Client policies
@ -411,7 +412,7 @@ class WinLgpoTest(ModuleCase):
],
)
@destructiveTest
@pytest.mark.destructive_test
def test_set_computer_policy_RA_Unsolicit(self):
"""
Test setting/unsetting/changing RA_Unsolicit policy
@ -453,7 +454,7 @@ class WinLgpoTest(ModuleCase):
],
)
@destructiveTest
@pytest.mark.destructive_test
def test_set_computer_policy_Pol_HardenedPaths(self):
# Disable Pol_HardenedPaths
log.debug("Attempting to disable Pol_HardenedPaths")
@ -489,7 +490,7 @@ class WinLgpoTest(ModuleCase):
],
)
@destructiveTest
@pytest.mark.destructive_test
def test_set_computer_policy_WindowsUpdate(self):
"""
Test setting/unsetting/changing WindowsUpdate policy
@ -624,7 +625,7 @@ class WinLgpoTest(ModuleCase):
],
)
@destructiveTest
@pytest.mark.destructive_test
def test_set_computer_policy_ClipboardRedirection(self):
"""
Test setting/unsetting/changing ClipboardRedirection policy
@ -652,7 +653,7 @@ class WinLgpoTest(ModuleCase):
],
)
@destructiveTest
@pytest.mark.destructive_test
def test_set_computer_policy_LockoutDuration(self):
"""
Test setting LockoutDuration
@ -673,7 +674,7 @@ class WinLgpoTest(ModuleCase):
# set LockoutDuration zero value, the secedit zero value is -1
self._testSeceditPolicy("LockoutDuration", 0, [r"^LockoutDuration = -1"])
@destructiveTest
@pytest.mark.destructive_test
def test_set_computer_policy_GuestAccountStatus(self):
"""
Test setting/unsetting/changing GuestAccountStatus
@ -687,7 +688,7 @@ class WinLgpoTest(ModuleCase):
"GuestAccountStatus", "Enabled", [r"^EnableGuestAccount = 1"]
)
@destructiveTest
@pytest.mark.destructive_test
def test_set_computer_policy_PasswordComplexity(self):
"""
Test setting/unsetting/changing PasswordComplexity
@ -703,7 +704,7 @@ class WinLgpoTest(ModuleCase):
"PasswordComplexity", "Enabled", [r"^PasswordComplexity = 1"]
)
@destructiveTest
@pytest.mark.destructive_test
def test_set_computer_policy_PasswordLen(self):
"""
Test setting/unsetting/changing PasswordLength
@ -715,7 +716,7 @@ class WinLgpoTest(ModuleCase):
# set MinimumPasswordLength = 0
self._testSeceditPolicy("MinPasswordLen", 0, [r"^MinimumPasswordLength = 0"])
@destructiveTest
@pytest.mark.destructive_test
def test_set_computer_policy_SeNetworkLogonRight(self):
"""
Test setting/unsetting/changing PasswordLength
@ -736,7 +737,7 @@ class WinLgpoTest(ModuleCase):
],
)
@destructiveTest
@pytest.mark.destructive_test
def test_set_computer_policy_multipleAdmxPolicies(self):
"""
Tests setting several ADMX policies in succession and validating the configuration w/lgop
@ -784,7 +785,7 @@ class WinLgpoTest(ModuleCase):
],
)
@destructiveTest
@pytest.mark.destructive_test
def test_set_computer_policy_DisableDomainCreds(self):
"""
Tests Enable/Disable of DisableDomainCreds policy
@ -806,7 +807,7 @@ class WinLgpoTest(ModuleCase):
expected_value_data=0,
)
@destructiveTest
@pytest.mark.destructive_test
def test_set_computer_policy_ForceGuest(self):
"""
Tests changing ForceGuest policy
@ -828,7 +829,7 @@ class WinLgpoTest(ModuleCase):
expected_value_data=0,
)
@destructiveTest
@pytest.mark.destructive_test
def test_set_computer_policy_DisableUXWUAccess(self):
"""
Tests changing DisableUXWUAccess
@ -865,7 +866,7 @@ class WinLgpoTest(ModuleCase):
],
)
@destructiveTest
@pytest.mark.destructive_test
def test_set_computer_policy_Access_data_sources_across_domains(self):
"""
Tests that a policy that has multiple names
@ -895,7 +896,7 @@ class WinLgpoTest(ModuleCase):
],
)
@destructiveTest
@pytest.mark.destructive_test
def test_set_computer_policy_ActiveHours(self):
"""
Test configuring the ActiveHours policy, #47784
@ -951,7 +952,7 @@ class WinLgpoTest(ModuleCase):
],
)
@destructiveTest
@pytest.mark.destructive_test
def test_set_computer_policy_AllowTelemetry(self):
"""
Tests that a the AllowTelemetry policy is applied correctly and that it
@ -1029,7 +1030,7 @@ class WinLgpoTest(ModuleCase):
}
self.assertDictEqual(result[name]["changes"], expected)
@destructiveTest
@pytest.mark.destructive_test
def test_set_computer_policy_ScRemoveOption(self):
"""
Tests changing ScRemoveOption policy
@ -1063,7 +1064,7 @@ class WinLgpoTest(ModuleCase):
False,
)
@destructiveTest
@pytest.mark.destructive_test
def test_set_sxs_servicing_policy(self):
"""
Test setting/unsetting/changing sxs-servicing policy

View file

@ -1,7 +1,7 @@
import pytest
import salt.utils.platform
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, flaky, slowTest
from tests.support.helpers import flaky, slowTest
from tests.support.unit import skipIf
@ -13,7 +13,7 @@ class NTPTest(ModuleCase):
Validate windows ntp module
"""
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_ntp_set_servers(self):
"""

View file

@ -5,7 +5,7 @@ import pytest
import salt.utils.files
import salt.utils.platform
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, slowTest
from tests.support.helpers import slowTest
from tests.support.runtests import RUNTIME_VARS
from tests.support.unit import skipIf
@ -32,7 +32,7 @@ class WinPKGTest(ModuleCase):
if os.path.isfile(self.curl_sls_path):
os.remove(self.curl_sls_path)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_adding_removing_pkg_sls(self):
"""

View file

@ -1,8 +1,8 @@
import pytest
import salt.modules.win_task as task
import salt.utils.platform
from salt.exceptions import CommandExecutionError
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest
from tests.support.unit import skipIf
@ -12,7 +12,7 @@ class WinTasksTest(ModuleCase):
Tests for salt.modules.win_task.
"""
@destructiveTest
@pytest.mark.destructive_test
def test_adding_task_with_xml(self):
"""
Test adding a task using xml
@ -70,7 +70,7 @@ class WinTasksTest(ModuleCase):
all_tasks = self.run_function("task.list_tasks")
self.assertIn("foo", all_tasks)
@destructiveTest
@pytest.mark.destructive_test
def test_adding_task_with_invalid_xml(self):
"""
Test adding a task using a malformed xml

View file

@ -3,10 +3,11 @@ Integration Tests for restcherry salt-api with pam eauth
"""
import urllib.parse
import pytest
import salt.utils.platform
import tests.support.cherrypy_testclasses as cptc
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, skip_if_not_root, slowTest
from tests.support.helpers import skip_if_not_root, slowTest
from tests.support.unit import skipIf
if cptc.HAS_CHERRYPY:
@ -25,7 +26,7 @@ class TestAuthPAM(cptc.BaseRestCherryPyTest, ModuleCase):
Test auth with pam using salt-api
"""
@destructiveTest
@pytest.mark.destructive_test
@skip_if_not_root
def setUp(self):
super().setUp()
@ -120,7 +121,7 @@ class TestAuthPAM(cptc.BaseRestCherryPyTest, ModuleCase):
)
self.assertEqual(response.status, "200 OK")
@destructiveTest
@pytest.mark.destructive_test
@skip_if_not_root
def tearDown(self):
"""

View file

@ -88,12 +88,7 @@ from tests.support.gitfs import ( # pylint: disable=unused-import
webserver_pillar_tests_prep,
webserver_pillar_tests_prep_authenticated,
)
from tests.support.helpers import (
destructiveTest,
requires_system_grains,
skip_if_not_root,
slowTest,
)
from tests.support.helpers import requires_system_grains, skip_if_not_root, slowTest
from tests.support.unit import skipIf
# Check for requisite components
@ -687,12 +682,12 @@ class GitPythonMixin:
self.assertEqual(excinfo.exception.strerror, "Failed to load git_pillar")
@destructiveTest
@skipIf(_windows_or_mac(), "minion is windows or mac")
@skip_if_not_root
@skipIf(not HAS_GITPYTHON, "GitPython >= {} required".format(GITPYTHON_MINVER))
@skipIf(not HAS_SSHD, "sshd not present")
@pytest.mark.usefixtures("ssh_pillar_tests_prep")
@pytest.mark.destructive_test
class TestGitPythonSSH(GitPillarSSHTestBase, GitPythonMixin):
"""
Test git_pillar with GitPython using SSH authentication
@ -731,7 +726,6 @@ class TestGitPythonAuthenticatedHTTP(TestGitPythonHTTP, GitPythonMixin):
password = PASSWORD
@destructiveTest
@skipIf(_windows_or_mac(), "minion is windows or mac")
@skip_if_not_root
@skipIf(
@ -740,6 +734,7 @@ class TestGitPythonAuthenticatedHTTP(TestGitPythonHTTP, GitPythonMixin):
)
@skipIf(not HAS_SSHD, "sshd not present")
@pytest.mark.usefixtures("ssh_pillar_tests_prep")
@pytest.mark.destructive_test
class TestPygit2SSH(GitPillarSSHTestBase):
"""
Test git_pillar with pygit2 using SSH authentication

View file

@ -7,7 +7,7 @@ import salt.utils.files
import salt.utils.platform
import salt.utils.stringutils
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, slowTest
from tests.support.helpers import slowTest
@pytest.mark.windows_whitelisted
@ -24,7 +24,7 @@ class PyDSLRendererIncludeTestCase(ModuleCase):
if self.directory_created:
shutil.rmtree("\\tmp")
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_rendering_includes(self):
"""

View file

@ -9,12 +9,12 @@ import pytest
import salt.utils.files
import salt.utils.path
from tests.support.case import ModuleCase, SPMCase
from tests.support.helpers import destructiveTest, slowTest
from tests.support.helpers import slowTest
from tests.support.unit import skipIf
@destructiveTest
@pytest.mark.windows_whitelisted
@pytest.mark.destructive_test
class SPMBuildTest(SPMCase, ModuleCase):
"""
Validate the spm build command

View file

@ -7,11 +7,11 @@ import shutil
import pytest
from tests.support.case import SPMCase
from tests.support.helpers import destructiveTest, slowTest
from tests.support.helpers import slowTest
@destructiveTest
@pytest.mark.windows_whitelisted
@pytest.mark.destructive_test
class SPMFilesTest(SPMCase):
"""
Validate the spm files command

View file

@ -6,11 +6,11 @@ import shutil
import pytest
from tests.support.case import SPMCase
from tests.support.helpers import destructiveTest, slowTest
from tests.support.helpers import slowTest
@destructiveTest
@pytest.mark.windows_whitelisted
@pytest.mark.destructive_test
class SPMInfoTest(SPMCase):
"""
Validate the spm info command

View file

@ -10,10 +10,10 @@ import salt.utils.files
import salt.utils.path
import salt.utils.yaml
from tests.support.case import SPMCase
from tests.support.helpers import Webserver, destructiveTest, slowTest
from tests.support.helpers import Webserver, slowTest
@destructiveTest
@pytest.mark.destructive_test
@pytest.mark.windows_whitelisted
class SPMInstallTest(SPMCase):
"""

View file

@ -7,11 +7,11 @@ import shutil
import pytest
from tests.support.case import SPMCase
from tests.support.helpers import destructiveTest, slowTest
from tests.support.helpers import slowTest
@destructiveTest
@pytest.mark.windows_whitelisted
@pytest.mark.destructive_test
class SPMRemoveTest(SPMCase):
"""
Validate the spm remove command

View file

@ -7,11 +7,10 @@ import shutil
import pytest
from tests.support.case import SPMCase
from tests.support.helpers import destructiveTest
@destructiveTest
@pytest.mark.windows_whitelisted
@pytest.mark.destructive_test
class SPMRepoTest(SPMCase):
"""
Validate commands related to spm repo

View file

@ -4,8 +4,9 @@ Integration tests for the alternatives state module
import os
import pytest
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, slowTest
from tests.support.helpers import slowTest
from tests.support.mixins import SaltReturnAssertsMixin
from tests.support.runtests import RUNTIME_VARS
from tests.support.unit import skipIf
@ -17,7 +18,7 @@ if not os.path.exists("/etc/alternatives"):
@skipIf(NO_ALTERNATIVES, "/etc/alternatives does not exist on the system")
class AlterantivesStateTest(ModuleCase, SaltReturnAssertsMixin):
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_install_set_and_remove(self):
ret = self.run_state(

View file

@ -11,13 +11,13 @@ import salt.utils.files
import salt.utils.path
import yaml
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, flaky, requires_system_grains
from tests.support.helpers import flaky, requires_system_grains
from tests.support.mixins import SaltReturnAssertsMixin
from tests.support.runtests import RUNTIME_VARS
from tests.support.unit import SkipTest, skipIf
@destructiveTest
@pytest.mark.destructive_test
@pytest.mark.requires_sshd_server
@skipIf(
not salt.utils.path.which("ansible-playbook"), "ansible-playbook is not installed"

View file

@ -2,17 +2,18 @@
:codeauthor: Alexander Pyatkin <asp@thexyz.net
"""
import pytest
import salt.utils.json
import salt.utils.path
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, slowTest
from tests.support.helpers import slowTest
from tests.support.mixins import SaltReturnAssertsMixin
from tests.support.unit import skipIf
@skipIf(salt.utils.path.which("bower") is None, "bower not installed")
class BowerStateTest(ModuleCase, SaltReturnAssertsMixin):
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_bower_installed_removed(self):
"""
@ -32,7 +33,7 @@ class BowerStateTest(ModuleCase, SaltReturnAssertsMixin):
ret = self.run_state("file.absent", name="/salt_test_bower_1")
self.assertSaltTrueReturn(ret)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_bower_installed_pkgs(self):
"""
@ -51,7 +52,7 @@ class BowerStateTest(ModuleCase, SaltReturnAssertsMixin):
ret = self.run_state("file.absent", name="/salt_test_bower_2")
self.assertSaltTrueReturn(ret)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_bower_installed_from_file(self):
ret = self.run_state("file.directory", name="/salt_test_bower_3", makedirs=True)

View file

@ -4,9 +4,9 @@ Tests for the Chocolatey State
import logging
import pytest
import salt.utils.platform
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest
from tests.support.mixins import SaltReturnAssertsMixin
from tests.support.unit import skipIf
@ -15,8 +15,8 @@ log = logging.getLogger(__name__)
__testcontext__ = {}
@destructiveTest
@skipIf(not salt.utils.platform.is_windows(), "Windows Specific Test")
@pytest.mark.destructive_test
class ChocolateyTest(ModuleCase, SaltReturnAssertsMixin):
"""
Chocolatey State Tests

View file

@ -9,6 +9,7 @@ import os
import subprocess
import tempfile
import pytest
import salt.utils.files
import salt.utils.network
import salt.utils.path
@ -16,7 +17,7 @@ from salt.exceptions import CommandExecutionError
from salt.modules.config import DEFAULTS as _config_defaults
from tests.support.case import ModuleCase
from tests.support.docker import random_name, with_network
from tests.support.helpers import destructiveTest, slowTest, with_tempdir
from tests.support.helpers import slowTest, with_tempdir
from tests.support.mixins import SaltReturnAssertsMixin
from tests.support.runtests import RUNTIME_VARS
from tests.support.unit import skipIf
@ -46,7 +47,7 @@ def container_name(func):
return wrapper
@destructiveTest
@pytest.mark.destructive_test
@skipIf(salt.utils.platform.is_freebsd(), "No Docker on FreeBSD available")
@skipIf(not salt.utils.path.which("busybox"), "Busybox not installed")
@skipIf(not salt.utils.path.which("dockerd"), "Docker not installed")

View file

@ -9,13 +9,14 @@ import os
import subprocess
import tempfile
import pytest
import salt.utils.files
import salt.utils.network
import salt.utils.path
from salt.exceptions import CommandExecutionError
from tests.support.case import ModuleCase
from tests.support.docker import random_name, with_network
from tests.support.helpers import destructiveTest, requires_system_grains, slowTest
from tests.support.helpers import requires_system_grains, slowTest
from tests.support.mixins import SaltReturnAssertsMixin
from tests.support.runtests import RUNTIME_VARS
from tests.support.unit import skipIf
@ -104,7 +105,7 @@ def container_name(func):
@slowTest
@destructiveTest
@pytest.mark.destructive_test
@skipIf(salt.utils.platform.is_freebsd(), "No Docker on FreeBSD available")
@skipIf(not salt.utils.path.which("dockerd"), "Docker not installed")
class DockerNetworkTestCase(ModuleCase, SaltReturnAssertsMixin):

View file

@ -28,7 +28,6 @@ from tests.support.case import ModuleCase
from tests.support.helpers import (
Webserver,
dedent,
destructiveTest,
requires_system_grains,
skip_if_not_root,
with_system_user_and_group,
@ -2846,7 +2845,7 @@ class FileTest(ModuleCase, SaltReturnAssertsMixin):
os.remove(source)
os.remove(dest)
@destructiveTest
@pytest.mark.destructive_test
@skip_if_not_root
@skipIf(IS_WINDOWS, "Windows does not report any file modes. Skipping.")
@with_tempfile()
@ -5219,7 +5218,7 @@ class PatchTest(ModuleCase, SaltReturnAssertsMixin):
WIN_TEST_FILE = "c:/testfile"
@destructiveTest
@pytest.mark.destructive_test
@skipIf(not IS_WINDOWS, "windows test only")
@pytest.mark.windows_whitelisted
class WinFileTest(ModuleCase):

View file

@ -4,8 +4,8 @@ Tests for the Keystone states
import logging
import pytest
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest
from tests.support.mixins import SaltReturnAssertsMixin
from tests.support.unit import skipIf
@ -31,7 +31,7 @@ class KeystoneStateTest(ModuleCase, SaltReturnAssertsMixin):
endpoint = "http://localhost:35357/v2.0"
token = "administrator"
@destructiveTest
@pytest.mark.destructive_test
def setUp(self):
ret = self.run_state(
"keystone.service_present",
@ -117,7 +117,7 @@ class KeystoneStateTest(ModuleCase, SaltReturnAssertsMixin):
)
self.assertTrue(ret["keystone_|-demo_|-demo_|-user_present"]["result"])
@destructiveTest
@pytest.mark.destructive_test
def test_keystone_v2(self):
ret = self.run_state(
"keystone.service_present",
@ -203,7 +203,7 @@ class KeystoneStateTest(ModuleCase, SaltReturnAssertsMixin):
)
self.assertTrue(ret["keystone_|-testv2_|-testv2_|-service_absent"]["result"])
@destructiveTest
@pytest.mark.destructive_test
def test_keystone_v3(self):
ret = self.run_state(
"keystone.service_present",

View file

@ -2,9 +2,10 @@
Integration tests for the lxd states
"""
import pytest
import salt.utils.path
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, flaky
from tests.support.helpers import flaky
from tests.support.mixins import SaltReturnAssertsMixin
from tests.support.unit import skipIf
@ -16,10 +17,10 @@ except ImportError:
HAS_PYLXD = False
@destructiveTest
@skipIf(not salt.utils.path.which("lxd"), "LXD not installed")
@skipIf(not salt.utils.path.which("lxc"), "LXC not installed")
@skipIf(not HAS_PYLXD, "pylxd not installed")
@pytest.mark.destructive_test
class LxdTestCase(ModuleCase, SaltReturnAssertsMixin):
run_once = False

View file

@ -2,9 +2,9 @@
Tests for the MySQL states
"""
import pytest
import salt.utils.path
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest
from tests.support.mixins import SaltReturnAssertsMixin
from tests.support.unit import skipIf
@ -31,7 +31,7 @@ class MysqlDatabaseStateTest(ModuleCase, SaltReturnAssertsMixin):
user = "root"
password = "poney"
@destructiveTest
@pytest.mark.destructive_test
def setUp(self):
"""
Test presence of MySQL server, enforce a root password
@ -104,7 +104,7 @@ class MysqlDatabaseStateTest(ModuleCase, SaltReturnAssertsMixin):
)
self.assertSaltStateChangesEqual(ret, {})
@destructiveTest
@pytest.mark.destructive_test
def test_present_absent(self):
"""
mysql_database.present
@ -123,7 +123,7 @@ class MysqlDatabaseStateTest(ModuleCase, SaltReturnAssertsMixin):
# TODO: test with variations on collate and charset, check for db alter
# once it will be done in mysql_database.present state
@destructiveTest
@pytest.mark.destructive_test
def test_present_absent_fuzzy(self):
"""
mysql_database.present with utf-8 andf fuzzy db name
@ -159,7 +159,7 @@ class MysqlDatabaseStateTest(ModuleCase, SaltReturnAssertsMixin):
# saltenv={"LC_ALL": "en_US.utf8"}
)
@destructiveTest
@pytest.mark.destructive_test
@skipIf(True, "This tests needs issue #8947 to be fixed first")
def test_utf8_from_sls_file(self):
"""

View file

@ -4,10 +4,10 @@ Tests for the MySQL states
import logging
import pytest
import salt.utils.path
from salt.modules import mysql as mysqlmod
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest
from tests.support.mixins import SaltReturnAssertsMixin
from tests.support.unit import skipIf
@ -51,7 +51,7 @@ class MysqlGrantsStateTest(ModuleCase, SaltReturnAssertsMixin):
"user4": {"name": "user \xe6\xa8\x99", "pwd": "\xe6\xa8\x99\xe6\xa8\x99"},
}
@destructiveTest
@pytest.mark.destructive_test
def setUp(self):
"""
Test presence of MySQL server, enforce a root password
@ -133,7 +133,7 @@ class MysqlGrantsStateTest(ModuleCase, SaltReturnAssertsMixin):
connection_pass=self.password,
)
@destructiveTest
@pytest.mark.destructive_test
def tearDown(self):
"""
Removes created users and db
@ -182,7 +182,7 @@ class MysqlGrantsStateTest(ModuleCase, SaltReturnAssertsMixin):
saltenv={"LC_ALL": "en_US.utf8"},
)
@destructiveTest
@pytest.mark.destructive_test
def test_grant_present_absent(self):
"""
mysql_database.present

View file

@ -5,12 +5,13 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
import pytest
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, slowTest
from tests.support.helpers import slowTest
from tests.support.mixins import SaltReturnAssertsMixin
@destructiveTest
@pytest.mark.destructive_test
class NetworkTest(ModuleCase, SaltReturnAssertsMixin):
"""
Validate network state module

View file

@ -6,11 +6,12 @@
import os
import pytest
import salt.utils.path
import salt.utils.platform
from salt.utils.versions import LooseVersion
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, requires_network, slowTest
from tests.support.helpers import requires_network, slowTest
from tests.support.mixins import SaltReturnAssertsMixin
from tests.support.runtests import RUNTIME_VARS
from tests.support.unit import skipIf
@ -21,7 +22,7 @@ MAX_NPM_VERSION = "5.0.0"
@skipIf(salt.utils.path.which("npm") is None, "npm not installed")
class NpmStateTest(ModuleCase, SaltReturnAssertsMixin):
@requires_network()
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_npm_installed_removed(self):
"""
@ -37,7 +38,7 @@ class NpmStateTest(ModuleCase, SaltReturnAssertsMixin):
@skipIf(salt.utils.platform.is_darwin(), "TODO this test hangs on mac.")
@requires_network()
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_npm_install_url_referenced_package(self):
"""
@ -70,7 +71,7 @@ class NpmStateTest(ModuleCase, SaltReturnAssertsMixin):
self.run_state("file.absent", name=npm_dir)
@requires_network()
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_npm_installed_pkgs(self):
"""
@ -85,7 +86,7 @@ class NpmStateTest(ModuleCase, SaltReturnAssertsMixin):
)
self.assertSaltTrueReturn(ret)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_npm_cache_clean(self):
"""

View file

@ -25,7 +25,6 @@ from salt.exceptions import CommandExecutionError
from salt.modules.virtualenv_mod import KNOWN_BINARY_NAMES
from tests.support.case import ModuleCase
from tests.support.helpers import (
destructiveTest,
patched_environ,
requires_system_grains,
skip_if_not_root,
@ -322,7 +321,7 @@ class PipStateTest(ModuleCase, SaltReturnAssertsMixin):
"the --mirrors arg has been deprecated and removed in pip==7.0.0"
)
@destructiveTest
@pytest.mark.destructive_test
@skip_if_not_root
@with_system_user(
"issue-6912", on_existing="delete", delete=True, password="PassWord1!"
@ -383,7 +382,7 @@ class PipStateTest(ModuleCase, SaltReturnAssertsMixin):
elif salt.utils.platform.is_windows():
self.assertEqual(salt.utils.win_dacl.get_owner(path), username)
@destructiveTest
@pytest.mark.destructive_test
@skip_if_not_root
@skipIf(salt.utils.platform.is_darwin(), "Test is flaky on macosx")
@with_system_user(
@ -452,7 +451,7 @@ class PipStateTest(ModuleCase, SaltReturnAssertsMixin):
elif salt.utils.platform.is_windows():
self.assertEqual(salt.utils.win_dacl.get_owner(path), username)
@destructiveTest
@pytest.mark.destructive_test
@slowTest
def test_issue_6833_pip_upgrade_pip(self):
# Create the testing virtualenv

View file

@ -13,7 +13,6 @@ import salt.utils.pkg.rpm
import salt.utils.platform
from tests.support.case import ModuleCase
from tests.support.helpers import (
destructiveTest,
not_runs_on,
requires_salt_modules,
requires_salt_states,
@ -27,8 +26,8 @@ from tests.support.unit import skipIf
log = logging.getLogger(__name__)
@destructiveTest
@pytest.mark.windows_whitelisted
@pytest.mark.destructive_test
class PkgTest(ModuleCase, SaltReturnAssertsMixin):
_PKG_EPOCH_TARGETS = []
_PKG_32_TARGETS = []

View file

@ -4,11 +4,11 @@ tests for pkgrepo states
import os
import pytest
import salt.utils.files
import salt.utils.platform
from tests.support.case import ModuleCase
from tests.support.helpers import (
destructiveTest,
requires_salt_states,
requires_system_grains,
runs_on,
@ -19,8 +19,8 @@ from tests.support.pytest.helpers import temp_state_file
from tests.support.unit import skipIf
@destructiveTest
@skipIf(salt.utils.platform.is_windows(), "minion is windows")
@pytest.mark.destructive_test
class PkgrepoTest(ModuleCase, SaltReturnAssertsMixin):
"""
pkgrepo state tests

View file

@ -8,7 +8,7 @@ import pytest
import salt.utils.platform
import salt.utils.win_reg as reg
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, random_string, slowTest
from tests.support.helpers import random_string, slowTest
from tests.support.mixins import SaltReturnAssertsMixin
from tests.support.unit import skipIf
@ -21,7 +21,7 @@ UNICODE_VALUE = (
FAKE_KEY = "SOFTWARE\\{}".format(random_string("SaltTesting-", lowercase=False))
@destructiveTest
@pytest.mark.destructive_test
@skipIf(not salt.utils.platform.is_windows(), "Windows Specific Test")
@pytest.mark.windows_whitelisted
class RegTest(ModuleCase, SaltReturnAssertsMixin):

View file

@ -8,14 +8,14 @@ import pytest
import salt.utils.path
import salt.utils.platform
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, slowTest
from tests.support.helpers import slowTest
from tests.support.mixins import SaltReturnAssertsMixin
INIT_DELAY = 5
@destructiveTest
@pytest.mark.windows_whitelisted
@pytest.mark.destructive_test
class ServiceTest(ModuleCase, SaltReturnAssertsMixin):
"""
Validate the service state

View file

@ -4,20 +4,16 @@ Test the ssh_auth states
import os
import pytest
import salt.utils.files
from tests.support.case import ModuleCase
from tests.support.helpers import (
destructiveTest,
skip_if_not_root,
slowTest,
with_system_user,
)
from tests.support.helpers import skip_if_not_root, slowTest, with_system_user
from tests.support.mixins import SaltReturnAssertsMixin
from tests.support.runtests import RUNTIME_VARS
class SSHAuthStateTests(ModuleCase, SaltReturnAssertsMixin):
@destructiveTest
@pytest.mark.destructive_test
@skip_if_not_root
@with_system_user("issue_7409", on_existing="delete", delete=True)
@slowTest
@ -53,7 +49,7 @@ class SSHAuthStateTests(ModuleCase, SaltReturnAssertsMixin):
"ssh-rsa AAAAB3NzaC1kcQ9J5bYTEyZ== {}\n".format(username),
)
@destructiveTest
@pytest.mark.destructive_test
@skip_if_not_root
@with_system_user("issue_10198", on_existing="delete", delete=True)
@slowTest

View file

@ -13,12 +13,7 @@ import pytest
import salt.utils.files
import salt.utils.platform
from tests.support.case import ModuleCase
from tests.support.helpers import (
destructiveTest,
requires_system_grains,
skip_if_not_root,
slowTest,
)
from tests.support.helpers import requires_system_grains, skip_if_not_root, slowTest
from tests.support.mixins import SaltReturnAssertsMixin
from tests.support.unit import skipIf
@ -44,9 +39,9 @@ else:
NOGROUPGID = "nogroup"
@destructiveTest
@skip_if_not_root
@pytest.mark.windows_whitelisted
@pytest.mark.destructive_test
class UserTest(ModuleCase, SaltReturnAssertsMixin):
"""
test for user absent
@ -416,10 +411,10 @@ class UserTest(ModuleCase, SaltReturnAssertsMixin):
self.assertSaltTrueReturn(self.run_state("group.absent", name=self.user_name))
@destructiveTest
@skip_if_not_root
@skipIf(not salt.utils.platform.is_windows(), "Windows only tests")
@pytest.mark.windows_whitelisted
@pytest.mark.destructive_test
class WinUserTest(ModuleCase, SaltReturnAssertsMixin):
"""
test for user absent

View file

@ -1,20 +1,18 @@
"""
:codeauthor: Pedro Algarvio (pedro@algarvio.me)
tests.integration.states.virtualenv
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tests.integration.states.virtualenv
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
import os
import shutil
import pytest
import salt.utils.files
import salt.utils.path
import salt.utils.platform
from salt.modules.virtualenv_mod import KNOWN_BINARY_NAMES
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, skip_if_not_root, slowTest
from tests.support.helpers import skip_if_not_root, slowTest
from tests.support.mixins import SaltReturnAssertsMixin
from tests.support.runtests import RUNTIME_VARS
from tests.support.unit import skipIf
@ -25,7 +23,7 @@ from tests.support.unit import skipIf
)
class VirtualenvTest(ModuleCase, SaltReturnAssertsMixin):
@skipIf(salt.utils.platform.is_darwin(), "Test is flaky on macosx")
@destructiveTest
@pytest.mark.destructive_test
@skip_if_not_root
@slowTest
def test_issue_1959_virtualenv_runas(self):

View file

@ -4,9 +4,10 @@ Integration tests for the zookeeper states
import logging
import pytest
import salt.utils.path
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, slowTest
from tests.support.helpers import slowTest
from tests.support.mixins import SaltReturnAssertsMixin
from tests.support.unit import skipIf
@ -20,9 +21,9 @@ except ImportError:
log = logging.getLogger(__name__)
@destructiveTest
@skipIf(not salt.utils.path.which("dockerd"), "Docker not installed")
@skipIf(not HAS_KAZOO, "kazoo python library not installed")
@pytest.mark.destructive_test
class ZookeeperTestCase(ModuleCase, SaltReturnAssertsMixin):
"""
Test zookeeper states

View file

@ -8,10 +8,11 @@ import os
import shutil
import time
import pytest
import salt.modules.gpg as gpg
import salt.utils.files
import salt.utils.platform
from tests.support.helpers import destructiveTest, slowTest
from tests.support.helpers import slowTest
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.mock import MagicMock, patch
from tests.support.runtests import RUNTIME_VARS
@ -155,7 +156,7 @@ except ImportError:
HAS_GPG = False
@destructiveTest
@pytest.mark.destructive_test
@skipIf(not salt.utils.platform.is_linux(), "These tests can only be run on linux")
class GpgTestCase(TestCase, LoaderModuleMockMixin):
"""
@ -318,7 +319,7 @@ class GpgTestCase(TestCase, LoaderModuleMockMixin):
ret = gpg.get_key("xxxxxxxxxxxxxxxx")
self.assertEqual(ret, _expected_result)
@destructiveTest # Need to run as root!?
@pytest.mark.destructive_test # Need to run as root!?
@skipIf(not HAS_GPG, "GPG Module Unavailable")
def test_delete_key(self):
"""

View file

@ -1,8 +1,9 @@
import pytest
import salt.modules.reg as reg
import salt.utils.stringutils
import salt.utils.win_reg
from salt.exceptions import CommandExecutionError
from tests.support.helpers import destructiveTest, random_string
from tests.support.helpers import random_string
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.mock import MagicMock, patch
from tests.support.unit import TestCase, skipIf
@ -360,7 +361,7 @@ class WinFunctionsTestCase(TestCase, LoaderModuleMockMixin):
vname="ProgramFilesPath",
)
@destructiveTest
@pytest.mark.destructive_test
def test_read_value_multi_sz_empty_list(self):
"""
An empty REG_MULTI_SZ value should return an empty list, not None
@ -389,7 +390,7 @@ class WinFunctionsTestCase(TestCase, LoaderModuleMockMixin):
finally:
reg.delete_key_recursive(hive="HKLM", key=FAKE_KEY)
@destructiveTest
@pytest.mark.destructive_test
def test_set_value(self):
"""
Test the set_value function
@ -414,7 +415,7 @@ class WinFunctionsTestCase(TestCase, LoaderModuleMockMixin):
finally:
reg.delete_key_recursive(hive="HKLM", key=FAKE_KEY)
@destructiveTest
@pytest.mark.destructive_test
def test_set_value_default(self):
"""
Test the set_value function on the default value
@ -435,7 +436,7 @@ class WinFunctionsTestCase(TestCase, LoaderModuleMockMixin):
finally:
reg.delete_key_recursive(hive="HKLM", key=FAKE_KEY)
@destructiveTest
@pytest.mark.destructive_test
def test_set_value_unicode_key(self):
"""
Test the set_value function on a unicode key
@ -468,7 +469,7 @@ class WinFunctionsTestCase(TestCase, LoaderModuleMockMixin):
finally:
reg.delete_key_recursive(hive="HKLM", key=FAKE_KEY)
@destructiveTest
@pytest.mark.destructive_test
def test_set_value_unicode_value(self):
"""
Test the set_value function on a unicode value
@ -494,7 +495,7 @@ class WinFunctionsTestCase(TestCase, LoaderModuleMockMixin):
finally:
reg.delete_key_recursive(hive="HKLM", key=FAKE_KEY)
@destructiveTest
@pytest.mark.destructive_test
def test_set_value_reg_dword(self):
"""
Test the set_value function on a REG_DWORD value
@ -523,7 +524,7 @@ class WinFunctionsTestCase(TestCase, LoaderModuleMockMixin):
finally:
reg.delete_key_recursive(hive="HKLM", key=FAKE_KEY)
@destructiveTest
@pytest.mark.destructive_test
def test_set_value_reg_qword(self):
"""
Test the set_value function on a REG_QWORD value
@ -618,7 +619,7 @@ class WinFunctionsTestCase(TestCase, LoaderModuleMockMixin):
)
)
@destructiveTest
@pytest.mark.destructive_test
def test_delete_value(self):
"""
Test the delete_value function
@ -675,7 +676,7 @@ class WinFunctionsTestCase(TestCase, LoaderModuleMockMixin):
vname="fake_name",
)
@destructiveTest
@pytest.mark.destructive_test
def test_delete_value_unicode(self):
"""
Test the delete_value function on a unicode value
@ -692,7 +693,7 @@ class WinFunctionsTestCase(TestCase, LoaderModuleMockMixin):
finally:
reg.delete_key_recursive(hive="HKLM", key=FAKE_KEY)
@destructiveTest
@pytest.mark.destructive_test
def test_delete_value_unicode_vname(self):
"""
Test the delete_value function on a unicode vname
@ -709,7 +710,7 @@ class WinFunctionsTestCase(TestCase, LoaderModuleMockMixin):
finally:
reg.delete_key_recursive(hive="HKLM", key=FAKE_KEY)
@destructiveTest
@pytest.mark.destructive_test
def test_delete_value_unicode_key(self):
"""
Test the delete_value function on a unicode key
@ -761,7 +762,7 @@ class WinFunctionsTestCase(TestCase, LoaderModuleMockMixin):
with patch("salt.utils.win_reg.key_exists", mock_true):
self.assertFalse(reg.delete_key_recursive(hive="HKLM", key="FAKE_KEY"))
@destructiveTest
@pytest.mark.destructive_test
def test_delete_key_recursive(self):
"""
Test the delete_key_recursive function
@ -779,7 +780,7 @@ class WinFunctionsTestCase(TestCase, LoaderModuleMockMixin):
finally:
reg.delete_key_recursive(hive="HKLM", key=FAKE_KEY)
@destructiveTest
@pytest.mark.destructive_test
def test_delete_key_recursive_failed_to_open_key(self):
"""
Test the delete_key_recursive function on failure to open the key
@ -810,7 +811,7 @@ class WinFunctionsTestCase(TestCase, LoaderModuleMockMixin):
finally:
reg.delete_key_recursive(hive="HKLM", key=FAKE_KEY)
@destructiveTest
@pytest.mark.destructive_test
def test_delete_key_recursive_failed_to_delete(self):
"""
Test the delete_key_recursive function on failure to delete a key
@ -835,7 +836,7 @@ class WinFunctionsTestCase(TestCase, LoaderModuleMockMixin):
finally:
reg.delete_key_recursive(hive="HKLM", key=FAKE_KEY)
@destructiveTest
@pytest.mark.destructive_test
def test_delete_key_recursive_unicode(self):
"""
Test the delete_key_recursive function on value within a unicode key

View file

@ -5,6 +5,7 @@ import copy
import glob
import os
import pytest
import salt.config
import salt.loader
import salt.modules.win_lgpo as win_lgpo
@ -12,7 +13,7 @@ import salt.states.win_lgpo
import salt.utils.files
import salt.utils.platform
import salt.utils.stringutils
from tests.support.helpers import destructiveTest, slowTest
from tests.support.helpers import slowTest
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.mock import MagicMock, Mock, patch
from tests.support.unit import TestCase, skipIf
@ -376,7 +377,7 @@ class WinLGPOGetPolicyADMXTestCase(TestCase, LoaderModuleMockMixin):
}
self.assertDictEqual(result, expected)
@destructiveTest
@pytest.mark.destructive_test
def test__load_policy_definitions(self):
"""
Test that unexpected files in the PolicyDefinitions directory won't
@ -637,7 +638,7 @@ class WinLGPOPolicyInfoMechanismsTestCase(TestCase, LoaderModuleMockMixin):
expected = "Not configured"
self.assertEqual(result, expected)
@destructiveTest
@pytest.mark.destructive_test
def test_adv_audit_mechanism(self):
"""
Test getting the policy value using the AdvAudit mechanism
@ -691,8 +692,8 @@ class WinLGPOPolicyInfoMechanismsTestCase(TestCase, LoaderModuleMockMixin):
self.assertEqual(result, expected)
@destructiveTest
@skipIf(not salt.utils.platform.is_windows(), "System is not Windows")
@pytest.mark.destructive_test
class WinLGPOGetPointAndPrintNCTestCase(TestCase, LoaderModuleMockMixin):
"""
Test variations of the Point and Print Restrictions policy when Not
@ -799,8 +800,8 @@ class WinLGPOGetPointAndPrintNCTestCase(TestCase, LoaderModuleMockMixin):
self.assertDictEqual(result, expected)
@destructiveTest
@skipIf(not salt.utils.platform.is_windows(), "System is not Windows")
@pytest.mark.destructive_test
class WinLGPOGetPointAndPrintENTestCase(TestCase, LoaderModuleMockMixin):
"""
Test variations of the Point and Print Restrictions policy when Enabled (EN)

View file

@ -1,11 +1,11 @@
import pytest
import salt.modules.win_task as win_task
import salt.utils.platform
from tests.support.helpers import destructiveTest
from tests.support.unit import TestCase, skipIf
@destructiveTest
@skipIf(not salt.utils.platform.is_windows(), "System is not Windows")
@pytest.mark.destructive_test
class WinTaskTestCase(TestCase):
"""
Test cases for salt.modules.win_task

View file

@ -7,6 +7,7 @@ import shutil
from datetime import datetime
import msgpack
import pytest
import salt.modules.file as filemod
import salt.serializers.json as jsonserializer
import salt.serializers.msgpack as msgpackserializer
@ -20,7 +21,7 @@ import salt.utils.platform
import salt.utils.win_functions
import salt.utils.yaml
from salt.exceptions import CommandExecutionError
from tests.support.helpers import dedent, destructiveTest, slowTest, with_tempfile
from tests.support.helpers import dedent, slowTest, with_tempfile
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.mock import MagicMock, Mock, call, mock_open, patch
from tests.support.runtests import RUNTIME_VARS
@ -2973,7 +2974,7 @@ class TestFilePrivateFunctions(TestCase, LoaderModuleMockMixin):
def setup_loader_modules(self):
return {filestate: {"__salt__": {"file.stats": filemod.stats}}}
@destructiveTest
@pytest.mark.destructive_test
@skipIf(salt.utils.platform.is_windows(), "File modes do not exist on windows")
def test__check_directory(self):
"""

View file

@ -4,12 +4,12 @@
import os
import pytest
import salt.config
import salt.loader
import salt.states.reg as reg
import salt.utils.platform
import salt.utils.win_reg
from tests.support.helpers import destructiveTest
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.mock import patch
from tests.support.runtests import RUNTIME_VARS
@ -38,7 +38,7 @@ class RegTestCase(TestCase, LoaderModuleMockMixin):
def tearDown(self):
salt.utils.win_reg.delete_key_recursive(hive=self.hive, key=self.key)
@destructiveTest
@pytest.mark.destructive_test
def test_present(self):
"""
Test to set a registry entry.
@ -63,7 +63,7 @@ class RegTestCase(TestCase, LoaderModuleMockMixin):
ret = reg.present(self.name, vname=self.vname, vdata=self.vdata)
self.assertDictEqual(ret, expected)
@destructiveTest
@pytest.mark.destructive_test
def test_present_string_dword(self):
"""
Test to set a registry entry.
@ -92,7 +92,7 @@ class RegTestCase(TestCase, LoaderModuleMockMixin):
ret = reg.present(self.name, vname=vname, vdata=vdata, vtype=vtype)
self.assertDictEqual(ret, expected)
@destructiveTest
@pytest.mark.destructive_test
def test_present_string_dword_existing(self):
"""
Test to set a registry entry.
@ -180,7 +180,7 @@ class RegTestCase(TestCase, LoaderModuleMockMixin):
ret = reg.present(self.name, vname=self.vname, vdata=self.vdata)
self.assertDictEqual(ret, expected)
@destructiveTest
@pytest.mark.destructive_test
def test_absent(self):
"""
Test to remove a registry entry.
@ -198,7 +198,7 @@ class RegTestCase(TestCase, LoaderModuleMockMixin):
ret = reg.absent(self.name, self.vname)
self.assertDictEqual(ret, expected)
@destructiveTest
@pytest.mark.destructive_test
def test_absent_test_true(self):
# Create the reg key for testing
salt.utils.win_reg.set_value(

View file

@ -2,11 +2,12 @@
:codeauthor: Rahul Handay <rahulha@saltstack.com>
"""
import pytest
import salt.config
import salt.loader
import salt.states.service as service
import salt.utils.platform
from tests.support.helpers import destructiveTest, slowTest
from tests.support.helpers import slowTest
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.mock import MagicMock, patch
from tests.support.unit import TestCase, skipIf
@ -508,8 +509,8 @@ class ServiceTestCase(TestCase, LoaderModuleMockMixin):
self.assertDictEqual(service.mod_watch("salt", "stack"), ret[1])
@destructiveTest
@skipIf(salt.utils.platform.is_darwin(), "service.running is currently failing on OSX")
@pytest.mark.destructive_test
class ServiceTestCaseFunctional(TestCase, LoaderModuleMockMixin):
"""
Validate the service state

View file

@ -3,12 +3,13 @@
"""
import copy
import pytest
import salt.config
import salt.loader
import salt.states.win_lgpo as win_lgpo
import salt.utils.platform
import salt.utils.stringutils
from tests.support.helpers import destructiveTest, slowTest
from tests.support.helpers import slowTest
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.mock import patch
from tests.support.unit import TestCase, skipIf
@ -92,8 +93,8 @@ class WinLGPOComparePoliciesTestCase(TestCase):
self.assertFalse(win_lgpo._compare_policies(compare_integer, None))
@destructiveTest
@skipIf(not salt.utils.platform.is_windows(), "System is not Windows")
@pytest.mark.destructive_test
class WinLGPOPolicyElementNames(TestCase, LoaderModuleMockMixin):
"""
Test variations of the Point and Print Restrictions policy when Not
@ -215,8 +216,8 @@ class WinLGPOPolicyElementNames(TestCase, LoaderModuleMockMixin):
self.assertFalse(expected["result"])
@destructiveTest
@skipIf(not salt.utils.platform.is_windows(), "System is not Windows")
@pytest.mark.destructive_test
class WinLGPOPolicyElementNamesTestTrue(TestCase, LoaderModuleMockMixin):
"""
Test variations of the Point and Print Restrictions policy when Not

View file

@ -2,10 +2,10 @@ import os
import shutil
import tempfile
import pytest
import salt.config
import salt.spm
import salt.utils.files
from tests.support.helpers import destructiveTest
from tests.support.mixins import AdaptedConfigurationTestCaseMixin
from tests.support.mock import MagicMock, patch
from tests.support.unit import TestCase
@ -38,7 +38,7 @@ _F1["contents"] = (
)
@destructiveTest
@pytest.mark.destructive_test
class SPMTestUserInterface(salt.spm.SPMUserInterface):
"""
Unit test user interface to SPMClient

View file

@ -1,11 +1,12 @@
import os
import tempfile
import pytest
import salt.utils.platform
import salt.utils.win_dacl as win_dacl
import salt.utils.win_reg as win_reg
from salt.exceptions import CommandExecutionError
from tests.support.helpers import TstSuiteLoggingHandler, destructiveTest, random_string
from tests.support.helpers import TstSuiteLoggingHandler, random_string
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.mock import patch
from tests.support.unit import TestCase, skipIf
@ -132,7 +133,7 @@ class WinDaclRegTestCase(TestCase, LoaderModuleMockMixin):
def tearDown(self):
win_reg.delete_key_recursive(hive="HKLM", key=FAKE_KEY)
@destructiveTest
@pytest.mark.destructive_test
def test_owner(self):
"""
Test the set_owner function
@ -150,7 +151,7 @@ class WinDaclRegTestCase(TestCase, LoaderModuleMockMixin):
"Backup Operators",
)
@destructiveTest
@pytest.mark.destructive_test
def test_primary_group(self):
"""
Test the set_primary_group function
@ -168,7 +169,7 @@ class WinDaclRegTestCase(TestCase, LoaderModuleMockMixin):
"Backup Operators",
)
@destructiveTest
@pytest.mark.destructive_test
def test_set_permissions(self):
"""
Test the set_permissions function
@ -203,7 +204,7 @@ class WinDaclRegTestCase(TestCase, LoaderModuleMockMixin):
expected,
)
@destructiveTest
@pytest.mark.destructive_test
def test_get_permissions(self):
"""
Test the get_permissions function
@ -238,7 +239,7 @@ class WinDaclRegTestCase(TestCase, LoaderModuleMockMixin):
expected,
)
@destructiveTest
@pytest.mark.destructive_test
def test_has_permission(self):
"""
Test the has_permission function
@ -277,7 +278,7 @@ class WinDaclRegTestCase(TestCase, LoaderModuleMockMixin):
)
)
@destructiveTest
@pytest.mark.destructive_test
def test_rm_permissions(self):
"""
Test the rm_permissions function
@ -309,7 +310,7 @@ class WinDaclRegTestCase(TestCase, LoaderModuleMockMixin):
{},
)
@destructiveTest
@pytest.mark.destructive_test
def test_inheritance(self):
"""
Test the set_inheritance function
@ -338,7 +339,7 @@ class WinDaclRegTestCase(TestCase, LoaderModuleMockMixin):
win_dacl.get_inheritance(obj_name=self.obj_name, obj_type=self.obj_type)
)
@destructiveTest
@pytest.mark.destructive_test
def test_check_perms(self):
"""
Test the check_perms function
@ -427,7 +428,7 @@ class WinDaclRegTestCase(TestCase, LoaderModuleMockMixin):
win_dacl.get_owner(obj_name=self.obj_name, obj_type=self.obj_type), "Users"
)
@destructiveTest
@pytest.mark.destructive_test
def test_check_perms_test_true(self):
"""
Test the check_perms function
@ -528,7 +529,7 @@ class WinDaclFileTestCase(TestCase, LoaderModuleMockMixin):
def tearDown(self):
os.remove(self.obj_name)
@destructiveTest
@pytest.mark.destructive_test
def test_owner(self):
"""
Test the set_owner function
@ -546,7 +547,7 @@ class WinDaclFileTestCase(TestCase, LoaderModuleMockMixin):
"Backup Operators",
)
@destructiveTest
@pytest.mark.destructive_test
def test_primary_group(self):
"""
Test the set_primary_group function
@ -564,7 +565,7 @@ class WinDaclFileTestCase(TestCase, LoaderModuleMockMixin):
"Backup Operators",
)
@destructiveTest
@pytest.mark.destructive_test
def test_set_permissions(self):
"""
Test the set_permissions function
@ -599,7 +600,7 @@ class WinDaclFileTestCase(TestCase, LoaderModuleMockMixin):
expected,
)
@destructiveTest
@pytest.mark.destructive_test
def test_get_permissions(self):
"""
Test the get_permissions function
@ -634,7 +635,7 @@ class WinDaclFileTestCase(TestCase, LoaderModuleMockMixin):
expected,
)
@destructiveTest
@pytest.mark.destructive_test
def test_has_permission(self):
"""
Test the has_permission function
@ -673,7 +674,7 @@ class WinDaclFileTestCase(TestCase, LoaderModuleMockMixin):
)
)
@destructiveTest
@pytest.mark.destructive_test
def test_rm_permissions(self):
"""
Test the rm_permissions function
@ -705,7 +706,7 @@ class WinDaclFileTestCase(TestCase, LoaderModuleMockMixin):
{},
)
@destructiveTest
@pytest.mark.destructive_test
def test_inheritance(self):
"""
Test the set_inheritance function
@ -734,7 +735,7 @@ class WinDaclFileTestCase(TestCase, LoaderModuleMockMixin):
win_dacl.get_inheritance(obj_name=self.obj_name, obj_type=self.obj_type)
)
@destructiveTest
@pytest.mark.destructive_test
def test_check_perms(self):
"""
Test the check_perms function
@ -833,7 +834,7 @@ class WinDaclFileTestCase(TestCase, LoaderModuleMockMixin):
win_dacl.get_owner(obj_name=self.obj_name, obj_type=self.obj_type), "Users"
)
@destructiveTest
@pytest.mark.destructive_test
def test_check_perms_test_true(self):
"""
Test the check_perms function

View file

@ -1,7 +1,7 @@
import pytest
import salt.utils.platform
import salt.utils.win_lgpo_netsh as win_lgpo_netsh
from salt.exceptions import CommandExecutionError
from tests.support.helpers import destructiveTest
from tests.support.mock import patch
from tests.support.unit import TestCase, skipIf
@ -127,7 +127,7 @@ class WinLgpoNetshTestCase(TestCase):
self.assertIn("Private Profile", ret)
self.assertIn("Public Profile", ret)
@destructiveTest
@pytest.mark.destructive_test
def test_set_firewall_settings_inbound_local(self):
current = win_lgpo_netsh.get_settings(
profile="domain", section="firewallpolicy", store="local"
@ -147,7 +147,7 @@ class WinLgpoNetshTestCase(TestCase):
)
self.assertTrue(ret)
@destructiveTest
@pytest.mark.destructive_test
def test_set_firewall_settings_inbound_local_notconfigured(self):
current = win_lgpo_netsh.get_settings(
profile="domain", section="firewallpolicy", store="local"
@ -166,7 +166,7 @@ class WinLgpoNetshTestCase(TestCase):
)
self.assertTrue(ret)
@destructiveTest
@pytest.mark.destructive_test
def test_set_firewall_settings_inbound_lgpo_notconfigured(self):
current = win_lgpo_netsh.get_settings(
profile="domain", section="firewallpolicy", store="lgpo"
@ -186,7 +186,7 @@ class WinLgpoNetshTestCase(TestCase):
)
self.assertTrue(ret)
@destructiveTest
@pytest.mark.destructive_test
def test_set_firewall_settings_outbound_local(self):
current = win_lgpo_netsh.get_settings(
profile="domain", section="firewallpolicy", store="local"
@ -206,7 +206,7 @@ class WinLgpoNetshTestCase(TestCase):
)
self.assertTrue(ret)
@destructiveTest
@pytest.mark.destructive_test
def test_set_firewall_logging_allowed_local_enable(self):
current = win_lgpo_netsh.get_settings(
profile="domain", section="logging", store="local"
@ -232,7 +232,7 @@ class WinLgpoNetshTestCase(TestCase):
)
self.assertTrue(ret)
@destructiveTest
@pytest.mark.destructive_test
def test_set_firewall_logging_allowed_local_notconfigured(self):
current = win_lgpo_netsh.get_settings(
profile="domain", section="logging", store="local"
@ -255,7 +255,7 @@ class WinLgpoNetshTestCase(TestCase):
)
self.assertTrue(ret)
@destructiveTest
@pytest.mark.destructive_test
def test_set_firewall_logging_allowed_lgpo_notconfigured(self):
current = win_lgpo_netsh.get_settings(
profile="domain", section="logging", store="lgpo"
@ -347,7 +347,7 @@ class WinLgpoNetshTestCase(TestCase):
)
self.assertTrue(ret)
@destructiveTest
@pytest.mark.destructive_test
def test_set_firewall_settings_fwrules_local_enable(self):
self.assertRaises(
CommandExecutionError,
@ -358,7 +358,7 @@ class WinLgpoNetshTestCase(TestCase):
store="local",
)
@destructiveTest
@pytest.mark.destructive_test
def test_set_firewall_settings_fwrules_lgpo_notconfigured(self):
current = win_lgpo_netsh.get_settings(
profile="domain", section="settings", store="lgpo"
@ -384,7 +384,7 @@ class WinLgpoNetshTestCase(TestCase):
)
self.assertTrue(ret)
@destructiveTest
@pytest.mark.destructive_test
def test_set_firewall_settings_consecrules_local_enable(self):
self.assertRaises(
CommandExecutionError,
@ -420,7 +420,7 @@ class WinLgpoNetshTestCase(TestCase):
)
self.assertTrue(ret)
@destructiveTest
@pytest.mark.destructive_test
def test_set_firewall_settings_notification_local_notconfigured(self):
current = win_lgpo_netsh.get_settings(
profile="domain", section="settings", store="local"
@ -518,7 +518,7 @@ class WinLgpoNetshTestCase(TestCase):
)
self.assertTrue(ret)
@destructiveTest
@pytest.mark.destructive_test
def test_set_firewall_state_local_on(self):
current = win_lgpo_netsh.get_settings(
profile="domain", section="state", store="local"
@ -536,7 +536,7 @@ class WinLgpoNetshTestCase(TestCase):
)
self.assertTrue(ret)
@destructiveTest
@pytest.mark.destructive_test
def test_set_firewall_state_local_notconfigured(self):
current = win_lgpo_netsh.get_settings(
profile="domain", section="state", store="local"
@ -555,7 +555,7 @@ class WinLgpoNetshTestCase(TestCase):
)
self.assertTrue(ret)
@destructiveTest
@pytest.mark.destructive_test
def test_set_firewall_state_lgpo_notconfigured(self):
current = win_lgpo_netsh.get_settings(
profile="domain", section="state", store="local"

View file

@ -1,7 +1,8 @@
import pytest
import salt.utils.stringutils
import salt.utils.win_reg as win_reg
from salt.exceptions import CommandExecutionError
from tests.support.helpers import destructiveTest, random_string
from tests.support.helpers import random_string
from tests.support.mock import MagicMock, patch
from tests.support.unit import TestCase, skipIf
@ -365,7 +366,7 @@ class WinFunctionsTestCase(TestCase):
vname="ProgramFilesPath",
)
@destructiveTest
@pytest.mark.destructive_test
def test_read_value_multi_sz_empty_list(self):
"""
An empty REG_MULTI_SZ value should return an empty list, not None
@ -395,7 +396,7 @@ class WinFunctionsTestCase(TestCase):
finally:
win_reg.delete_key_recursive(hive="HKLM", key=FAKE_KEY)
@destructiveTest
@pytest.mark.destructive_test
def test_set_value(self):
"""
Test the set_value function
@ -421,7 +422,7 @@ class WinFunctionsTestCase(TestCase):
finally:
win_reg.delete_key_recursive(hive="HKLM", key=FAKE_KEY)
@destructiveTest
@pytest.mark.destructive_test
def test_set_value_default(self):
"""
Test the set_value function on the default value
@ -442,7 +443,7 @@ class WinFunctionsTestCase(TestCase):
finally:
win_reg.delete_key_recursive(hive="HKLM", key=FAKE_KEY)
@destructiveTest
@pytest.mark.destructive_test
def test_set_value_unicode_key(self):
"""
Test the set_value function on a unicode key
@ -475,7 +476,7 @@ class WinFunctionsTestCase(TestCase):
finally:
win_reg.delete_key_recursive(hive="HKLM", key=FAKE_KEY)
@destructiveTest
@pytest.mark.destructive_test
def test_set_value_unicode_value(self):
"""
Test the set_value function on a unicode value
@ -501,7 +502,7 @@ class WinFunctionsTestCase(TestCase):
finally:
win_reg.delete_key_recursive(hive="HKLM", key=FAKE_KEY)
@destructiveTest
@pytest.mark.destructive_test
def test_set_value_reg_dword(self):
"""
Test the set_value function on a REG_DWORD value
@ -531,7 +532,7 @@ class WinFunctionsTestCase(TestCase):
finally:
win_reg.delete_key_recursive(hive="HKLM", key=FAKE_KEY)
@destructiveTest
@pytest.mark.destructive_test
def test_set_value_reg_qword(self):
"""
Test the set_value function on a REG_QWORD value
@ -721,7 +722,7 @@ class WinFunctionsTestCase(TestCase):
self.assertTrue(isinstance(result, str))
self.assertEqual(result, "")
@destructiveTest
@pytest.mark.destructive_test
def test_delete_value(self):
"""
Test the delete_value function
@ -778,7 +779,7 @@ class WinFunctionsTestCase(TestCase):
vname="fake_name",
)
@destructiveTest
@pytest.mark.destructive_test
def test_delete_value_unicode(self):
"""
Test the delete_value function on a unicode value
@ -795,7 +796,7 @@ class WinFunctionsTestCase(TestCase):
finally:
win_reg.delete_key_recursive(hive="HKLM", key=FAKE_KEY)
@destructiveTest
@pytest.mark.destructive_test
def test_delete_value_unicode_vname(self):
"""
Test the delete_value function on a unicode vname
@ -812,7 +813,7 @@ class WinFunctionsTestCase(TestCase):
finally:
win_reg.delete_key_recursive(hive="HKLM", key=FAKE_KEY)
@destructiveTest
@pytest.mark.destructive_test
def test_delete_value_unicode_key(self):
"""
Test the delete_value function on a unicode key
@ -864,7 +865,7 @@ class WinFunctionsTestCase(TestCase):
with patch("salt.utils.win_reg.key_exists", mock_true):
self.assertFalse(win_reg.delete_key_recursive(hive="HKLM", key="FAKE_KEY"))
@destructiveTest
@pytest.mark.destructive_test
def test_delete_key_recursive(self):
"""
Test the delete_key_recursive function
@ -882,7 +883,7 @@ class WinFunctionsTestCase(TestCase):
finally:
win_reg.delete_key_recursive(hive="HKLM", key=FAKE_KEY)
@destructiveTest
@pytest.mark.destructive_test
def test_delete_key_recursive_failed_to_open_key(self):
"""
Test the delete_key_recursive function on failure to open the key
@ -913,7 +914,7 @@ class WinFunctionsTestCase(TestCase):
finally:
win_reg.delete_key_recursive(hive="HKLM", key=FAKE_KEY)
@destructiveTest
@pytest.mark.destructive_test
def test_delete_key_recursive_failed_to_delete(self):
"""
Test the delete_key_recursive function on failure to delete a key
@ -938,7 +939,7 @@ class WinFunctionsTestCase(TestCase):
finally:
win_reg.delete_key_recursive(hive="HKLM", key=FAKE_KEY)
@destructiveTest
@pytest.mark.destructive_test
def test_delete_key_recursive_unicode(self):
"""
Test the delete_key_recursive function on value within a unicode key