Merge branch 'master' into backport_52992

This commit is contained in:
Daniel Wozniak 2020-04-21 21:29:34 -07:00 committed by GitHub
commit eda3757934
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
284 changed files with 4005 additions and 430 deletions

View file

@ -13,6 +13,7 @@ Versions are `MAJOR.PATCH`.
### Deprecated
### Changed
- [#56753](https://github.com/saltstack/salt/pull/56753) - Backport 51095
### Fixed
- [#56237](https://github.com/saltstack/salt/pull/56237) - Fix alphabetical ordering and remove duplicates across all documentation indexes - [@myii](https://github.com/myii)
@ -20,6 +21,7 @@ Versions are `MAJOR.PATCH`.
### Added
- [#56627](https://github.com/saltstack/salt/pull/56627) - Add new salt-ssh set_path option
- [#51379](https://github.com/saltstack/salt/pull/56792) - Backport 51379 : Adds .set_domain_workgroup to win_system
## 3000.1

View file

@ -677,7 +677,9 @@
# The master_roots setting configures a master-only copy of the file_roots dictionary,
# used by the state compiler.
#master_roots: /srv/salt-master
#master_roots:
# base:
# - /srv/salt-master
# When using multiple environments, each with their own top file, the
# default behaviour is an unordered merge. To prevent top files from

View file

@ -284897,7 +284897,7 @@ new
all
.TP
.B note
If you see the following error, you\(aqll need to upgrade \fBrequests\fP to atleast 2.4.2
If you see the following error, you\(aqll need to upgrade \fBrequests\fP to at least 2.4.2
.UNINDENT
.INDENT 0.0
.INDENT 3.5

View file

@ -2654,14 +2654,18 @@ nothing is ignored.
``master_roots``
----------------
Default: ``/srv/salt-master``
Default: ``''``
A master-only copy of the :conf_master:`file_roots` dictionary, used by the
state compiler.
Example:
.. code-block:: yaml
master_roots: /srv/salt-master
master_roots:
base:
- /srv/salt-master
roots: Master's Local File Server
---------------------------------

View file

@ -69,16 +69,6 @@ dynamic modules when states are run. To disable this behavior set
When dynamic modules are autoloaded via states, only the modules defined in the
same saltenvs as the states currently being run.
Also it is possible to use the explicit ``saltutil.sync_*`` :py:mod:`state functions <salt.states.saltutil>`
to sync the modules (previously it was necessary to use the ``module.run`` state):
.. code-block::yaml
synchronize_modules:
saltutil.sync_modules:
- refresh: True
Sync Via the saltutil Module
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -350,7 +340,7 @@ SDB
* :ref:`Writing SDB Modules <sdb-writing-modules>`
SDB is a way to store data that's not associated with a minion. See
SDB is a way to store data that's not associated with a minion. See
:ref:`Storing Data in Other Databases <sdb>`.
Serializer
@ -394,6 +384,12 @@ pkgfiles modules handle the actual installation.
SSH Wrapper
-----------
.. toctree::
:maxdepth: 1
:glob:
ssh_wrapper
Replacement execution modules for :ref:`Salt SSH <salt-ssh>`.
Thorium
@ -420,7 +416,7 @@ the state system.
Util
----
Just utility modules to use with other modules via ``__utils__`` (see
Just utility modules to use with other modules via ``__utils__`` (see
:ref:`Dunder Dictionaries <dunder-dictionaries>`).
Wheel

View file

@ -0,0 +1,63 @@
.. _ssh-wrapper:
===========
SSH Wrapper
===========
Salt-SSH Background
===================
Salt-SSH works by creating a tar ball of salt, a bunch of python modules, and a generated
short minion config. It then copies this onto the destination host over ssh, then
uses that host's local python install to run ``salt-client --local`` with any requested modules.
It does not automatically copy over states or cache files and since it is uses a local file_client,
modules that rely on :py:func:`cp.cache* <salt.modules.cp>` functionality do not work.
SSH Wrapper modules
===================
To support cp modules or other functionality which might not otherwise work in the remote environment,
a wrapper module can be created. These modules are run from the salt-master initiating the salt-ssh
command and can include logic to support the needed functionality. SSH Wrapper modules are located in
/salt/client/ssh/wrapper/ and are named the same as the execution module being extended. Any functions
defined inside of the wrapper module are called from the ``salt-ssh module.function argument``
command rather than executing on the minion.
State Module example
--------------------
Running salt states on an salt-ssh minion, obviously requires the state files themselves. To support this,
a state module wrapper script exists at salt/client/ssh/wrapper/state.py, and includes standard state
functions like :py:func:`apply <salt.modules.state.apply>`, :py:func:`sls <salt.modules.state.sls>`,
and :py:func:`highstate <salt.modules.state.highstate>`. When executing ``salt-ssh minion state.highstate``,
these wrapper functions are used and include the logic to walk the low_state output for that minion to
determine files used, gather needed files, tar them together, transfer the tar file to the minion over
ssh, and run a state on the ssh minion. This state then extracts the tar file, applies the needed states
and data, and cleans up the transferred files.
Wrapper Handling
----------------
From the wrapper script any invocations of ``__salt__['some.module']()`` do not run on the master
which is running the wrapper, but instead magically are invoked on the minion over ssh.
Should the function being called exist in the wrapper, the wrapper function will be
used instead.
One way of supporting this workflow may be to create a wrapper function which performs the needed file
copy operations. Now that files are resident on the ssh minion, the next step is to run the original
execution module function. But since that function name was already overridden by the wrapper, a
function alias can be created in the original execution module, which can then be called from the
wrapper.
Example
```````
The saltcheck module needs sls and tst files on the minion to function. The invocation of
:py:func:`saltcheck.run_state_tests <salt.modules.saltcheck.run_state_tests>` is run from
the wrapper module, and is responsible for performing the needed file copy. The
:py:func:`saltcheck <salt.modules.saltcheck>` execution module includes an alias line of
``run_state_tests_ssh = salt.utils.functools.alias_function(run_state_tests, 'run_state_tests_ssh')``
which creates an alias of ``run_state_tests`` with the name ``run_state_tests_ssh``. At the end of
the ``run_state_tests`` function in the wrapper module, it then calls
``__salt__['saltcheck.run_state_tests_ssh']()``. Since this function does not exist in the wrapper script,
the call is made on the remote minion, which then having the needed files, runs as expected.

View file

@ -250,7 +250,7 @@ done at the CLI:
caller = salt.client.Caller()
ret = called.cmd('event.send',
ret = caller.cmd('event.send',
'myco/event/success'
{ 'success': True,
'message': "It works!" })

View file

@ -180,6 +180,7 @@ Results can then be analyzed with `kcachegrind`_ or similar tool.
.. _`kcachegrind`: http://kcachegrind.sourceforge.net/html/Home.html
Make sure you have yappi installed.
On Windows, in the absense of kcachegrind, a simple file-based workflow to create
profiling graphs could use `gprof2dot`_, `graphviz`_ and this batch file:

View file

@ -272,7 +272,7 @@ system, such as a database.
data using a returner (instead of the local job cache on disk).
If a master has many accepted keys, it may take a long time to publish a job
because the master much first determine the matching minions and deliver
because the master must first determine the matching minions and deliver
that information back to the waiting client before the job can be published.
To mitigate this, a key cache may be enabled. This will reduce the load

View file

@ -1620,7 +1620,12 @@ class LocalClient(object):
yield {
id_: {
"out": "no_return",
"ret": "Minion did not return. [No response]",
"ret": "Minion did not return. [No response]"
"\nThe minions may not have all finished running and any "
"remaining minions will return upon completion. To look "
"up the return data for this job later, run the following "
"command:\n\n"
"salt-run jobs.lookup_jid {0}".format(jid),
"retcode": salt.defaults.exitcodes.EX_GENERIC,
}
}

View file

@ -58,6 +58,9 @@ LEA = salt.utils.path.which_bin(
)
LE_LIVE = "/etc/letsencrypt/live/"
if salt.utils.platform.is_freebsd():
LE_LIVE = "/usr/local" + LE_LIVE
def __virtual__():
"""

View file

@ -34,7 +34,15 @@ def __virtual__():
def cluster_create(
version, name="main", port=None, locale=None, encoding=None, datadir=None
version,
name="main",
port=None,
locale=None,
encoding=None,
datadir=None,
allow_group_access=None,
data_checksums=None,
wal_segsize=None,
):
"""
Adds a cluster to the Postgres server.
@ -53,7 +61,9 @@ def cluster_create(
salt '*' postgres.cluster_create '9.3' locale='fr_FR'
salt '*' postgres.cluster_create '11' data_checksums=True wal_segsize='32'
"""
cmd = [salt.utils.path.which("pg_createcluster")]
if port:
cmd += ["--port", six.text_type(port)]
@ -64,6 +74,15 @@ def cluster_create(
if datadir:
cmd += ["--datadir", datadir]
cmd += [version, name]
# initdb-specific options are passed after '--'
if allow_group_access or data_checksums or wal_segsize:
cmd += ["--"]
if allow_group_access is True:
cmd += ["--allow-group-access"]
if data_checksums is True:
cmd += ["--data-checksums"]
if wal_segsize:
cmd += ["--wal-segsize", wal_segsize]
cmdstr = " ".join([pipes.quote(c) for c in cmd])
ret = __salt__["cmd.run_all"](cmdstr, python_shell=False)
if ret.get("retcode", 0) != 0:

View file

@ -6,10 +6,15 @@ from __future__ import absolute_import, print_function, unicode_literals
import logging
from salt.ext import six
log = logging.getLogger(__name__)
def _analyse_overview_field(content):
"""
Split the field in drbd-overview
"""
if "(" in content:
# Output like "Connected(2*)" or "UpToDate(2*)"
return content.split("(")[0], content.split("(")[0]
@ -20,9 +25,140 @@ def _analyse_overview_field(content):
return content, ""
def _count_spaces_startswith(line):
"""
Count the number of spaces before the first character
"""
if line.split("#")[0].strip() == "":
return None
spaces = 0
for i in line:
if i.isspace():
spaces += 1
else:
return spaces
def _analyse_status_type(line):
"""
Figure out the sections in drbdadm status
"""
spaces = _count_spaces_startswith(line)
if spaces is None:
return ""
switch = {
0: "RESOURCE",
2: {" disk:": "LOCALDISK", " role:": "PEERNODE", " connection:": "PEERNODE"},
4: {" peer-disk:": "PEERDISK"},
}
ret = switch.get(spaces, "UNKNOWN")
# isinstance(ret, str) only works when run directly, calling need unicode(six)
if isinstance(ret, six.text_type):
return ret
for x in ret:
if x in line:
return ret[x]
return "UNKNOWN"
def _add_res(line):
"""
Analyse the line of local resource of ``drbdadm status``
"""
global resource
fields = line.strip().split()
if resource:
ret.append(resource)
resource = {}
resource["resource name"] = fields[0]
resource["local role"] = fields[1].split(":")[1]
resource["local volumes"] = []
resource["peer nodes"] = []
def _add_volume(line):
"""
Analyse the line of volumes of ``drbdadm status``
"""
section = _analyse_status_type(line)
fields = line.strip().split()
volume = {}
for field in fields:
volume[field.split(":")[0]] = field.split(":")[1]
if section == "LOCALDISK":
resource["local volumes"].append(volume)
else:
# 'PEERDISK'
lastpnodevolumes.append(volume)
def _add_peernode(line):
"""
Analyse the line of peer nodes of ``drbdadm status``
"""
global lastpnodevolumes
fields = line.strip().split()
peernode = {}
peernode["peernode name"] = fields[0]
# Could be role or connection:
peernode[fields[1].split(":")[0]] = fields[1].split(":")[1]
peernode["peer volumes"] = []
resource["peer nodes"].append(peernode)
lastpnodevolumes = peernode["peer volumes"]
def _empty(dummy):
"""
Action of empty line of ``drbdadm status``
"""
def _unknown_parser(line):
"""
Action of unsupported line of ``drbdadm status``
"""
global ret
ret = {"Unknown parser": line}
def _line_parser(line):
"""
Call action for different lines
"""
section = _analyse_status_type(line)
fields = line.strip().split()
switch = {
"": _empty,
"RESOURCE": _add_res,
"PEERNODE": _add_peernode,
"LOCALDISK": _add_volume,
"PEERDISK": _add_volume,
}
func = switch.get(section, _unknown_parser)
func(line)
def overview():
"""
Show status of the DRBD devices, support two nodes only.
drbd-overview is removed since drbd-utils-9.6.0,
use status instead.
CLI Example:
@ -90,3 +226,58 @@ def overview():
"synched": sync,
}
return ret
# Global para for func status
ret = []
resource = {}
lastpnodevolumes = None
def status(name="all"):
"""
Using drbdadm to show status of the DRBD devices,
available in the latest drbd9.
Support multiple nodes, multiple volumes.
:type name: str
:param name:
Resource name.
:return: drbd status of resource.
:rtype: list(dict(res))
CLI Example:
.. code-block:: bash
salt '*' drbd.status
salt '*' drbd.status name=<resource name>
"""
# Initialize for multiple times test cases
global ret
global resource
ret = []
resource = {}
cmd = ["drbdadm", "status"]
cmd.append(name)
# One possible output: (number of resource/node/vol are flexible)
# resource role:Secondary
# volume:0 disk:Inconsistent
# volume:1 disk:Inconsistent
# drbd-node1 role:Primary
# volume:0 replication:SyncTarget peer-disk:UpToDate done:10.17
# volume:1 replication:SyncTarget peer-disk:UpToDate done:74.08
# drbd-node2 role:Secondary
# volume:0 peer-disk:Inconsistent resync-suspended:peer
# volume:1 peer-disk:Inconsistent resync-suspended:peer
for line in __salt__["cmd.run"](cmd).splitlines():
_line_parser(line)
if resource:
ret.append(resource)
return ret

View file

@ -4426,7 +4426,7 @@ def extract_hash(
else:
hash_len_expr = six.text_type(hash_len)
filename_separators = string.whitespace + r"\/"
filename_separators = string.whitespace + r"\/*"
if source_hash_name:
if not isinstance(source_hash_name, six.string_types):

View file

@ -58,6 +58,8 @@ def _gluster_output_cleanup(result):
for line in result.splitlines():
if line.startswith("gluster>"):
ret += line[9:].strip()
elif line.startswith("Welcome to gluster prompt"):
pass
else:
ret += line.strip()

View file

@ -289,14 +289,91 @@ def refresh_db(failhard=False, **kwargs): # pylint: disable=unused-argument
return ret
def _is_testmode(**kwargs):
"""
Returns whether a test mode (noaction) operation was requested.
"""
return bool(kwargs.get("test") or __opts__.get("test"))
def _append_noaction_if_testmode(cmd, **kwargs):
"""
Adds the --noaction flag to the command if it's running in the test mode.
"""
if bool(kwargs.get("test") or __opts__.get("test")):
if _is_testmode(**kwargs):
cmd.append("--noaction")
def _build_install_command_list(cmd_prefix, to_install, to_downgrade, to_reinstall):
"""
Builds a list of install commands to be executed in sequence in order to process
each of the to_install, to_downgrade, and to_reinstall lists.
"""
cmds = []
if to_install:
cmd = copy.deepcopy(cmd_prefix)
cmd.extend(to_install)
cmds.append(cmd)
if to_downgrade:
cmd = copy.deepcopy(cmd_prefix)
cmd.append("--force-downgrade")
cmd.extend(to_downgrade)
cmds.append(cmd)
if to_reinstall:
cmd = copy.deepcopy(cmd_prefix)
cmd.append("--force-reinstall")
cmd.extend(to_reinstall)
cmds.append(cmd)
return cmds
def _parse_reported_packages_from_install_output(output):
"""
Parses the output of "opkg install" to determine what packages would have been
installed by an operation run with the --noaction flag.
We are looking for lines like:
Installing <package> (<version>) on <target>
or
Upgrading <package> from <oldVersion> to <version> on root
"""
reported_pkgs = {}
install_pattern = re.compile(
r"Installing\s(?P<package>.*?)\s\((?P<version>.*?)\)\son\s(?P<target>.*?)"
)
upgrade_pattern = re.compile(
r"Upgrading\s(?P<package>.*?)\sfrom\s(?P<oldVersion>.*?)\sto\s(?P<version>.*?)\son\s(?P<target>.*?)"
)
for line in salt.utils.itertools.split(output, "\n"):
match = install_pattern.match(line)
if match is None:
match = upgrade_pattern.match(line)
if match:
reported_pkgs[match.group("package")] = match.group("version")
return reported_pkgs
def _execute_install_command(cmd, parse_output, errors, parsed_packages):
"""
Executes a command for the install operation.
If the command fails, its error output will be appended to the errors list.
If the command succeeds and parse_output is true, updated packages will be appended
to the parsed_packages dictionary.
"""
out = __salt__["cmd.run_all"](cmd, output_loglevel="trace", python_shell=False)
if out["retcode"] != 0:
if out["stderr"]:
errors.append(out["stderr"])
else:
errors.append(out["stdout"])
elif parse_output:
parsed_packages.update(
_parse_reported_packages_from_install_output(out["stdout"])
)
def install(
name=None, refresh=False, pkgs=None, sources=None, reinstall=False, **kwargs
):
@ -440,24 +517,9 @@ def install(
# This should cause the command to fail.
to_install.append(pkgstr)
cmds = []
if to_install:
cmd = copy.deepcopy(cmd_prefix)
cmd.extend(to_install)
cmds.append(cmd)
if to_downgrade:
cmd = copy.deepcopy(cmd_prefix)
cmd.append("--force-downgrade")
cmd.extend(to_downgrade)
cmds.append(cmd)
if to_reinstall:
cmd = copy.deepcopy(cmd_prefix)
cmd.append("--force-reinstall")
cmd.extend(to_reinstall)
cmds.append(cmd)
cmds = _build_install_command_list(
cmd_prefix, to_install, to_downgrade, to_reinstall
)
if not cmds:
return {}
@ -466,16 +528,17 @@ def install(
refresh_db()
errors = []
is_testmode = _is_testmode(**kwargs)
test_packages = {}
for cmd in cmds:
out = __salt__["cmd.run_all"](cmd, output_loglevel="trace", python_shell=False)
if out["retcode"] != 0:
if out["stderr"]:
errors.append(out["stderr"])
else:
errors.append(out["stdout"])
_execute_install_command(cmd, is_testmode, errors, test_packages)
__context__.pop("pkg.list_pkgs", None)
new = list_pkgs()
if is_testmode:
new = copy.deepcopy(new)
new.update(test_packages)
ret = salt.utils.data.compare_dicts(old, new)
if pkg_type == "file" and reinstall:
@ -513,6 +576,26 @@ def install(
return ret
def _parse_reported_packages_from_remove_output(output):
"""
Parses the output of "opkg remove" to determine what packages would have been
removed by an operation run with the --noaction flag.
We are looking for lines like
Removing <package> (<version>) from <Target>...
"""
reported_pkgs = {}
remove_pattern = re.compile(
r"Removing\s(?P<package>.*?)\s\((?P<version>.*?)\)\sfrom\s(?P<target>.*?)..."
)
for line in salt.utils.itertools.split(output, "\n"):
match = remove_pattern.match(line)
if match:
reported_pkgs[match.group("package")] = ""
return reported_pkgs
def remove(name=None, pkgs=None, **kwargs): # pylint: disable=unused-argument
"""
Remove packages using ``opkg remove``.
@ -576,6 +659,9 @@ def remove(name=None, pkgs=None, **kwargs): # pylint: disable=unused-argument
__context__.pop("pkg.list_pkgs", None)
new = list_pkgs()
if _is_testmode(**kwargs):
reportedPkgs = _parse_reported_packages_from_remove_output(out["stdout"])
new = {k: v for k, v in new.items() if k not in reportedPkgs}
ret = salt.utils.data.compare_dicts(old, new)
rs_result = _get_restartcheck_result(errors)

View file

@ -22,15 +22,17 @@ log = logging.getLogger(__name__)
def __virtual__():
"""
Only works on OpenBSD for now; other systems with pf (macOS, FreeBSD, etc)
need to be tested before enabling them.
Only works on OpenBSD and FreeBSD for now; other systems with pf (macOS,
FreeBSD, etc) need to be tested before enabling them.
"""
if __grains__["os"] == "OpenBSD" and salt.utils.path.which("pfctl"):
tested_oses = ["FreeBSD", "OpenBSD"]
if __grains__["os"] in tested_oses and salt.utils.path.which("pfctl"):
return True
return (
False,
"The pf execution module cannot be loaded: either the system is not OpenBSD or the pfctl binary was not found",
"The pf execution module cannot be loaded: either the OS ({}) is not "
"tested or the pfctl binary was not found".format(__grains__["os"]),
)
@ -102,7 +104,7 @@ def loglevel(level):
level:
Log level. Should be one of the following: emerg, alert, crit, err, warning, notice,
info or debug.
info or debug (OpenBSD); or none, urgent, misc, loud (FreeBSD).
CLI example:
@ -114,7 +116,20 @@ def loglevel(level):
# always made a change.
ret = {"changes": True}
all_levels = ["emerg", "alert", "crit", "err", "warning", "notice", "info", "debug"]
myos = __grains__["os"]
if myos == "FreeBSD":
all_levels = ["none", "urgent", "misc", "loud"]
else:
all_levels = [
"emerg",
"alert",
"crit",
"err",
"warning",
"notice",
"info",
"debug",
]
if level not in all_levels:
raise SaltInvocationError("Unknown loglevel: {0}".format(level))

View file

@ -66,7 +66,7 @@ def get(
The value specified by this option will be returned if the desired
pillar key does not exist.
If a default value is specified, then it will be an empty string,
If a default value is not specified, then it will be an empty string,
unless :conf_minion:`pillar_raise_on_missing` is set to ``True``, in
which case an error will be raised.

View file

@ -6,6 +6,9 @@ Utility functions for use with or in SLS files
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
import os
import textwrap
# Import Salt libs
import salt.exceptions
import salt.loader
@ -243,3 +246,184 @@ def deserialize(serializer, stream_or_string, **mod_kwargs):
"""
kwargs = salt.utils.args.clean_kwargs(**mod_kwargs)
return _get_serialize_fn(serializer, "deserialize")(stream_or_string, **kwargs)
def banner(
width=72,
commentchar="#",
borderchar="#",
blockstart=None,
blockend=None,
title=None,
text=None,
newline=False,
):
"""
Create a standardized comment block to include in a templated file.
A common technique in configuration management is to include a comment
block in managed files, warning users not to modify the file. This
function simplifies and standardizes those comment blocks.
:param width: The width, in characters, of the banner. Default is 72.
:param commentchar: The character to be used in the starting position of
each line. This value should be set to a valid line comment character
for the syntax of the file in which the banner is being inserted.
Multiple character sequences, like '//' are supported.
If the file's syntax does not support line comments (such as XML),
use the ``blockstart`` and ``blockend`` options.
:param borderchar: The character to use in the top and bottom border of
the comment box. Must be a single character.
:param blockstart: The character sequence to use at the beginning of a
block comment. Should be used in conjunction with ``blockend``
:param blockend: The character sequence to use at the end of a
block comment. Should be used in conjunction with ``blockstart``
:param title: The first field of the comment block. This field appears
centered at the top of the box.
:param text: The second filed of the comment block. This field appears
left-justifed at the bottom of the box.
:param newline: Boolean value to indicate whether the comment block should
end with a newline. Default is ``False``.
**Example 1 - the default banner:**
.. code-block:: jinja
{{ salt['slsutil.banner']() }}
.. code-block:: none
########################################################################
# #
# THIS FILE IS MANAGED BY SALT - DO NOT EDIT #
# #
# The contents of this file are managed by Salt. Any changes to this #
# file may be overwritten automatically and without warning. #
########################################################################
**Example 2 - a Javadoc-style banner:**
.. code-block:: jinja
{{ salt['slsutil.banner'](commentchar=' *', borderchar='*', blockstart='/**', blockend=' */') }}
.. code-block:: none
/**
***********************************************************************
* *
* THIS FILE IS MANAGED BY SALT - DO NOT EDIT *
* *
* The contents of this file are managed by Salt. Any changes to this *
* file may be overwritten automatically and without warning. *
***********************************************************************
*/
**Example 3 - custom text:**
.. code-block:: jinja
{{ set copyright='This file may not be copied or distributed without permission of SaltStack, Inc.' }}
{{ salt['slsutil.banner'](title='Copyright 2019 SaltStack, Inc.', text=copyright, width=60) }}
.. code-block:: none
############################################################
# #
# Copyright 2019 SaltStack, Inc. #
# #
# This file may not be copied or distributed without #
# permission of SaltStack, Inc. #
############################################################
"""
if title is None:
title = "THIS FILE IS MANAGED BY SALT - DO NOT EDIT"
if text is None:
text = (
"The contents of this file are managed by Salt. "
"Any changes to this file may be overwritten "
"automatically and without warning."
)
# Set up some typesetting variables
ledge = commentchar.rstrip()
redge = commentchar.strip()
lgutter = ledge + " "
rgutter = " " + redge
textwidth = width - len(lgutter) - len(rgutter)
# Check the width
if textwidth <= 0:
raise salt.exceptions.ArgumentValueError("Width is too small to render banner")
# Define the static elements
border_line = (
commentchar + borderchar[:1] * (width - len(ledge) - len(redge)) + redge
)
spacer_line = commentchar + " " * (width - len(commentchar) * 2) + commentchar
# Create the banner
wrapper = textwrap.TextWrapper(width=textwidth)
block = list()
if blockstart is not None:
block.append(blockstart)
block.append(border_line)
block.append(spacer_line)
for line in wrapper.wrap(title):
block.append(lgutter + line.center(textwidth) + rgutter)
block.append(spacer_line)
for line in wrapper.wrap(text):
block.append(lgutter + line + " " * (textwidth - len(line)) + rgutter)
block.append(border_line)
if blockend is not None:
block.append(blockend)
# Convert list to multi-line string
result = os.linesep.join(block)
# Add a newline character to the end of the banner
if newline:
return result + os.linesep
return result
def boolstr(value, true="true", false="false"):
"""
Convert a boolean value into a string. This function is
intended to be used from within file templates to provide
an easy way to take boolean values stored in Pillars or
Grains, and write them out in the apprpriate syntax for
a particular file template.
:param value: The boolean value to be converted
:param true: The value to return if ``value`` is ``True``
:param false: The value to return if ``value`` is ``False``
In this example, a pillar named ``smtp:encrypted`` stores a boolean
value, but the template that uses that value needs ``yes`` or ``no``
to be written, based on the boolean value.
*Note: this is written on two lines for clarity. The same result
could be achieved in one line.*
.. code-block:: jinja
{% set encrypted = salt[pillar.get]('smtp:encrypted', false) %}
use_tls: {{ salt['slsutil.boolstr'](encrypted, 'yes', 'no') }}
Result (assuming the value is ``True``):
.. code-block:: none
use_tls: yes
"""
if value:
return true
return false

View file

@ -7,7 +7,7 @@ Functions to interact with Hashicorp Vault.
:platform: all
:note: If you see the following error, you'll need to upgrade ``requests`` to atleast 2.4.2
:note: If you see the following error, you'll need to upgrade ``requests`` to at least 2.4.2
.. code-block:: text

View file

@ -26,16 +26,14 @@ import salt.utils.locales
import salt.utils.platform
import salt.utils.winapi
from salt.exceptions import CommandExecutionError
# Import 3rd-party Libs
from salt.ext import six
try:
import wmi
import win32net
import pywintypes
import win32api
import win32con
import pywintypes
import win32net
import wmi
from ctypes import windll
HAS_WIN32NET_MODS = True
@ -555,29 +553,6 @@ def get_system_info():
# Lookup dicts for Win32_OperatingSystem
os_type = {1: "Work Station", 2: "Domain Controller", 3: "Server"}
# Connect to WMI
with salt.utils.winapi.Com():
conn = wmi.WMI()
system = conn.Win32_OperatingSystem()[0]
ret = {
"name": get_computer_name(),
"description": system.Description,
"install_date": system.InstallDate,
"last_boot": system.LastBootUpTime,
"os_manufacturer": system.Manufacturer,
"os_name": system.Caption,
"users": system.NumberOfUsers,
"organization": system.Organization,
"os_architecture": system.OSArchitecture,
"primary": system.Primary,
"os_type": os_type[system.ProductType],
"registered_user": system.RegisteredUser,
"system_directory": system.SystemDirectory,
"system_drive": system.SystemDrive,
"os_version": system.Version,
"windows_directory": system.WindowsDirectory,
}
# lookup dicts for Win32_ComputerSystem
domain_role = {
0: "Standalone Workstation",
@ -606,75 +581,92 @@ def get_system_info():
7: "Performance Server",
8: "Maximum",
}
# Must get chassis_sku_number this way for backwards compatibility
# system.ChassisSKUNumber is only available on Windows 10/2016 and newer
product = conn.Win32_ComputerSystemProduct()[0]
ret.update({"chassis_sku_number": product.SKUNumber})
system = conn.Win32_ComputerSystem()[0]
# Get pc_system_type depending on Windows version
if platform.release() in ["Vista", "7", "8"]:
# Types for Vista, 7, and 8
pc_system_type = pc_system_types[system.PCSystemType]
else:
# New types were added with 8.1 and newer
pc_system_types.update({8: "Slate", 9: "Maximum"})
pc_system_type = pc_system_types[system.PCSystemType]
ret.update(
{
"bootup_state": system.BootupState,
"caption": system.Caption,
"chassis_bootup_state": warning_states[system.ChassisBootupState],
"dns_hostname": system.DNSHostname,
"domain": system.Domain,
"domain_role": domain_role[system.DomainRole],
"hardware_manufacturer": system.Manufacturer,
"hardware_model": system.Model,
"network_server_mode_enabled": system.NetworkServerModeEnabled,
"part_of_domain": system.PartOfDomain,
"pc_system_type": pc_system_type,
"power_state": system.PowerState,
"status": system.Status,
"system_type": system.SystemType,
"total_physical_memory": byte_calc(system.TotalPhysicalMemory),
"total_physical_memory_raw": system.TotalPhysicalMemory,
"thermal_state": warning_states[system.ThermalState],
"workgroup": system.Workgroup,
}
)
# Get processor information
processors = conn.Win32_Processor()
ret["processors"] = 0
ret["processors_logical"] = 0
ret["processor_cores"] = 0
ret["processor_cores_enabled"] = 0
ret["processor_manufacturer"] = processors[0].Manufacturer
ret["processor_max_clock_speed"] = (
six.text_type(processors[0].MaxClockSpeed) + "MHz"
)
for system in processors:
ret["processors"] += 1
ret["processors_logical"] += system.NumberOfLogicalProcessors
ret["processor_cores"] += system.NumberOfCores
try:
ret["processor_cores_enabled"] += system.NumberOfEnabledCore
except (AttributeError, TypeError):
pass
if ret["processor_cores_enabled"] == 0:
ret.pop("processor_cores_enabled", False)
system = conn.Win32_BIOS()[0]
ret.update(
{
"hardware_serial": system.SerialNumber,
"bios_manufacturer": system.Manufacturer,
"bios_version": system.Version,
"bios_details": system.BIOSVersion,
"bios_caption": system.Caption,
"bios_description": system.Description,
# Connect to WMI
with salt.utils.winapi.Com():
conn = wmi.WMI()
system = conn.Win32_OperatingSystem()[0]
ret = {
"name": get_computer_name(),
"description": system.Description,
"install_date": system.InstallDate,
"last_boot": system.LastBootUpTime,
"os_manufacturer": system.Manufacturer,
"os_name": system.Caption,
"users": system.NumberOfUsers,
"organization": system.Organization,
"os_architecture": system.OSArchitecture,
"primary": system.Primary,
"os_type": os_type[system.ProductType],
"registered_user": system.RegisteredUser,
"system_directory": system.SystemDirectory,
"system_drive": system.SystemDrive,
"os_version": system.Version,
"windows_directory": system.WindowsDirectory,
}
)
ret["install_date"] = _convert_date_time_string(ret["install_date"])
ret["last_boot"] = _convert_date_time_string(ret["last_boot"])
system = conn.Win32_ComputerSystem()[0]
# Get pc_system_type depending on Windows version
if platform.release() in ["Vista", "7", "8"]:
# Types for Vista, 7, and 8
pc_system_type = pc_system_types[system.PCSystemType]
else:
# New types were added with 8.1 and newer
pc_system_types.update({8: "Slate", 9: "Maximum"})
pc_system_type = pc_system_types[system.PCSystemType]
ret.update(
{
"bootup_state": system.BootupState,
"caption": system.Caption,
"chassis_bootup_state": warning_states[system.ChassisBootupState],
"chassis_sku_number": system.ChassisSKUNumber,
"dns_hostname": system.DNSHostname,
"domain": system.Domain,
"domain_role": domain_role[system.DomainRole],
"hardware_manufacturer": system.Manufacturer,
"hardware_model": system.Model,
"network_server_mode_enabled": system.NetworkServerModeEnabled,
"part_of_domain": system.PartOfDomain,
"pc_system_type": pc_system_type,
"power_state": system.PowerState,
"status": system.Status,
"system_type": system.SystemType,
"total_physical_memory": byte_calc(system.TotalPhysicalMemory),
"total_physical_memory_raw": system.TotalPhysicalMemory,
"thermal_state": warning_states[system.ThermalState],
"workgroup": system.Workgroup,
}
)
# Get processor information
processors = conn.Win32_Processor()
ret["processors"] = 0
ret["processors_logical"] = 0
ret["processor_cores"] = 0
ret["processor_cores_enabled"] = 0
ret["processor_manufacturer"] = processors[0].Manufacturer
ret["processor_max_clock_speed"] = (
six.text_type(processors[0].MaxClockSpeed) + "MHz"
)
for processor in processors:
ret["processors"] += 1
ret["processors_logical"] += processor.NumberOfLogicalProcessors
ret["processor_cores"] += processor.NumberOfCores
ret["processor_cores_enabled"] += processor.NumberOfEnabledCore
bios = conn.Win32_BIOS()[0]
ret.update(
{
"hardware_serial": bios.SerialNumber,
"bios_manufacturer": bios.Manufacturer,
"bios_version": bios.Version,
"bios_details": bios.BIOSVersion,
"bios_caption": bios.Caption,
"bios_description": bios.Description,
}
)
ret["install_date"] = _convert_date_time_string(ret["install_date"])
ret["last_boot"] = _convert_date_time_string(ret["last_boot"])
return ret
@ -742,13 +734,10 @@ def set_hostname(hostname):
salt 'minion-id' system.set_hostname newhostname
"""
curr_hostname = get_hostname()
cmd = "wmic computersystem where name='{0}' call rename name='{1}'".format(
curr_hostname, hostname
)
ret = __salt__["cmd.run"](cmd=cmd)
return "successful" in ret
with salt.utils.winapi.Com():
conn = wmi.WMI()
comp = conn.Win32_ComputerSystem()[0]
return comp.Rename(Name=hostname)
def join_domain(
@ -1034,11 +1023,41 @@ def get_domain_workgroup():
"""
with salt.utils.winapi.Com():
conn = wmi.WMI()
for computer in conn.Win32_ComputerSystem():
if computer.PartOfDomain:
return {"Domain": computer.Domain}
else:
return {"Workgroup": computer.Domain}
for computer in conn.Win32_ComputerSystem():
if computer.PartOfDomain:
return {"Domain": computer.Domain}
else:
return {"Workgroup": computer.Domain}
def set_domain_workgroup(workgroup):
"""
Set the domain or workgroup the computer belongs to.
.. versionadded:: Sodium
Returns:
bool: ``True`` if successful, otherwise ``False``
CLI Example:
.. code-block:: bash
salt 'minion-id' system.set_domain_workgroup LOCAL
"""
if six.PY2:
workgroup = _to_unicode(workgroup)
# Initialize COM
with salt.utils.winapi.Com():
# Grab the first Win32_ComputerSystem object from wmi
conn = wmi.WMI()
comp = conn.Win32_ComputerSystem()[0]
# Now we can join the new workgroup
res = comp.JoinDomainOrWorkgroup(Name=workgroup.upper())
return True if not res[0] else False
def _try_parse_datetime(time_str, fmts):

View file

@ -209,24 +209,22 @@ def get_zone():
Returns:
str: Timezone in unix format
Raises:
CommandExecutionError: If timezone could not be gathered
CLI Example:
.. code-block:: bash
salt '*' timezone.get_zone
"""
win_zone = __utils__["reg.read_value"](
hive="HKLM",
key="SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation",
vname="TimeZoneKeyName",
)["vdata"]
# Some data may have null characters. We only need the first portion up to
# the first null character. See the following:
# https://github.com/saltstack/salt/issues/51940
# https://stackoverflow.com/questions/27716746/hklm-system-currentcontrolset-control-timezoneinformation-timezonekeyname-corrup
if "\0" in win_zone:
win_zone = win_zone.split("\0")[0]
return mapper.get_unix(win_zone.lower(), "Unknown")
cmd = ["tzutil", "/g"]
res = __salt__["cmd.run_all"](cmd, python_shell=False)
if res["retcode"] or not res["stdout"]:
raise CommandExecutionError(
"tzutil encountered an error getting timezone", info=res
)
return mapper.get_unix(res["stdout"].lower(), "Unknown")
def get_offset():

View file

@ -206,12 +206,17 @@ class Serial(object):
def verylong_encoder(obj, context):
# Make sure we catch recursion here.
objid = id(obj)
if objid in context:
# This instance list needs to correspond to the types recursed
# in the below if/elif chain. Also update
# tests/unit/test_payload.py
if objid in context and isinstance(obj, (dict, list, tuple)):
return "<Recursion on {} with id={}>".format(
type(obj).__name__, id(obj)
)
context.add(objid)
# The isinstance checks in this if/elif chain need to be
# kept in sync with the above recursion check.
if isinstance(obj, dict):
for key, value in six.iteritems(obj.copy()):
obj[key] = verylong_encoder(value, context)

View file

@ -65,7 +65,6 @@ def get_pillar(
# If local pillar and we're caching, run through the cache system first
log.debug("Determining pillar cache")
if opts["pillar_cache"]:
log.info("Compiling pillar from cache")
log.debug("get_pillar using pillar cache with ext: %s", ext)
return PillarCache(
opts,

View file

@ -242,6 +242,10 @@ def ext_pillar(
# Get the Master's instance info, primarily the region
(_, region) = _get_instance_info()
# If the Minion's region is available, use it instead
if use_grain:
region = __grains__.get("ec2", {}).get("region", region)
try:
conn = boto.ec2.connect_to_region(region)
except boto.exception.AWSConnectionError as exc:

View file

@ -4959,6 +4959,370 @@ def replace(
return ret
def keyvalue(
name,
key=None,
value=None,
key_values=None,
separator="=",
append_if_not_found=False,
prepend_if_not_found=False,
search_only=False,
show_changes=True,
ignore_if_missing=False,
count=1,
uncomment=None,
key_ignore_case=False,
value_ignore_case=False,
):
"""
Key/Value based editing of a file.
.. versionadded:: Sodium
This function differs from ``file.replace`` in that it is able to search for
keys, followed by a customizable separator, and replace the value with the
given value. Should the value be the same as the one already in the file, no
changes will be made.
Either supply both ``key`` and ``value`` parameters, or supply a dictionary
with key / value pairs. It is an error to supply both.
name
Name of the file to search/replace in.
key
Key to search for when ensuring a value. Use in combination with a
``value`` parameter.
value
Value to set for a given key. Use in combination with a ``key``
parameter.
key_values
Dictionary of key / value pairs to search for and ensure values for.
Used to specify multiple key / values at once.
separator : "="
Separator which separates key from value.
append_if_not_found : False
Append the key/value to the end of the file if not found. Note that this
takes precedence over ``prepend_if_not_found``.
prepend_if_not_found : False
Prepend the key/value to the beginning of the file if not found. Note
that ``append_if_not_found`` takes precedence.
show_changes : True
Show a diff of the resulting removals and inserts.
ignore_if_missing : False
Return with success even if the file is not found (or not readable).
count : 1
Number of occurences to allow (and correct), default is 1. Set to -1 to
replace all, or set to 0 to remove all lines with this key regardsless
of its value.
.. note::
Any additional occurences after ``count`` are removed.
A count of -1 will only replace all occurences that are currently
uncommented already. Lines commented out will be left alone.
uncomment : None
Disregard and remove supplied leading characters when finding keys. When
set to None, lines that are commented out are left for what they are.
.. note::
The argument to ``uncomment`` is not a prefix string. Rather; it is a
set of characters, each of which are stripped.
key_ignore_case : False
Keys are matched case insensitively. When a value is changed the matched
key is kept as-is.
value_ignore_case : False
Values are checked case insensitively, trying to set e.g. 'Yes' while
the current value is 'yes', will not result in changes when
``value_ignore_case`` is set to True.
An example of using ``file.keyvalue`` to ensure sshd does not allow
for root to login with a password and at the same time setting the
login-gracetime to 1 minute and disabling all forwarding:
.. code-block:: yaml
sshd_config_harden:
file.keyvalue:
- name: /etc/ssh/sshd_config
- key_values:
permitrootlogin: 'without-password'
LoginGraceTime: '1m'
DisableForwarding: 'yes'
- separator: ' '
- uncomment: '# '
- key_ignore_case: True
- append_if_not_found: True
The same example, except for only ensuring PermitRootLogin is set correctly.
Thus being able to use the shorthand ``key`` and ``value`` parameters
instead of ``key_values``.
.. code-block:: yaml
sshd_config_harden:
file.keyvalue:
- name: /etc/ssh/sshd_config
- key: PermitRootLogin
- value: without-password
- separator: ' '
- uncomment: '# '
- key_ignore_case: True
- append_if_not_found: True
.. note::
Notice how the key is not matched case-sensitively, this way it will
correctly identify both 'PermitRootLogin' as well as 'permitrootlogin'.
"""
name = os.path.expanduser(name)
# default return values
ret = {
"name": name,
"changes": {},
"pchanges": {},
"result": None,
"comment": "",
}
if not name:
return _error(ret, "Must provide name to file.keyvalue")
if key is not None and value is not None:
if type(key_values) is dict:
return _error(
ret, "file.keyvalue can not combine key_values with key and value"
)
key_values = {str(key): value}
elif type(key_values) is not dict:
return _error(
ret, "file.keyvalue key and value not supplied and key_values empty"
)
# try to open the file and only return a comment if ignore_if_missing is
# enabled, also mark as an error if not
file_contents = []
try:
with salt.utils.files.fopen(name, "r") as fd:
file_contents = fd.readlines()
except (OSError, IOError):
ret["comment"] = "unable to open {n}".format(n=name)
ret["result"] = True if ignore_if_missing else False
return ret
# used to store diff combinations and check if anything has changed
diff = []
# store the final content of the file in case it needs to be rewritten
content = []
# target format is templated like this
tmpl = "{key}{sep}{value}" + os.linesep
# number of lines changed
changes = 0
# keep track of number of times a key was updated
diff_count = {k: count for k in key_values.keys()}
# read all the lines from the file
for line in file_contents:
test_line = line.lstrip(uncomment)
did_uncomment = True if len(line) > len(test_line) else False
if key_ignore_case:
test_line = test_line.lower()
for key, value in key_values.items():
test_key = key.lower() if key_ignore_case else key
# if the line starts with the key
if test_line.startswith(test_key):
# if the testline got uncommented then the real line needs to
# be uncommented too, otherwhise there might be separation on
# a character which is part of the comment set
working_line = line.lstrip(uncomment) if did_uncomment else line
# try to separate the line into its' components
line_key, line_sep, line_value = working_line.partition(separator)
# if separation was unsuccessful then line_sep is empty so
# no need to keep trying. continue instead
if line_sep != separator:
continue
# start on the premises the key does not match the actual line
keys_match = False
if key_ignore_case:
if line_key.lower() == test_key:
keys_match = True
else:
if line_key == test_key:
keys_match = True
# if the key was found in the line and separation was successful
if keys_match:
# trial and error have shown it's safest to strip whitespace
# from values for the sake of matching
line_value = line_value.strip()
# make sure the value is an actual string at this point
test_value = str(value).strip()
# convert test_value and line_value to lowercase if need be
if value_ignore_case:
line_value = line_value.lower()
test_value = test_value.lower()
# values match if they are equal at this point
values_match = True if line_value == test_value else False
# in case a line had its comment removed there are some edge
# cases that need considderation where changes are needed
# regardless of values already matching.
needs_changing = False
if did_uncomment:
# irrespective of a value, if it was commented out and
# changes are still to be made, then it needs to be
# commented in
if diff_count[key] > 0:
needs_changing = True
# but if values did not match but there are really no
# changes expected anymore either then leave this line
elif not values_match:
values_match = True
else:
# a line needs to be removed if it has been seen enough
# times and was not commented out, regardless of value
if diff_count[key] == 0:
needs_changing = True
# then start checking to see if the value needs replacing
if not values_match or needs_changing:
# the old line always needs to go, so that will be
# reflected in the diff (this is the original line from
# the file being read)
diff.append("- {0}".format(line))
line = line[:0]
# any non-zero value means something needs to go back in
# its place. negative values are replacing all lines not
# commented out, positive values are having their count
# reduced by one every replacement
if diff_count[key] != 0:
# rebuild the line using the key and separator found
# and insert the correct value.
line = str(
tmpl.format(key=line_key, sep=line_sep, value=value)
)
# display a comment in case a value got converted
# into a string
if not isinstance(value, str):
diff.append(
"+ {0} (from {1} type){2}".format(
line.rstrip(), type(value).__name__, os.linesep
)
)
else:
diff.append("+ {0}".format(line))
changes += 1
# subtract one from the count if it was larger than 0, so
# next lines are removed. if it is less than 0 then count is
# ignored and all lines will be updated.
if diff_count[key] > 0:
diff_count[key] -= 1
# at this point a continue saves going through the rest of
# the keys to see if they match since this line already
# matched the current key
continue
# with the line having been checked for all keys (or matched before all
# keys needed searching), the line can be added to the content to be
# written once the last checks have been performed
content.append(line)
# finally, close the file
fd.close()
# if append_if_not_found was requested, then append any key/value pairs
# still having a count left on them
if append_if_not_found:
tmpdiff = []
for key, value in key_values.items():
if diff_count[key] > 0:
line = tmpl.format(key=key, sep=separator, value=value)
tmpdiff.append("+ {0}".format(line))
content.append(line)
changes += 1
if tmpdiff:
tmpdiff.insert(0, "- <EOF>" + os.linesep)
tmpdiff.append("+ <EOF>" + os.linesep)
diff.extend(tmpdiff)
# only if append_if_not_found was not set should prepend_if_not_found be
# considered, benefit of this is that the number of counts left does not
# mean there might be both a prepend and append happening
elif prepend_if_not_found:
did_diff = False
for key, value in key_values.items():
if diff_count[key] > 0:
line = tmpl.format(key=key, sep=separator, value=value)
if not did_diff:
diff.insert(0, " <SOF>" + os.linesep)
did_diff = True
diff.insert(1, "+ {0}".format(line))
content.insert(0, line)
changes += 1
# if a diff was made
if changes > 0:
# return comment of changes if test
if __opts__["test"]:
ret["comment"] = "File {n} is set to be changed ({c} lines)".format(
n=name, c=changes
)
if show_changes:
# For some reason, giving an actual diff even in test=True mode
# will be seen as both a 'changed' and 'unchanged'. this seems to
# match the other modules behaviour though
ret["pchanges"]["diff"] = "".join(diff)
# add changes to comments for now as well because of how
# stateoutputter seems to handle pchanges etc.
# See: https://github.com/saltstack/salt/issues/40208
ret["comment"] += "\nPredicted diff:\n\r\t\t"
ret["comment"] += "\r\t\t".join(diff)
ret["result"] = None
# otherwise return the actual diff lines
else:
ret["comment"] = "Changed {c} lines".format(c=changes)
if show_changes:
ret["changes"]["diff"] = "".join(diff)
else:
ret["result"] = True
return ret
# if not test=true, try and write the file
if not __opts__["test"]:
try:
with salt.utils.files.fopen(name, "w") as fd:
# write all lines to the file which was just truncated
fd.writelines(content)
fd.close()
except (OSError, IOError):
# return an error if the file was not writable
ret["comment"] = "{n} not writable".format(n=name)
ret["result"] = False
return ret
# if all went well, then set result to true
ret["result"] = True
return ret
def blockreplace(
name,
marker_start="#-- start managed zone --",

View file

@ -28,7 +28,17 @@ def __virtual__():
return True
def present(version, name, port=None, encoding=None, locale=None, datadir=None):
def present(
version,
name,
port=None,
encoding=None,
locale=None,
datadir=None,
allow_group_access=None,
data_checksums=None,
wal_segsize=None,
):
"""
Ensure that the named cluster is present with the specified properties.
For more information about all of these options see man pg_createcluster(1)
@ -51,6 +61,15 @@ def present(version, name, port=None, encoding=None, locale=None, datadir=None):
datadir
Where the cluster is stored
allow_group_access
Allows users in the same group as the cluster owner to read all cluster files created by initdb
data_checksums
Use checksums on data pages
wal_segsize
Set the WAL segment size, in megabytes
.. versionadded:: 2015.XX
"""
msg = "Cluster {0}/{1} is already present".format(version, name)
@ -87,6 +106,9 @@ def present(version, name, port=None, encoding=None, locale=None, datadir=None):
locale=locale,
encoding=encoding,
datadir=datadir,
allow_group_access=allow_group_access,
data_checksums=data_checksums,
wal_segsize=wal_segsize,
)
if cluster:
msg = "The cluster {0}/{1} has been created"

View file

@ -19,6 +19,9 @@ data directory.
- encoding: UTF8
- locale: C
- runas: postgres
- allow_group_access: True
- data_checksums: True
- wal_segsize: 32
"""
from __future__ import absolute_import, print_function, unicode_literals

View file

@ -93,7 +93,7 @@ def post_message(name, **kwargs):
enough to be displayed side-by-side with other values.
webhook
The identifier of WebHook.
The identifier of WebHook (URL or token).
channel
The channel to use instead of the WebHook default.

View file

@ -300,6 +300,7 @@ def export(
out = __salt__[svn_cmd](cwd, name, basename, user, username, password, rev, *opts)
ret["changes"]["new"] = name
ret["changes"]["comment"] = name + " was Exported to " + target
ret["comment"] = out
return ret

View file

@ -24,8 +24,6 @@ import logging
# Import Salt libs
import salt.utils.functools
import salt.utils.platform
# Import 3rd party libs
from salt.ext import six
log = logging.getLogger(__name__)
@ -36,11 +34,13 @@ __virtualname__ = "system"
def __virtual__():
"""
This only supports Windows
Make sure this Windows and that the win_system module is available
"""
if salt.utils.platform.is_windows() and "system.get_computer_desc" in __salt__:
return __virtualname__
return (False, "system module could not be loaded")
if not salt.utils.platform.is_windows():
return False, "win_system: Only available on Windows"
if "system.get_computer_desc" not in __salt__:
return False, "win_system: win_system execution module not available"
return __virtualname__
def computer_desc(name):
@ -172,6 +172,85 @@ def hostname(name):
return ret
def workgroup(name):
"""
.. versionadded:: Sodium
Manage the workgroup of the computer
Args:
name (str): The workgroup to set
Example:
.. code-block:: yaml
set workgroup:
system.workgroup:
- name: local
"""
ret = {"name": name.upper(), "result": False, "changes": {}, "comment": ""}
# Grab the current domain/workgroup
out = __salt__["system.get_domain_workgroup"]()
current_workgroup = (
out["Domain"]
if "Domain" in out
else out["Workgroup"]
if "Workgroup" in out
else ""
)
# Notify the user if the requested workgroup is the same
if current_workgroup.upper() == name.upper():
ret["result"] = True
ret["comment"] = "Workgroup is already set to '{0}'".format(name.upper())
return ret
# If being run in test-mode, inform the user what is supposed to happen
if __opts__["test"]:
ret["result"] = None
ret["changes"] = {}
ret["comment"] = "Computer will be joined to workgroup '{0}'".format(name)
return ret
# Set our new workgroup, and then immediately ask the machine what it
# is again to validate the change
res = __salt__["system.set_domain_workgroup"](name.upper())
out = __salt__["system.get_domain_workgroup"]()
new_workgroup = (
out["Domain"]
if "Domain" in out
else out["Workgroup"]
if "Workgroup" in out
else ""
)
# Return our results based on the changes
ret = {}
if res and current_workgroup.upper() == new_workgroup.upper():
ret["result"] = True
ret["comment"] = "The new workgroup '{0}' is the same as '{1}'".format(
current_workgroup.upper(), new_workgroup.upper()
)
elif res:
ret["result"] = True
ret["comment"] = "The workgroup has been changed from '{0}' to '{1}'".format(
current_workgroup.upper(), new_workgroup.upper()
)
ret["changes"] = {
"old": current_workgroup.upper(),
"new": new_workgroup.upper(),
}
else:
ret["result"] = False
ret["comment"] = "Unable to join the requested workgroup '{0}'".format(
new_workgroup.upper()
)
return ret
def join_domain(
name,
username=None,

View file

@ -26,6 +26,7 @@ IPADDR{{loop.index}}="{{i['ipaddr']}}"
PREFIX{{loop.index}}="{{i['prefix']}}"
{% endfor -%}
{%endif%}{% if gateway %}GATEWAY="{{gateway}}"
{%endif%}{% if arpcheck %}ARPCHECK="{{arpcheck}}"
{%endif%}{% if enable_ipv6 %}IPV6INIT="yes"
{% if ipv6_autoconf %}IPV6_AUTOCONF="{{ipv6_autoconf}}"
{%endif%}{% if dhcpv6c %}DHCPV6C="{{dhcpv6c}}"

View file

@ -32,7 +32,7 @@ class CacheFactory(object):
@classmethod
def factory(cls, backend, ttl, *args, **kwargs):
log.info("Factory backend: %s", backend)
log.debug("Factory backend: %s", backend)
if backend == "memory":
return CacheDict(ttl, *args, **kwargs)
elif backend == "disk":

View file

@ -44,7 +44,7 @@ def store_job(opts, load, event=None, mminion=None):
nocache=load.get("nocache", False)
)
except KeyError:
emsg = "Returner '{0}' does not support function prep_jid".format(job_cache)
emsg = "Returner function not found: {0}".format(prep_fstr)
log.error(emsg)
raise KeyError(emsg)
@ -53,9 +53,7 @@ def store_job(opts, load, event=None, mminion=None):
try:
mminion.returners[saveload_fstr](load["jid"], load)
except KeyError:
emsg = "Returner '{0}' does not support function save_load".format(
job_cache
)
emsg = "Returner function not found: {0}".format(saveload_fstr)
log.error(emsg)
raise KeyError(emsg)
elif salt.utils.jid.is_jid(load["jid"]):

View file

@ -874,7 +874,7 @@ def ping_all_connected_minions(opts):
else:
tgt = "*"
form = "glob"
client.cmd(tgt, "test.ping", tgt_type=form)
client.cmd_async(tgt, "test.ping", tgt_type=form)
def get_master_key(key_user, opts, skip_perm_errors=False):

View file

@ -433,7 +433,19 @@ class ReactWrap(object):
# and kwargs['kwarg'] contain the positional and keyword arguments
# that will be passed to the client interface to execute the
# desired runner/wheel/remote-exec/etc. function.
l_fun(*args, **kwargs)
ret = l_fun(*args, **kwargs)
if ret is False:
log.error(
"Reactor '%s' failed to execute %s '%s': "
"TaskPool queue is full!"
"Consider tuning reactor_worker_threads and/or"
" reactor_worker_hwm",
low["__id__"],
low["state"],
low["fun"],
)
except SystemExit:
log.warning("Reactor '%s' attempted to exit. Ignored.", low["__id__"])
except Exception: # pylint: disable=broad-except
@ -449,13 +461,13 @@ class ReactWrap(object):
"""
Wrap RunnerClient for executing :ref:`runner modules <all-salt.runners>`
"""
self.pool.fire_async(self.client_cache["runner"].low, args=(fun, kwargs))
return self.pool.fire_async(self.client_cache["runner"].low, args=(fun, kwargs))
def wheel(self, fun, **kwargs):
"""
Wrap Wheel to enable executing :ref:`wheel modules <all-salt.wheel>`
"""
self.pool.fire_async(self.client_cache["wheel"].low, args=(fun, kwargs))
return self.pool.fire_async(self.client_cache["wheel"].low, args=(fun, kwargs))
def local(self, fun, tgt, **kwargs):
"""

View file

@ -109,6 +109,7 @@ salt/cli/salt.py:
salt/client/*:
- integration.client.test_kwarg
- integration.client.test_runner
- integration.client.test_saltcli
- integration.client.test_standard
salt/cloud/*:
@ -241,6 +242,16 @@ salt/utils/vt.py:
- integration.ssh.test_raw
- integration.ssh.test_state
salt/utils/vt.py:
- integration.cli.test_custom_module
- integration.cli.test_grains
- integration.ssh.test_grains
- integration.ssh.test_jinja_filters
- integration.ssh.test_mine
- integration.ssh.test_pillar
- integration.ssh.test_raw
- integration.ssh.test_state
salt/wheel/*:
- integration.wheel.test_client

View file

@ -7,6 +7,7 @@ from __future__ import absolute_import, print_function, unicode_literals
import pytest
import salt.utils.platform
from tests.support.case import ShellCase
from tests.support.unit import skipIf
@pytest.mark.windows_whitelisted
@ -20,6 +21,7 @@ class BatchTest(ShellCase):
else:
run_timeout = 30
@skipIf(True, "SLOWTEST skip")
def test_batch_run(self):
"""
Tests executing a simple batch command to help catch regressions
@ -30,6 +32,7 @@ class BatchTest(ShellCase):
)
self.assertIn(ret, cmd)
@skipIf(True, "SLOWTEST skip")
def test_batch_run_number(self):
"""
Tests executing a simple batch command using a number division instead of
@ -41,6 +44,7 @@ class BatchTest(ShellCase):
)
self.assertIn(ret, cmd)
@skipIf(True, "SLOWTEST skip")
def test_batch_run_grains_targeting(self):
"""
Tests executing a batch command using a percentage divisor as well as grains
@ -62,6 +66,7 @@ class BatchTest(ShellCase):
self.assertIn(sub_min_ret, cmd)
self.assertIn(min_ret, cmd)
@skipIf(True, "SLOWTEST skip")
def test_batch_exit_code(self):
"""
Test that a failed state returns a non-zero exit code in batch mode
@ -77,6 +82,7 @@ class BatchTest(ShellCase):
# assertRaises(StopIteration)
# But it's impossible due to nature of the tests execution via fork()
@skipIf(True, "SLOWTEST skip")
def test_batch_module_stopping_after_error(self):
"""
Test that a failed command stops the batch run
@ -105,6 +111,7 @@ class BatchTest(ShellCase):
# We expect retcode to be non-zero
self.assertNotEqual(0, retcode)
@skipIf(True, "SLOWTEST skip")
def test_batch_state_stopping_after_error(self):
"""
Test that a failed state stops the batch run

View file

@ -38,6 +38,7 @@ from __future__ import absolute_import, print_function, unicode_literals
import pytest
from tests.support.case import SSHCase
from tests.support.unit import skipIf
@pytest.mark.windows_whitelisted
@ -46,6 +47,7 @@ class SSHCustomModuleTest(SSHCase):
Test sls with custom module functionality using ssh
"""
@skipIf(True, "SLOWTEST skip")
def test_ssh_regular_module(self):
"""
Test regular module work using SSHCase environment
@ -54,6 +56,7 @@ class SSHCustomModuleTest(SSHCase):
cmd = self.run_function("test.echo", arg=["hello"])
self.assertEqual(expected, cmd)
@skipIf(True, "SLOWTEST skip")
def test_ssh_custom_module(self):
"""
Test custom module work using SSHCase environment
@ -62,6 +65,7 @@ class SSHCustomModuleTest(SSHCase):
cmd = self.run_function("test.recho", arg=["hello"])
self.assertEqual(expected, cmd)
@skipIf(True, "SLOWTEST skip")
def test_ssh_sls_with_custom_module(self):
"""
Test sls with custom module work using SSHCase environment

View file

@ -14,12 +14,16 @@
"""
from __future__ import absolute_import, print_function, unicode_literals
import logging
import os
import pytest
import salt.utils.files
from tests.support.case import ShellCase, SSHCase
from tests.support.helpers import flaky
from tests.support.unit import skipIf
log = logging.getLogger(__name__)
@pytest.mark.windows_whitelisted
@ -28,6 +32,7 @@ class GrainsTargetingTest(ShellCase):
Integration tests for targeting with grains.
"""
@skipIf(True, "SLOWTEST skip")
def test_grains_targeting_os_running(self):
"""
Tests running "salt -G 'os:<system-os>' test.ping and minions both return True
@ -42,6 +47,7 @@ class GrainsTargetingTest(ShellCase):
ret = self.run_salt('-G "os:{0}" test.ping'.format(os_grain))
self.assertEqual(sorted(ret), sorted(test_ret))
@skipIf(True, "SLOWTEST skip")
def test_grains_targeting_minion_id_running(self):
"""
Tests return of each running test minion targeting with minion id grain
@ -53,6 +59,7 @@ class GrainsTargetingTest(ShellCase):
self.assertEqual(sorted(sub_minion), sorted(["sub_minion:", " True"]))
@flaky
@skipIf(True, "SLOWTEST skip")
def test_grains_targeting_disconnected(self):
"""
Tests return of minion using grains targeting on a disconnected minion.
@ -65,21 +72,15 @@ class GrainsTargetingTest(ShellCase):
with salt.utils.files.fopen(key_file, "a"):
pass
import logging
log = logging.getLogger(__name__)
# ping disconnected minion and ensure it times out and returns with correct message
try:
if salt.utils.platform.is_windows():
cmd_str = '-t 1 -G "id:disconnected" test.ping'
else:
cmd_str = "-t 1 -G 'id:disconnected' test.ping"
ret = ""
for item in self.run_salt(
'-t 1 -G "id:disconnected" test.ping', timeout=40
):
if item != "disconnected:":
ret = item.strip()
break
assert ret == test_ret
finally:
os.unlink(key_file)
@ -92,6 +93,7 @@ class SSHGrainsTest(SSHCase):
Depend on proper environment set by SSHCase class
"""
@skipIf(True, "SLOWTEST skip")
def test_grains_id(self):
"""
Test salt-ssh grains id work for localhost.

View file

@ -6,6 +6,7 @@ import pytest
import salt.utils.platform
from salt.ext import six
from tests.support.case import ModuleCase
from tests.support.unit import skipIf
@pytest.mark.windows_whitelisted
@ -17,6 +18,7 @@ class StdTest(ModuleCase):
def setUp(self):
self.TIMEOUT = 600 if salt.utils.platform.is_windows() else 10
@skipIf(True, "SLOWTEST skip")
def test_cli(self):
"""
Test cli function
@ -29,6 +31,7 @@ class StdTest(ModuleCase):
self.assertEqual(data["args"], ["foo", "bar", "baz"])
self.assertEqual(data["kwargs"]["qux"], "quux")
@skipIf(True, "SLOWTEST skip")
def test_iter(self):
"""
test cmd_iter
@ -41,6 +44,7 @@ class StdTest(ModuleCase):
self.assertEqual(data["args"], ["foo", "bar", "baz"])
self.assertEqual(data["kwargs"]["qux"], "quux")
@skipIf(True, "SLOWTEST skip")
def test_iter_no_block(self):
"""
test cmd_iter_no_block
@ -55,6 +59,7 @@ class StdTest(ModuleCase):
self.assertEqual(data["args"], ["foo", "bar", "baz"])
self.assertEqual(data["kwargs"]["qux"], "quux")
@skipIf(True, "SLOWTEST skip")
def test_full_returns(self):
"""
test cmd_iter
@ -70,6 +75,7 @@ class StdTest(ModuleCase):
self.assertEqual(data["args"], ["foo", "bar", "baz"])
self.assertEqual(data["kwargs"]["qux"], "quux")
@skipIf(True, "SLOWTEST skip")
def test_kwarg_type(self):
"""
Test that kwargs end up on the client as the same type
@ -88,6 +94,7 @@ class StdTest(ModuleCase):
self.assertIn("dict", data["kwargs"]["outer"])
self.assertIn(six.text_type.__name__, data["kwargs"]["inner"])
@skipIf(True, "SLOWTEST skip")
def test_full_return_kwarg(self):
ret = self.client.cmd(
"minion", "test.ping", full_return=True, timeout=self.TIMEOUT,
@ -95,6 +102,7 @@ class StdTest(ModuleCase):
for mid, data in ret.items():
self.assertIn("retcode", data)
@skipIf(True, "SLOWTEST skip")
def test_cmd_arg_kwarg_parsing(self):
ret = self.client.cmd(
"minion",

View file

@ -5,7 +5,7 @@ from __future__ import absolute_import, print_function, unicode_literals
import pytest
import salt.runner
from tests.support.mixins import AdaptedConfigurationTestCaseMixin
from tests.support.unit import TestCase
from tests.support.unit import TestCase, skipIf
@pytest.mark.windows_whitelisted
@ -23,6 +23,7 @@ class RunnerModuleTest(TestCase, AdaptedConfigurationTestCaseMixin):
"""
self.runner = salt.runner.RunnerClient(self.get_config("client_config"))
@skipIf(True, "SLOWTEST skip")
def test_eauth(self):
"""
Test executing master_call with lowdata
@ -38,6 +39,7 @@ class RunnerModuleTest(TestCase, AdaptedConfigurationTestCaseMixin):
self.runner.master_call(**low)
@skipIf(True, "SLOWTEST skip")
def test_token(self):
"""
Test executing master_call with lowdata
@ -54,6 +56,7 @@ class RunnerModuleTest(TestCase, AdaptedConfigurationTestCaseMixin):
**{"client": "runner", "fun": "error.error", "token": token["token"]}
)
@skipIf(True, "SLOWTEST skip")
def test_cmd_sync(self):
low = {
"client": "runner",
@ -63,6 +66,7 @@ class RunnerModuleTest(TestCase, AdaptedConfigurationTestCaseMixin):
self.runner.cmd_sync(low)
@skipIf(True, "SLOWTEST skip")
def test_cmd_async(self):
low = {
"client": "runner",
@ -72,6 +76,7 @@ class RunnerModuleTest(TestCase, AdaptedConfigurationTestCaseMixin):
self.runner.cmd_async(low)
@skipIf(True, "SLOWTEST skip")
def test_cmd_sync_w_arg(self):
low = {
"fun": "test.arg",
@ -84,6 +89,7 @@ class RunnerModuleTest(TestCase, AdaptedConfigurationTestCaseMixin):
self.assertEqual(ret["kwargs"]["foo"], "Foo!")
self.assertEqual(ret["kwargs"]["bar"], "Bar!")
@skipIf(True, "SLOWTEST skip")
def test_wildcard_auth(self):
low = {
"username": "the_s0und_of_t3ch",
@ -95,12 +101,14 @@ class RunnerModuleTest(TestCase, AdaptedConfigurationTestCaseMixin):
}
self.runner.cmd_sync(low)
@skipIf(True, "SLOWTEST skip")
def test_full_return_kwarg(self):
low = {"fun": "test.arg"}
low.update(self.eauth_creds)
ret = self.runner.cmd_sync(low, full_return=True)
self.assertIn("success", ret["data"])
@skipIf(True, "SLOWTEST skip")
def test_cmd_sync_arg_kwarg_parsing(self):
low = {
"client": "runner",
@ -125,6 +133,7 @@ class RunnerModuleTest(TestCase, AdaptedConfigurationTestCaseMixin):
},
)
@skipIf(True, "SLOWTEST skip")
def test_invalid_kwargs_are_ignored(self):
low = {
"client": "runner",

View file

@ -8,6 +8,7 @@ import pytest
import salt.utils.files
import salt.utils.platform
from tests.support.case import ModuleCase
from tests.support.unit import skipIf
@pytest.mark.windows_whitelisted
@ -19,6 +20,7 @@ class StdTest(ModuleCase):
def setUp(self):
self.TIMEOUT = 600 if salt.utils.platform.is_windows() else 10
@skipIf(True, "SLOWTEST skip")
def test_cli(self):
"""
Test cli function
@ -52,6 +54,7 @@ class StdTest(ModuleCase):
finally:
os.unlink(key_file)
@skipIf(True, "SLOWTEST skip")
def test_iter(self):
"""
test cmd_iter
@ -60,6 +63,7 @@ class StdTest(ModuleCase):
for ret in cmd_iter:
self.assertTrue(ret["minion"])
@skipIf(True, "SLOWTEST skip")
def test_iter_no_block(self):
"""
test cmd_iter_no_block
@ -70,6 +74,7 @@ class StdTest(ModuleCase):
continue
self.assertTrue(ret["minion"])
@skipIf(True, "SLOWTEST skip")
def test_batch(self):
"""
test cmd_batch
@ -78,6 +83,7 @@ class StdTest(ModuleCase):
for ret in cmd_batch:
self.assertTrue(ret["minion"])
@skipIf(True, "SLOWTEST skip")
def test_batch_raw(self):
"""
test cmd_batch with raw option
@ -86,6 +92,7 @@ class StdTest(ModuleCase):
for ret in cmd_batch:
self.assertTrue(ret["data"]["success"])
@skipIf(True, "SLOWTEST skip")
def test_full_returns(self):
"""
test cmd_iter
@ -94,11 +101,13 @@ class StdTest(ModuleCase):
self.assertIn("minion", ret)
self.assertEqual({"ret": True, "success": True}, ret["minion"])
@skipIf(True, "SLOWTEST skip")
def test_disconnected_return(self):
"""
Test return/messaging on a disconnected minion
"""
test_ret = {"ret": "Minion did not return. [No response]", "out": "no_return"}
test_ret = "Minion did not return. [No response]"
test_out = "no_return"
# Create a minion key, but do not start the "fake" minion. This mimics
# a disconnected minion.
@ -114,8 +123,12 @@ class StdTest(ModuleCase):
num_ret = 0
for ret in cmd_iter:
num_ret += 1
self.assertEqual(ret["disconnected"]["ret"], test_ret["ret"])
self.assertEqual(ret["disconnected"]["out"], test_ret["out"])
assert ret["disconnected"]["ret"].startswith(test_ret), ret[
"disconnected"
]["ret"]
assert ret["disconnected"]["out"] == test_out, ret["disconnected"][
"out"
]
# Ensure that we entered the loop above
self.assertEqual(num_ret, 1)
@ -123,24 +136,28 @@ class StdTest(ModuleCase):
finally:
os.unlink(key_file)
@skipIf(True, "SLOWTEST skip")
def test_missing_minion_list(self):
"""
test cmd with missing minion in nodegroup
"""
ret = self.client.cmd(
"minion,ghostminion", "test.ping", tgt_type="list", timeout=self.TIMEOUT
)
self.assertIn("minion", ret)
self.assertIn("ghostminion", ret)
self.assertEqual(True, ret["minion"])
self.assertEqual("Minion did not return. [No response]", ret["ghostminion"])
ret = self.client.cmd("minion,ghostminion", "test.ping", tgt_type="list")
assert "minion" in ret
assert "ghostminion" in ret
assert ret["minion"] is True
assert ret["ghostminion"].startswith(
"Minion did not return. [No response]"
), ret["ghostminion"]
@skipIf(True, "SLOWTEST skip")
def test_missing_minion_nodegroup(self):
"""
test cmd with missing minion in nodegroup
"""
ret = self.client.cmd("missing_minion", "test.ping", tgt_type="nodegroup")
self.assertIn("minion", ret)
self.assertIn("ghostminion", ret)
self.assertEqual(True, ret["minion"])
self.assertEqual("Minion did not return. [No response]", ret["ghostminion"])
assert "minion" in ret
assert "ghostminion" in ret
assert ret["minion"] is True
assert ret["ghostminion"].startswith(
"Minion did not return. [No response]"
), ret["ghostminion"]

View file

@ -4,6 +4,7 @@ from __future__ import absolute_import, print_function, unicode_literals
import pytest
from tests.support.case import SyndicCase
from tests.support.unit import skipIf
@pytest.mark.windows_whitelisted
@ -12,12 +13,14 @@ class TestSyndic(SyndicCase):
Validate the syndic interface by testing the test module
"""
@skipIf(True, "SLOWTEST skip")
def test_ping(self):
"""
test.ping
"""
self.assertTrue(self.run_function("test.ping"))
@skipIf(True, "SLOWTEST skip")
def test_fib(self):
"""
test.fib

View file

@ -37,7 +37,7 @@ class DigitalOceanTest(CloudTest):
Tests the return of running the --list-images command for digitalocean
"""
image_list = self.run_cloud("--list-images {0}".format(self.PROVIDER))
self.assertIn("14.04.5 x64", [i.strip() for i in image_list])
self.assertIn("ubuntu-18-04-x64", [i.strip() for i in image_list])
def test_list_locations(self):
"""

View file

@ -14,6 +14,7 @@ from tests.support.case import ShellCase
# Import Salt Testing libs
from tests.support.runtests import RUNTIME_VARS
from tests.support.unit import skipIf
# Import 3rd-party libs
@ -70,6 +71,7 @@ class AutosignGrainsTest(ShellCase):
except AttributeError:
pass
@skipIf(True, "SLOWTEST skip")
def test_autosign_grains_accept(self):
grain_file_path = os.path.join(self.autosign_grains_dir, "test_grain")
with salt.utils.files.fopen(grain_file_path, "w") as f:
@ -81,6 +83,7 @@ class AutosignGrainsTest(ShellCase):
) # get minon to try to authenticate itself again
self.assertIn("minion", self.run_key("-l acc"))
@skipIf(True, "SLOWTEST skip")
def test_autosign_grains_fail(self):
grain_file_path = os.path.join(self.autosign_grains_dir, "test_grain")
with salt.utils.files.fopen(grain_file_path, "w") as f:

View file

@ -76,6 +76,7 @@ class ManTest(ModuleCase):
)
)
@skipIf(True, "SLOWTEST skip")
def test_man(self):
"""
Make sure that man pages are installed

View file

@ -19,6 +19,7 @@ from salt.ext.six.moves import range
# Import Salt Testing libs
from tests.support.case import ShellCase
from tests.support.unit import skipIf
def _random_name(prefix=""):
@ -47,6 +48,7 @@ class VenafiTest(ShellCase):
"""
@with_random_name
@skipIf(True, "SLOWTEST skip")
def test_request(self, name):
cn = "{0}.example.com".format(name)
@ -88,6 +90,7 @@ class VenafiTest(ShellCase):
assert pkey_public_key_pem == cert_public_key_pem
@with_random_name
@skipIf(True, "SLOWTEST skip")
def test_sign(self, name):
csr_pem = """-----BEGIN CERTIFICATE REQUEST-----

View file

@ -1,5 +1,5 @@
digitalocean-test:
provider: digitalocean-config
image: 14.04.5 x64
image: ubuntu-18-04-x64
size: 2GB
script_args: '-P'

View file

@ -62,6 +62,7 @@ class TestGrainsReg(ModuleCase, LoaderModuleMockMixin):
return {salt.modules.reg: {"__opts__": opts, "__utils__": utils}}
@skipIf(not salt.utils.platform.is_windows(), "Only run on Windows")
@skipIf(True, "SLOWTEST skip")
def test_win_cpu_model(self):
"""
test grains['cpu_model']

View file

@ -7,6 +7,7 @@ from __future__ import absolute_import, unicode_literals
import pytest
from tests.support.case import ModuleCase
from tests.support.unit import skipIf
@pytest.mark.windows_whitelisted
@ -15,6 +16,7 @@ class TestGrainsCore(ModuleCase):
Test the core grains grains
"""
@skipIf(True, "SLOWTEST skip")
def test_grains_passed_to_custom_grain(self):
"""
test if current grains are passed to grains module functions that have a grains argument

View file

@ -30,6 +30,7 @@ class LoaderGrainsTest(ModuleCase):
# self.opts['disable_modules'] = ['pillar']
# self.opts['grains'] = grains(self.opts)
@skipIf(True, "SLOWTEST skip")
def test_grains_overwrite(self):
# Force a grains sync
self.run_function("saltutil.sync_grains")

View file

@ -17,6 +17,7 @@ import time
import pytest
from tests.support.case import ModuleCase
from tests.support.runtests import RUNTIME_VARS
from tests.support.unit import skipIf
@pytest.mark.windows_whitelisted
@ -24,6 +25,7 @@ class LoaderOverridesTest(ModuleCase):
def setUp(self):
self.run_function("saltutil.sync_modules")
@skipIf(True, "SLOWTEST skip")
def test_overridden_internal(self):
# To avoid a race condition on Windows, we need to make sure the
# `override_test.py` file is present in the _modules directory before

View file

@ -10,7 +10,7 @@ import salt.utils.stringutils
import zmq
from salt.log.handlers.logstash_mod import DatagramLogstashHandler, ZMQLogstashHander
from tests.support.helpers import get_unused_localhost_port
from tests.support.unit import TestCase
from tests.support.unit import TestCase, skipIf
log = logging.getLogger(__name__)
@ -30,6 +30,7 @@ class DatagramLogstashHandlerTest(TestCase):
def tearDown(self):
self.test_server.close()
@skipIf(True, "SLOWTEST skip")
def test_log_pickling(self):
# given
the_log = "test message"
@ -67,6 +68,7 @@ class ZMQLogstashHanderTest(TestCase):
self.zmq_server.close()
self.context.term()
@skipIf(True, "SLOWTEST skip")
def test_log_pickling(self):
# given
the_log = "test message"

View file

@ -14,6 +14,7 @@ import pytest
import salt.utils.files
from tests.support.case import ModuleCase
from tests.support.runtests import RUNTIME_VARS
from tests.support.unit import skipIf
log = logging.getLogger(__name__)
@ -120,6 +121,7 @@ class MinionBlackoutTestCase(ModuleCase):
self.wait_for_all_jobs()
log.info("Exited minion blackout.")
@skipIf(True, "SLOWTEST skip")
def test_blackout(self):
"""
Test that basic minion blackout functionality works
@ -134,6 +136,7 @@ class MinionBlackoutTestCase(ModuleCase):
ret = self.run_function("test.ping")
self.assertEqual(ret, True)
@skipIf(True, "SLOWTEST skip")
def test_blackout_whitelist(self):
"""
Test that minion blackout whitelist works
@ -156,6 +159,7 @@ class MinionBlackoutTestCase(ModuleCase):
self.assertTrue(isinstance(fib_ret, list))
self.assertEqual(fib_ret[0], 13)
@skipIf(True, "SLOWTEST skip")
def test_blackout_nonwhitelist(self):
"""
Test that minion refuses to run non-whitelisted functions during

View file

@ -7,6 +7,7 @@ import logging
# Import Salt Testing libs
from tests.support.case import ModuleCase, ShellCase
from tests.support.unit import skipIf
log = logging.getLogger(__name__)
@ -15,6 +16,7 @@ class ExecutorTest(ModuleCase, ShellCase):
def setup(self):
self.run_function("saltutil.sync_all")
@skipIf(True, "SLOWTEST skip")
def test_executor(self):
"""
test that dunders are set

View file

@ -399,6 +399,7 @@ class DecryptGPGPillarTest(_CommonBase):
self.assertEqual(ret, GPG_PILLAR_DECRYPTED)
@requires_system_grains
@skipIf(True, "SLOWTEST skip")
def test_decrypt_pillar_alternate_delimiter(self, grains=None):
"""
Test recursive decryption of secrets:vault using a pipe instead of a
@ -593,6 +594,7 @@ class RefreshPillarTest(ModuleCase):
)
self.addCleanup(self.cleanup_pillars, top_path, pillar_path)
@skipIf(True, "SLOWTEST skip")
def test_pillar_refresh_pillar_raw(self):
"""
Validate the minion's pillar.raw call behavior for new pillars
@ -616,6 +618,7 @@ class RefreshPillarTest(ModuleCase):
val = self.run_function("pillar.raw", arg=(key,))
assert val is True, repr(val)
@skipIf(True, "SLOWTEST skip")
def test_pillar_refresh_pillar_get(self):
"""
Validate the minion's pillar.get call behavior for new pillars
@ -643,6 +646,7 @@ class RefreshPillarTest(ModuleCase):
val = self.run_function("pillar.get", arg=(key,))
assert val is True, repr(val)
@skipIf(True, "SLOWTEST skip")
def test_pillar_refresh_pillar_item(self):
"""
Validate the minion's pillar.item call behavior for new pillars
@ -671,6 +675,7 @@ class RefreshPillarTest(ModuleCase):
assert key in val
assert val[key] is True
@skipIf(True, "SLOWTEST skip")
def test_pillar_refresh_pillar_items(self):
"""
Validate the minion's pillar.item call behavior for new pillars
@ -689,6 +694,7 @@ class RefreshPillarTest(ModuleCase):
assert key in val
assert val[key] is True
@skipIf(True, "SLOWTEST skip")
def test_pillar_refresh_pillar_ping(self):
"""
Validate the minion's test.ping does not update pillars

View file

@ -11,6 +11,7 @@ import sys
import pytest
import salt.utils.platform
from tests.support.case import ShellCase
from tests.support.unit import skipIf
@pytest.mark.windows_whitelisted
@ -19,6 +20,7 @@ class MinionTimeoutTestCase(ShellCase):
Test minion timing functions
"""
@skipIf(True, "SLOWTEST skip")
def test_long_running_job(self):
"""
Test that we will wait longer than the job timeout for a minion to

View file

@ -4,6 +4,7 @@ from __future__ import absolute_import, print_function, unicode_literals
import pytest
from tests.support.case import ModuleCase
from tests.support.unit import skipIf
@pytest.mark.windows_whitelisted
@ -12,6 +13,7 @@ class AliasesTest(ModuleCase):
Validate aliases module
"""
@skipIf(True, "SLOWTEST skip")
def test_set_target(self):
"""
aliases.set_target and aliases.get_target
@ -21,6 +23,7 @@ class AliasesTest(ModuleCase):
tgt_ret = self.run_function("aliases.get_target", alias="fred")
self.assertEqual(tgt_ret, "bob")
@skipIf(True, "SLOWTEST skip")
def test_has_target(self):
"""
aliases.set_target and aliases.has_target
@ -30,6 +33,7 @@ class AliasesTest(ModuleCase):
tgt_ret = self.run_function("aliases.has_target", alias="fred", target="bob")
self.assertTrue(tgt_ret)
@skipIf(True, "SLOWTEST skip")
def test_list_aliases(self):
"""
aliases.list_aliases
@ -40,6 +44,7 @@ class AliasesTest(ModuleCase):
self.assertIsInstance(tgt_ret, dict)
self.assertIn("fred", tgt_ret)
@skipIf(True, "SLOWTEST skip")
def test_rm_alias(self):
"""
aliases.rm_alias

View file

@ -158,6 +158,7 @@ class ArchiveTest(ModuleCase):
self.assertTrue(file_in_ret)
@skipIf(not salt.utils.path.which("tar"), "Cannot find tar executable")
@skipIf(True, "SLOWTEST skip")
def test_tar_pack(self):
"""
Validate using the tar function to create archives
@ -172,6 +173,7 @@ class ArchiveTest(ModuleCase):
self._tear_down()
@skipIf(not salt.utils.path.which("tar"), "Cannot find tar executable")
@skipIf(True, "SLOWTEST skip")
def test_tar_unpack(self):
"""
Validate using the tar function to extract archives
@ -187,6 +189,7 @@ class ArchiveTest(ModuleCase):
self._tear_down()
@skipIf(not salt.utils.path.which("tar"), "Cannot find tar executable")
@skipIf(True, "SLOWTEST skip")
def test_tar_pack_unicode(self):
"""
Validate using the tar function to create archives
@ -201,6 +204,7 @@ class ArchiveTest(ModuleCase):
self._tear_down()
@skipIf(not salt.utils.path.which("tar"), "Cannot find tar executable")
@skipIf(True, "SLOWTEST skip")
def test_tar_unpack_unicode(self):
"""
Validate using the tar function to extract archives
@ -216,6 +220,7 @@ class ArchiveTest(ModuleCase):
self._tear_down()
@skipIf(not salt.utils.path.which("tar"), "Cannot find tar executable")
@skipIf(True, "SLOWTEST skip")
def test_tar_list_unicode(self):
"""
Validate using the tar function to extract archives
@ -291,6 +296,7 @@ class ArchiveTest(ModuleCase):
self._tear_down()
@skipIf(not HAS_ZIPFILE, "Cannot find zipfile python module")
@skipIf(True, "SLOWTEST skip")
def test_zip(self):
"""
Validate using the zip function
@ -305,6 +311,7 @@ class ArchiveTest(ModuleCase):
self._tear_down()
@skipIf(not HAS_ZIPFILE, "Cannot find zipfile python module")
@skipIf(True, "SLOWTEST skip")
def test_unzip(self):
"""
Validate using the unzip function

View file

@ -30,6 +30,7 @@ class BeaconsAddDeleteTest(ModuleCase):
self.beacons_config_file_path = os.path.join(
self.minion_conf_d_dir, "beacons.conf"
)
self.run_function("beacons.reset", f_timeout=300)
def tearDown(self):
if os.path.isfile(self.beacons_config_file_path):
@ -38,6 +39,7 @@ class BeaconsAddDeleteTest(ModuleCase):
# Reset beacons
self.run_function("beacons.reset", f_timeout=300)
@skipIf(True, "SLOWTEST skip")
def test_add_and_delete(self):
"""
Test adding and deleting a beacon
@ -60,6 +62,7 @@ class BeaconsAddDeleteTest(ModuleCase):
# save the results
self.run_function("beacons.save", f_timeout=300)
@skipIf(True, "SLOWTEST skip")
def test_add_and_delete_beacon_module(self):
"""
Test adding and deleting a beacon
@ -111,6 +114,7 @@ class BeaconsTest(ModuleCase):
self.__class__.beacons_config_file_path = os.path.join(
self.minion_conf_d_dir, "beacons.conf"
)
self.run_function("beacons.reset", f_timeout=300)
try:
# Add beacon to disable
self.run_function(
@ -130,6 +134,8 @@ class BeaconsTest(ModuleCase):
# Reset beacons
self.run_function("beacons.reset", f_timeout=300)
@skipIf(True, "SLOWTEST skip")
@skipIf(True, "SLOWTEST skip")
def test_disable(self):
"""
Test disabling beacons
@ -156,6 +162,8 @@ class BeaconsTest(ModuleCase):
self.assertFalse(bdict["enabled"])
break
@skipIf(True, "SLOWTEST skip")
@skipIf(True, "SLOWTEST skip")
def test_enable(self):
"""
Test enabling beacons
@ -189,6 +197,8 @@ class BeaconsTest(ModuleCase):
_list = self.run_function("beacons.list", return_yaml=False, f_timeout=300)
self.assertTrue(_list["ps"]["enabled"])
@skipIf(True, "SLOWTEST skip")
@skipIf(True, "SLOWTEST skip")
def test_list(self):
"""
Test listing the beacons
@ -202,6 +212,7 @@ class BeaconsTest(ModuleCase):
else:
self.assertEqual(ret, {"ps": [{"processes": {"apache2": "stopped"}}]})
@skipIf(True, "SLOWTEST skip")
def test_list_available(self):
"""
Test listing the beacons
@ -238,6 +249,7 @@ class BeaconsWithBeaconTypeTest(ModuleCase):
self.__class__.beacons_config_file_path = os.path.join(
self.minion_conf_d_dir, "beacons.conf"
)
self.run_function("beacons.reset", f_timeout=300)
try:
# Add beacon to disable
self.run_function(
@ -256,10 +268,14 @@ class BeaconsWithBeaconTypeTest(ModuleCase):
self.run_function("beacons.delete", ["watch_apache"])
self.run_function("beacons.save")
@skipIf(True, "SLOWTEST skip")
@skipIf(True, "SLOWTEST skip")
def test_disable(self):
"""
Test disabling beacons
"""
ret = self.run_function("beacons.enable", f_timeout=300)
self.assertTrue(ret["result"])
# assert beacon exists
_list = self.run_function("beacons.list", return_yaml=False)
self.assertIn("watch_apache", _list)
@ -282,6 +298,8 @@ class BeaconsWithBeaconTypeTest(ModuleCase):
self.assertFalse(bdict["enabled"])
break
@skipIf(True, "SLOWTEST skip")
@skipIf(True, "SLOWTEST skip")
def test_enable(self):
"""
Test enabling beacons
@ -314,6 +332,8 @@ class BeaconsWithBeaconTypeTest(ModuleCase):
_list = self.run_function("beacons.list", return_yaml=False)
self.assertTrue(_list["watch_apache"]["enabled"])
@skipIf(True, "SLOWTEST skip")
@skipIf(True, "SLOWTEST skip")
def test_list(self):
"""
Test lising the beacons

View file

@ -50,6 +50,7 @@ class CMDModuleTest(ModuleCase):
finally:
self.run_function("user.delete", [name], remove=True)
@skipIf(True, "SLOWTEST skip")
def test_run(self):
"""
cmd.run
@ -91,6 +92,7 @@ class CMDModuleTest(ModuleCase):
"a:b",
)
@skipIf(True, "SLOWTEST skip")
def test_stdout(self):
"""
cmd.run_stdout
@ -100,6 +102,7 @@ class CMDModuleTest(ModuleCase):
"cheese" if not salt.utils.platform.is_windows() else '"cheese"',
)
@skipIf(True, "SLOWTEST skip")
def test_stderr(self):
"""
cmd.run_stderr
@ -118,6 +121,7 @@ class CMDModuleTest(ModuleCase):
"cheese" if not salt.utils.platform.is_windows() else '"cheese"',
)
@skipIf(True, "SLOWTEST skip")
def test_run_all(self):
"""
cmd.run_all
@ -145,6 +149,7 @@ class CMDModuleTest(ModuleCase):
"cheese" if not salt.utils.platform.is_windows() else '"cheese"',
)
@skipIf(True, "SLOWTEST skip")
def test_retcode(self):
"""
cmd.retcode
@ -156,6 +161,7 @@ class CMDModuleTest(ModuleCase):
self.run_function("cmd.retcode", ["exit 1"], python_shell=True), 1
)
@skipIf(True, "SLOWTEST skip")
def test_run_all_with_success_retcodes(self):
"""
cmd.run with success_retcodes
@ -167,6 +173,7 @@ class CMDModuleTest(ModuleCase):
self.assertTrue("retcode" in ret)
self.assertEqual(ret.get("retcode"), 0)
@skipIf(True, "SLOWTEST skip")
def test_retcode_with_success_retcodes(self):
"""
cmd.run with success_retcodes
@ -177,6 +184,7 @@ class CMDModuleTest(ModuleCase):
self.assertEqual(ret, 0)
@skipIf(True, "SLOWTEST skip")
def test_blacklist_glob(self):
"""
cmd_blacklist_glob
@ -186,6 +194,7 @@ class CMDModuleTest(ModuleCase):
'ERROR: The shell command "bad_command --foo" is not permitted',
)
@skipIf(True, "SLOWTEST skip")
def test_script(self):
"""
cmd.script
@ -195,6 +204,7 @@ class CMDModuleTest(ModuleCase):
ret = self.run_function("cmd.script", [script, args])
self.assertEqual(ret["stdout"], args)
@skipIf(True, "SLOWTEST skip")
def test_script_retcode(self):
"""
cmd.script_retcode
@ -203,6 +213,7 @@ class CMDModuleTest(ModuleCase):
ret = self.run_function("cmd.script_retcode", [script])
self.assertEqual(ret, 0)
@skipIf(True, "SLOWTEST skip")
def test_script_cwd(self):
"""
cmd.script with cwd
@ -213,6 +224,7 @@ class CMDModuleTest(ModuleCase):
ret = self.run_function("cmd.script", [script, args], cwd=tmp_cwd)
self.assertEqual(ret["stdout"], args)
@skipIf(True, "SLOWTEST skip")
def test_script_cwd_with_space(self):
"""
cmd.script with cwd
@ -256,6 +268,7 @@ class CMDModuleTest(ModuleCase):
ret = self.run_function("cmd.which_bin", [cmds])
self.assertTrue(os.path.split(ret)[1] in cmds)
@skipIf(True, "SLOWTEST skip")
def test_has_exec(self):
"""
cmd.has_exec
@ -267,6 +280,7 @@ class CMDModuleTest(ModuleCase):
self.run_function("cmd.has_exec", ["alllfsdfnwieulrrh9123857ygf"])
)
@skipIf(True, "SLOWTEST skip")
def test_exec_code(self):
"""
cmd.exec_code
@ -283,6 +297,7 @@ class CMDModuleTest(ModuleCase):
"cheese",
)
@skipIf(True, "SLOWTEST skip")
def test_exec_code_with_single_arg(self):
"""
cmd.exec_code
@ -300,6 +315,7 @@ class CMDModuleTest(ModuleCase):
arg,
)
@skipIf(True, "SLOWTEST skip")
def test_exec_code_with_multiple_args(self):
"""
cmd.exec_code
@ -317,6 +333,7 @@ class CMDModuleTest(ModuleCase):
arg,
)
@skipIf(True, "SLOWTEST skip")
def test_quotes(self):
"""
cmd.run with quoted command
@ -346,6 +363,7 @@ class CMDModuleTest(ModuleCase):
@destructiveTest
@skip_if_not_root
@skipIf(salt.utils.platform.is_windows(), "skip windows, uses unix commands")
@skipIf(True, "SLOWTEST skip")
def test_avoid_injecting_shell_code_as_root(self):
"""
cmd.run should execute the whole command as the "runas" user, not
@ -367,6 +385,7 @@ class CMDModuleTest(ModuleCase):
@destructiveTest
@skip_if_not_root
@skipIf(salt.utils.platform.is_windows(), "skip windows, uses unix commands")
@skipIf(True, "SLOWTEST skip")
def test_cwd_runas(self):
"""
cmd.run should be able to change working directory correctly, whether
@ -390,6 +409,7 @@ class CMDModuleTest(ModuleCase):
@destructiveTest
@skip_if_not_root
@skipIf(not salt.utils.platform.is_darwin(), "applicable to MacOS only")
@skipIf(True, "SLOWTEST skip")
def test_runas_env(self):
"""
cmd.run should be able to change working directory correctly, whether
@ -407,6 +427,7 @@ class CMDModuleTest(ModuleCase):
@destructiveTest
@skip_if_not_root
@skipIf(not salt.utils.platform.is_darwin(), "applicable to MacOS only")
@skipIf(True, "SLOWTEST skip")
def test_runas_complex_command_bad_cwd(self):
"""
cmd.run should not accidentally run parts of a complex command when
@ -436,6 +457,7 @@ class CMDModuleTest(ModuleCase):
@skipIf(salt.utils.platform.is_windows(), "minion is windows")
@skip_if_not_root
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_runas(self):
"""
Ensure that the env is the runas user's
@ -466,6 +488,7 @@ class CMDModuleTest(ModuleCase):
)
self.assertEqual(out, "hello")
@skipIf(True, "SLOWTEST skip")
def test_hide_output(self):
"""
Test the hide_output argument
@ -502,6 +525,7 @@ class CMDModuleTest(ModuleCase):
self.assertEqual(out["stdout"], "")
self.assertEqual(out["stderr"], "")
@skipIf(True, "SLOWTEST skip")
def test_cmd_run_whoami(self):
"""
test return of whoami
@ -513,6 +537,7 @@ class CMDModuleTest(ModuleCase):
self.assertEqual("root", cmd)
@skipIf(not salt.utils.platform.is_windows(), "minion is not windows")
@skipIf(True, "SLOWTEST skip")
def test_windows_env_handling(self):
"""
Ensure that nt.environ is used properly with cmd.run*
@ -524,6 +549,7 @@ class CMDModuleTest(ModuleCase):
self.assertIn("ABC=456", out)
@skipIf(not salt.utils.platform.is_windows(), "minion is not windows")
@skipIf(True, "SLOWTEST skip")
def test_windows_powershell_script_args(self):
"""
Ensure that powershell processes inline script in args

View file

@ -7,6 +7,7 @@ from __future__ import absolute_import
import pytest
from tests.support.case import ModuleCase
from tests.support.unit import skipIf
@pytest.mark.windows_whitelisted
@ -15,6 +16,7 @@ class ConfigTest(ModuleCase):
Test config routines
"""
@skipIf(True, "SLOWTEST skip")
def test_valid_file_proto(self):
"""
test config.valid_file_proto
@ -28,12 +30,14 @@ class ConfigTest(ModuleCase):
self.assertTrue(self.run_function("config.valid_fileproto", ["swift://"]))
self.assertFalse(self.run_function("config.valid_fileproto", ["cheese://"]))
@skipIf(True, "SLOWTEST skip")
def test_backup_mode(self):
"""
test config.backup_mode
"""
self.assertEqual(self.run_function("config.backup_mode", ["minion"]), "minion")
@skipIf(True, "SLOWTEST skip")
def test_manage_mode(self):
"""
test config.manage_mode
@ -50,6 +54,7 @@ class ConfigTest(ModuleCase):
self.assertEqual(self.run_function("config.manage_mode", ["1775"]), "1775")
self.assertEqual(self.run_function("config.manage_mode", ["0"]), "0000")
@skipIf(True, "SLOWTEST skip")
def test_option(self):
"""
test config.option
@ -62,6 +67,7 @@ class ConfigTest(ModuleCase):
# pillar conf opt
self.assertEqual(self.run_function("config.option", ["ext_spam"]), "eggs")
@skipIf(True, "SLOWTEST skip")
def test_get(self):
"""
Test option.get

View file

@ -48,6 +48,7 @@ class CPModuleTest(ModuleCase):
)
@with_tempfile()
@skipIf(True, "SLOWTEST skip")
def test_get_file(self, tgt):
"""
cp.get_file
@ -58,6 +59,7 @@ class CPModuleTest(ModuleCase):
self.assertIn("KNIGHT: They're nervous, sire.", data)
self.assertNotIn("bacon", data)
@skipIf(True, "SLOWTEST skip")
def test_get_file_to_dir(self):
"""
cp.get_file
@ -92,6 +94,7 @@ class CPModuleTest(ModuleCase):
self.assertNotIn("bacon", data)
@with_tempfile()
@skipIf(True, "SLOWTEST skip")
def test_get_file_gzipped(self, tgt):
"""
cp.get_file
@ -108,6 +111,7 @@ class CPModuleTest(ModuleCase):
self.assertIn("KNIGHT: They're nervous, sire.", data)
self.assertNotIn("bacon", data)
@skipIf(True, "SLOWTEST skip")
def test_get_file_makedirs(self):
"""
cp.get_file
@ -123,6 +127,7 @@ class CPModuleTest(ModuleCase):
self.assertNotIn("bacon", data)
@with_tempfile()
@skipIf(True, "SLOWTEST skip")
def test_get_template(self, tgt):
"""
cp.get_template
@ -135,6 +140,7 @@ class CPModuleTest(ModuleCase):
self.assertIn("bacon", data)
self.assertNotIn("spam", data)
@skipIf(True, "SLOWTEST skip")
def test_get_dir(self):
"""
cp.get_dir
@ -146,6 +152,7 @@ class CPModuleTest(ModuleCase):
self.assertIn("empty", os.listdir(os.path.join(tgt, "grail")))
self.assertIn("scene", os.listdir(os.path.join(tgt, "grail", "36")))
@skipIf(True, "SLOWTEST skip")
def test_get_dir_templated_paths(self):
"""
cp.get_dir
@ -163,6 +170,7 @@ class CPModuleTest(ModuleCase):
# cp.get_url tests
@with_tempfile()
@skipIf(True, "SLOWTEST skip")
def test_get_url(self, tgt):
"""
cp.get_url with salt:// source given
@ -173,6 +181,7 @@ class CPModuleTest(ModuleCase):
self.assertIn("KNIGHT: They're nervous, sire.", data)
self.assertNotIn("bacon", data)
@skipIf(True, "SLOWTEST skip")
def test_get_url_makedirs(self):
"""
cp.get_url
@ -187,6 +196,7 @@ class CPModuleTest(ModuleCase):
self.assertIn("KNIGHT: They're nervous, sire.", data)
self.assertNotIn("bacon", data)
@skipIf(True, "SLOWTEST skip")
def test_get_url_dest_empty(self):
"""
cp.get_url with salt:// source given and destination omitted.
@ -197,6 +207,7 @@ class CPModuleTest(ModuleCase):
self.assertIn("KNIGHT: They're nervous, sire.", data)
self.assertNotIn("bacon", data)
@skipIf(True, "SLOWTEST skip")
def test_get_url_no_dest(self):
"""
cp.get_url with salt:// source given and destination set as None
@ -205,6 +216,7 @@ class CPModuleTest(ModuleCase):
ret = self.run_function("cp.get_url", ["salt://grail/scene33", tgt])
self.assertIn("KNIGHT: They're nervous, sire.", ret)
@skipIf(True, "SLOWTEST skip")
def test_get_url_nonexistent_source(self):
"""
cp.get_url with nonexistent salt:// source given
@ -213,6 +225,7 @@ class CPModuleTest(ModuleCase):
ret = self.run_function("cp.get_url", ["salt://grail/nonexistent_scene", tgt])
self.assertEqual(ret, False)
@skipIf(True, "SLOWTEST skip")
def test_get_url_to_dir(self):
"""
cp.get_url with salt:// source
@ -228,6 +241,7 @@ class CPModuleTest(ModuleCase):
salt.utils.platform.is_darwin() and six.PY2, "This test hangs on OS X on Py2"
)
@with_tempfile()
@skipIf(True, "SLOWTEST skip")
def test_get_url_https(self, tgt):
"""
cp.get_url with https:// source given
@ -243,6 +257,7 @@ class CPModuleTest(ModuleCase):
@skipIf(
salt.utils.platform.is_darwin() and six.PY2, "This test hangs on OS X on Py2"
)
@skipIf(True, "SLOWTEST skip")
def test_get_url_https_dest_empty(self):
"""
cp.get_url with https:// source given and destination omitted.
@ -259,6 +274,7 @@ class CPModuleTest(ModuleCase):
@skipIf(
salt.utils.platform.is_darwin() and six.PY2, "This test hangs on OS X on Py2"
)
@skipIf(True, "SLOWTEST skip")
def test_get_url_https_no_dest(self):
"""
cp.get_url with https:// source given and destination set as None
@ -281,6 +297,7 @@ class CPModuleTest(ModuleCase):
self.assertIn("Windows", ret)
self.assertNotIn("AYBABTU", ret)
@skipIf(True, "SLOWTEST skip")
def test_get_url_file(self):
"""
cp.get_url with file:// source given
@ -293,6 +310,7 @@ class CPModuleTest(ModuleCase):
self.assertIn("KNIGHT: They're nervous, sire.", data)
self.assertNotIn("bacon", data)
@skipIf(True, "SLOWTEST skip")
def test_get_url_file_no_dest(self):
"""
cp.get_url with file:// source given and destination set as None
@ -304,6 +322,7 @@ class CPModuleTest(ModuleCase):
self.assertNotIn("bacon", ret)
@with_tempfile()
@skipIf(True, "SLOWTEST skip")
def test_get_url_ftp(self, tgt):
"""
cp.get_url with https:// source given
@ -321,6 +340,7 @@ class CPModuleTest(ModuleCase):
# cp.get_file_str tests
@skipIf(True, "SLOWTEST skip")
def test_get_file_str_salt(self):
"""
cp.get_file_str with salt:// source given
@ -329,6 +349,7 @@ class CPModuleTest(ModuleCase):
ret = self.run_function("cp.get_file_str", [src])
self.assertIn("KNIGHT: They're nervous, sire.", ret)
@skipIf(True, "SLOWTEST skip")
def test_get_file_str_nonexistent_source(self):
"""
cp.get_file_str with nonexistent salt:// source given
@ -340,6 +361,7 @@ class CPModuleTest(ModuleCase):
@skipIf(
salt.utils.platform.is_darwin() and six.PY2, "This test hangs on OS X on Py2"
)
@skipIf(True, "SLOWTEST skip")
def test_get_file_str_https(self):
"""
cp.get_file_str with https:// source given
@ -351,6 +373,7 @@ class CPModuleTest(ModuleCase):
self.assertIn("Windows", ret)
self.assertNotIn("AYBABTU", ret)
@skipIf(True, "SLOWTEST skip")
def test_get_file_str_local(self):
"""
cp.get_file_str with file:// source given
@ -362,6 +385,7 @@ class CPModuleTest(ModuleCase):
# caching tests
@skipIf(True, "SLOWTEST skip")
def test_cache_file(self):
"""
cp.cache_file
@ -372,6 +396,7 @@ class CPModuleTest(ModuleCase):
self.assertIn("KNIGHT: They're nervous, sire.", data)
self.assertNotIn("bacon", data)
@skipIf(True, "SLOWTEST skip")
def test_cache_files(self):
"""
cp.cache_files
@ -386,6 +411,7 @@ class CPModuleTest(ModuleCase):
self.assertNotIn("bacon", data)
@with_tempfile()
@skipIf(True, "SLOWTEST skip")
def test_cache_master(self, tgt):
"""
cp.cache_master
@ -394,6 +420,7 @@ class CPModuleTest(ModuleCase):
for path in ret:
self.assertTrue(os.path.exists(path))
@skipIf(True, "SLOWTEST skip")
def test_cache_local_file(self):
"""
cp.cache_local_file
@ -407,6 +434,7 @@ class CPModuleTest(ModuleCase):
@skipIf(not salt.utils.path.which("nginx"), "nginx not installed")
@skip_if_not_root
@skipIf(True, "SLOWTEST skip")
def test_cache_remote_file(self):
"""
cp.cache_file
@ -487,6 +515,7 @@ class CPModuleTest(ModuleCase):
cached_contents = salt.utils.stringutils.to_unicode(fp_.read())
self.assertEqual(cached_contents, file_contents)
@skipIf(True, "SLOWTEST skip")
def test_list_states(self):
"""
cp.list_states
@ -495,6 +524,7 @@ class CPModuleTest(ModuleCase):
self.assertIn("core", ret)
self.assertIn("top", ret)
@skipIf(True, "SLOWTEST skip")
def test_list_minion(self):
"""
cp.list_minion
@ -511,6 +541,7 @@ class CPModuleTest(ModuleCase):
break
self.assertTrue(found)
@skipIf(True, "SLOWTEST skip")
def test_is_cached(self):
"""
cp.is_cached
@ -521,6 +552,7 @@ class CPModuleTest(ModuleCase):
ret2 = self.run_function("cp.is_cached", ["salt://fasldkgj/poicxzbn"])
self.assertFalse(ret2)
@skipIf(True, "SLOWTEST skip")
def test_hash_file(self):
"""
cp.hash_file
@ -532,6 +564,7 @@ class CPModuleTest(ModuleCase):
self.assertEqual(sha256_hash["hsum"], hashlib.sha256(data).hexdigest())
@with_tempfile()
@skipIf(True, "SLOWTEST skip")
def test_get_file_from_env_predefined(self, tgt):
"""
cp.get_file
@ -547,6 +580,7 @@ class CPModuleTest(ModuleCase):
os.unlink(tgt)
@with_tempfile()
@skipIf(True, "SLOWTEST skip")
def test_get_file_from_env_in_url(self, tgt):
tgt = os.path.join(RUNTIME_VARS.TMP, "cheese")
try:
@ -558,6 +592,7 @@ class CPModuleTest(ModuleCase):
finally:
os.unlink(tgt)
@skipIf(True, "SLOWTEST skip")
def test_push(self):
log_to_xfer = os.path.join(RUNTIME_VARS.TMP, uuid.uuid4().hex)
open(log_to_xfer, "w").close() # pylint: disable=resource-leakage
@ -579,5 +614,6 @@ class CPModuleTest(ModuleCase):
finally:
os.unlink(tgt_cache_file)
@skipIf(True, "SLOWTEST skip")
def test_envs(self):
self.assertEqual(sorted(self.run_function("cp.envs")), sorted(["base", "prod"]))

View file

@ -4,6 +4,7 @@ from __future__ import absolute_import, print_function, unicode_literals
import pytest
from tests.support.case import ModuleCase
from tests.support.unit import skipIf
@pytest.mark.windows_whitelisted
@ -16,6 +17,7 @@ class DataModuleTest(ModuleCase):
self.run_function("data.clear")
self.addCleanup(self.run_function, "data.clear")
@skipIf(True, "SLOWTEST skip")
def test_load_dump(self):
"""
data.load
@ -24,6 +26,7 @@ class DataModuleTest(ModuleCase):
self.assertTrue(self.run_function("data.dump", ['{"foo": "bar"}']))
self.assertEqual(self.run_function("data.load"), {"foo": "bar"})
@skipIf(True, "SLOWTEST skip")
def test_get_update(self):
"""
data.get
@ -37,6 +40,7 @@ class DataModuleTest(ModuleCase):
self.run_function("data.get", [["spam", "unladen"]]), ["eggs", "swallow"]
)
@skipIf(True, "SLOWTEST skip")
def test_cas_update(self):
"""
data.update

View file

@ -4,19 +4,23 @@ from __future__ import absolute_import, print_function, unicode_literals
import pytest
from tests.support.case import ModuleCase
from tests.support.unit import skipIf
@pytest.mark.windows_whitelisted
class DecoratorTest(ModuleCase):
@skipIf(True, "SLOWTEST skip")
def test_module(self):
self.assertTrue(self.run_function("runtests_decorators.working_function"))
@skipIf(True, "SLOWTEST skip")
def test_depends(self):
ret = self.run_function("runtests_decorators.depends")
self.assertTrue(isinstance(ret, dict))
self.assertTrue(ret["ret"])
self.assertTrue(isinstance(ret["time"], float))
@skipIf(True, "SLOWTEST skip")
def test_missing_depends(self):
self.assertEqual(
{
@ -26,6 +30,7 @@ class DecoratorTest(ModuleCase):
self.run_function("runtests_decorators.missing_depends"),
)
@skipIf(True, "SLOWTEST skip")
def test_bool_depends(self):
# test True
self.assertTrue(self.run_function("runtests_decorators.booldependsTrue"))
@ -36,34 +41,40 @@ class DecoratorTest(ModuleCase):
self.run_function("runtests_decorators.booldependsFalse"),
)
@skipIf(True, "SLOWTEST skip")
def test_depends_will_not_fallback(self):
ret = self.run_function("runtests_decorators.depends_will_not_fallback")
self.assertTrue(isinstance(ret, dict))
self.assertTrue(ret["ret"])
self.assertTrue(isinstance(ret["time"], float))
@skipIf(True, "SLOWTEST skip")
def test_missing_depends_will_fallback(self):
self.assertListEqual(
[False, "fallback"],
self.run_function("runtests_decorators.missing_depends_will_fallback"),
)
@skipIf(True, "SLOWTEST skip")
def test_command_success_retcode(self):
ret = self.run_function("runtests_decorators.command_success_retcode")
self.assertIs(ret, True)
@skipIf(True, "SLOWTEST skip")
def test_command_failure_retcode(self):
ret = self.run_function("runtests_decorators.command_failure_retcode")
self.assertEqual(
ret, "'runtests_decorators.command_failure_retcode' is not available."
)
@skipIf(True, "SLOWTEST skip")
def test_command_success_nonzero_retcode_true(self):
ret = self.run_function(
"runtests_decorators.command_success_nonzero_retcode_true"
)
self.assertIs(ret, True)
@skipIf(True, "SLOWTEST skip")
def test_command_failure_nonzero_retcode_true(self):
ret = self.run_function(
"runtests_decorators.command_failure_nonzero_retcode_true"
@ -73,12 +84,14 @@ class DecoratorTest(ModuleCase):
"'runtests_decorators.command_failure_nonzero_retcode_true' is not available.",
)
@skipIf(True, "SLOWTEST skip")
def test_command_success_nonzero_retcode_false(self):
ret = self.run_function(
"runtests_decorators.command_success_nonzero_retcode_false"
)
self.assertIs(ret, True)
@skipIf(True, "SLOWTEST skip")
def test_command_failure_nonzero_retcode_false(self):
ret = self.run_function(
"runtests_decorators.command_failure_nonzero_retcode_false"
@ -88,15 +101,18 @@ class DecoratorTest(ModuleCase):
"'runtests_decorators.command_failure_nonzero_retcode_false' is not available.",
)
@skipIf(True, "SLOWTEST skip")
def test_versioned_depend_insufficient(self):
self.assertIn(
"is not available",
self.run_function("runtests_decorators.version_depends_false"),
)
@skipIf(True, "SLOWTEST skip")
def test_versioned_depend_sufficient(self):
self.assertTrue(self.run_function("runtests_decorators.version_depends_true"))
@skipIf(True, "SLOWTEST skip")
def test_versioned_depend_versionless(self):
self.assertTrue(
self.run_function("runtests_decorators.version_depends_versionless_true")

View file

@ -45,6 +45,7 @@ class DiskModuleTest(ModuleCase):
Validate the disk module
"""
@skipIf(True, "SLOWTEST skip")
def test_usage(self):
"""
disk.usage

View file

@ -66,6 +66,7 @@ class DockerCallTestCase(ModuleCase, SaltReturnAssertsMixin):
delattr(self, "random_name")
delattr(self, "image_tag")
@skipIf(True, "SLOWTEST skip")
def test_docker_call(self):
"""
check that docker.call works, and works with a container not running as root
@ -73,6 +74,7 @@ class DockerCallTestCase(ModuleCase, SaltReturnAssertsMixin):
ret = self.run_function("docker.call", [self.random_name, "test.ping"])
assert ret is True
@skipIf(True, "SLOWTEST skip")
def test_docker_sls(self):
"""
check that docker.sls works, and works with a container not running as root
@ -80,6 +82,7 @@ class DockerCallTestCase(ModuleCase, SaltReturnAssertsMixin):
ret = self.run_function("docker.apply", [self.random_name, "core"])
self.assertSaltTrueReturn(ret)
@skipIf(True, "SLOWTEST skip")
def test_docker_highstate(self):
"""
check that docker.highstate works, and works with a container not running as root

View file

@ -184,6 +184,7 @@ class FileModuleTest(ModuleCase):
ret = self.run_function("file.chgrp", arg=[self.myfile, group])
self.assertIn("not exist", ret)
@skipIf(True, "SLOWTEST skip")
def test_patch(self):
if not self.run_function("cmd.has_exec", ["patch"]):
self.skipTest("patch is not installed")
@ -206,44 +207,53 @@ class FileModuleTest(ModuleCase):
salt.utils.stringutils.to_unicode(fp.read()), "Hello world\n"
)
@skipIf(True, "SLOWTEST skip")
def test_remove_file(self):
ret = self.run_function("file.remove", arg=[self.myfile])
self.assertTrue(ret)
@skipIf(True, "SLOWTEST skip")
def test_remove_dir(self):
ret = self.run_function("file.remove", arg=[self.mydir])
self.assertTrue(ret)
@skipIf(True, "SLOWTEST skip")
def test_remove_symlink(self):
ret = self.run_function("file.remove", arg=[self.mysymlink])
self.assertTrue(ret)
@skipIf(True, "SLOWTEST skip")
def test_remove_broken_symlink(self):
ret = self.run_function("file.remove", arg=[self.mybadsymlink])
self.assertTrue(ret)
@skipIf(True, "SLOWTEST skip")
def test_cannot_remove(self):
ret = self.run_function("file.remove", arg=["tty"])
self.assertEqual(
"ERROR executing 'file.remove': File path must be absolute: tty", ret
)
@skipIf(True, "SLOWTEST skip")
def test_source_list_for_single_file_returns_unchanged(self):
ret = self.run_function(
"file.source_list", ["salt://http/httpd.conf", "filehash", "base"]
)
self.assertEqual(list(ret), ["salt://http/httpd.conf", "filehash"])
@skipIf(True, "SLOWTEST skip")
def test_source_list_for_single_local_file_slash_returns_unchanged(self):
ret = self.run_function("file.source_list", [self.myfile, "filehash", "base"])
self.assertEqual(list(ret), [self.myfile, "filehash"])
@skipIf(True, "SLOWTEST skip")
def test_source_list_for_single_local_file_proto_returns_unchanged(self):
ret = self.run_function(
"file.source_list", ["file://" + self.myfile, "filehash", "base"]
)
self.assertEqual(list(ret), ["file://" + self.myfile, "filehash"])
@skipIf(True, "SLOWTEST skip")
def test_file_line_changes_format(self):
"""
Test file.line changes output formatting.
@ -255,6 +265,7 @@ class FileModuleTest(ModuleCase):
)
self.assertIn("Hello" + os.linesep + "+Goodbye", ret)
@skipIf(True, "SLOWTEST skip")
def test_file_line_content(self):
self.minion_run(
"file.line", self.myfile, "Goodbye", mode="insert", after="Hello"
@ -263,6 +274,7 @@ class FileModuleTest(ModuleCase):
content = fp.read()
self.assertEqual(content, "Hello" + os.linesep + "Goodbye" + os.linesep)
@skipIf(True, "SLOWTEST skip")
def test_file_line_duplicate_insert_after(self):
"""
Test file.line duplicates line.
@ -278,6 +290,7 @@ class FileModuleTest(ModuleCase):
content = fp.read()
self.assertEqual(content, "Hello" + os.linesep + "Goodbye" + os.linesep)
@skipIf(True, "SLOWTEST skip")
def test_file_line_duplicate_insert_before(self):
"""
Test file.line duplicates line.
@ -293,6 +306,7 @@ class FileModuleTest(ModuleCase):
content = fp.read()
self.assertEqual(content, "Hello" + os.linesep + "Goodbye" + os.linesep)
@skipIf(True, "SLOWTEST skip")
def test_file_line_duplicate_ensure_after(self):
"""
Test file.line duplicates line.
@ -308,6 +322,7 @@ class FileModuleTest(ModuleCase):
content = fp.read()
self.assertEqual(content, "Hello" + os.linesep + "Goodbye" + os.linesep)
@skipIf(True, "SLOWTEST skip")
def test_file_line_duplicate_ensure_before(self):
"""
Test file.line duplicates line.

View file

@ -58,6 +58,7 @@ class GemModuleTest(ModuleCase):
self.addCleanup(uninstall_gem)
@skipIf(True, "SLOWTEST skip")
def test_install_uninstall(self):
"""
gem.install
@ -70,6 +71,7 @@ class GemModuleTest(ModuleCase):
self.run_function("gem.uninstall", [self.GEM])
self.assertFalse(self.run_function("gem.list", [self.GEM]))
@skipIf(True, "SLOWTEST skip")
def test_install_version(self):
"""
gem.install rake version=11.1.2
@ -82,6 +84,7 @@ class GemModuleTest(ModuleCase):
self.run_function("gem.uninstall", [self.GEM])
self.assertFalse(self.run_function("gem.list", [self.GEM]))
@skipIf(True, "SLOWTEST skip")
def test_list(self):
"""
gem.list
@ -97,6 +100,7 @@ class GemModuleTest(ModuleCase):
self.run_function("gem.uninstall", [" ".join(self.GEM_LIST)])
@skipIf(True, "SLOWTEST skip")
def test_list_upgrades(self):
"""
gem.list_upgrades
@ -109,6 +113,7 @@ class GemModuleTest(ModuleCase):
self.run_function("gem.uninstall", [self.OLD_GEM])
@skipIf(True, "SLOWTEST skip")
def test_sources_add_remove(self):
"""
gem.sources_add
@ -124,6 +129,7 @@ class GemModuleTest(ModuleCase):
sources_list = self.run_function("gem.sources_list")
self.assertNotIn(source, sources_list)
@skipIf(True, "SLOWTEST skip")
def test_update(self):
"""
gem.update
@ -139,6 +145,7 @@ class GemModuleTest(ModuleCase):
self.run_function("gem.uninstall", [self.OLD_GEM])
self.assertFalse(self.run_function("gem.list", [self.OLD_GEM]))
@skipIf(True, "SLOWTEST skip")
def test_update_system(self):
"""
gem.update_system

View file

@ -160,6 +160,7 @@ class GitModuleTest(ModuleCase):
delattr(self, key)
super(GitModuleTest, self).tearDown()
@skipIf(True, "SLOWTEST skip")
def test_add_dir(self):
"""
Test git.add with a directory
@ -183,6 +184,7 @@ class GitModuleTest(ModuleCase):
res = res.replace("\\", "/")
self.assertEqual(ret, res)
@skipIf(True, "SLOWTEST skip")
def test_add_file(self):
"""
Test git.add with a file
@ -198,6 +200,7 @@ class GitModuleTest(ModuleCase):
ret = self.run_function("git.add", [self.repo, filename])
self.assertEqual(ret, "add '{0}'".format(filename))
@skipIf(True, "SLOWTEST skip")
def test_archive(self):
"""
Test git.archive
@ -235,6 +238,7 @@ class GitModuleTest(ModuleCase):
except OSError:
pass
@skipIf(True, "SLOWTEST skip")
def test_archive_subdir(self):
"""
Test git.archive on a subdir, giving only a partial copy of the repo in
@ -261,6 +265,7 @@ class GitModuleTest(ModuleCase):
except OSError:
pass
@skipIf(True, "SLOWTEST skip")
def test_branch(self):
"""
Test creating, renaming, and deleting a branch using git.branch
@ -276,6 +281,7 @@ class GitModuleTest(ModuleCase):
self.run_function("git.branch", [self.repo, renamed_branch], opts="-D")
)
@skipIf(True, "SLOWTEST skip")
def test_checkout(self):
"""
Test checking out a new branch and then checking out master again
@ -292,6 +298,7 @@ class GitModuleTest(ModuleCase):
in self.run_function("git.checkout", [self.repo, "master"]),
)
@skipIf(True, "SLOWTEST skip")
def test_checkout_no_rev(self):
"""
Test git.checkout without a rev, both with -b in opts and without
@ -308,6 +315,7 @@ class GitModuleTest(ModuleCase):
in self.run_function("git.checkout", [self.repo])
)
@skipIf(True, "SLOWTEST skip")
def test_clone(self):
"""
Test cloning an existing repo
@ -317,6 +325,7 @@ class GitModuleTest(ModuleCase):
# Cleanup after yourself
shutil.rmtree(clone_parent_dir, True)
@skipIf(True, "SLOWTEST skip")
def test_clone_with_alternate_name(self):
"""
Test cloning an existing repo with an alternate name for the repo dir
@ -332,6 +341,7 @@ class GitModuleTest(ModuleCase):
# Cleanup after yourself
shutil.rmtree(clone_parent_dir, True)
@skipIf(True, "SLOWTEST skip")
def test_commit(self):
"""
Test git.commit two ways:
@ -360,6 +370,7 @@ class GitModuleTest(ModuleCase):
)
self.assertTrue(bool(re.search(commit_re_prefix + commit_msg, ret)))
@skipIf(True, "SLOWTEST skip")
def test_config(self):
"""
Test setting, getting, and unsetting config values
@ -546,12 +557,14 @@ class GitModuleTest(ModuleCase):
finally:
_clear_config()
@skipIf(True, "SLOWTEST skip")
def test_current_branch(self):
"""
Test git.current_branch
"""
self.assertEqual(self.run_function("git.current_branch", [self.repo]), "master")
@skipIf(True, "SLOWTEST skip")
def test_describe(self):
"""
Test git.describe
@ -561,6 +574,7 @@ class GitModuleTest(ModuleCase):
# Test for git.fetch would be unreliable on Jenkins, skipping for now
# The test should go into test_remotes when ready
@skipIf(True, "SLOWTEST skip")
def test_init(self):
"""
Use git.init to init a new repo
@ -596,6 +610,7 @@ class GitModuleTest(ModuleCase):
shutil.rmtree(new_repo)
@skipIf(True, "SLOWTEST skip")
def test_list_branches(self):
"""
Test git.list_branches
@ -604,6 +619,7 @@ class GitModuleTest(ModuleCase):
self.run_function("git.list_branches", [self.repo]), sorted(self.branches)
)
@skipIf(True, "SLOWTEST skip")
def test_list_tags(self):
"""
Test git.list_tags
@ -615,6 +631,7 @@ class GitModuleTest(ModuleCase):
# Test for git.ls_remote will need to wait for now, while I think of how to
# properly mock it.
@skipIf(True, "SLOWTEST skip")
def test_merge(self):
"""
Test git.merge
@ -626,6 +643,7 @@ class GitModuleTest(ModuleCase):
# Merge should be a fast-forward
self.assertTrue("Fast-forward" in ret.splitlines())
@skipIf(True, "SLOWTEST skip")
def test_merge_base_and_tree(self):
"""
Test git.merge_base, git.merge_tree and git.revision
@ -662,6 +680,7 @@ class GitModuleTest(ModuleCase):
# Test for git.push would be unreliable on Jenkins, skipping for now
@skipIf(True, "SLOWTEST skip")
def test_rebase(self):
"""
Test git.rebase
@ -697,6 +716,7 @@ class GitModuleTest(ModuleCase):
# Test for git.remote_set is in test_remotes
@skipIf(True, "SLOWTEST skip")
def test_remotes(self):
"""
Test setting a remote (git.remote_set), and getting a remote
@ -726,6 +746,7 @@ class GitModuleTest(ModuleCase):
)
self.assertEqual(self.run_function("git.remotes", [self.repo]), remotes)
@skipIf(True, "SLOWTEST skip")
def test_reset(self):
"""
Test git.reset
@ -750,6 +771,7 @@ class GitModuleTest(ModuleCase):
# The two revisions should be the same
self.assertEqual(head_rev, master_rev)
@skipIf(True, "SLOWTEST skip")
def test_rev_parse(self):
"""
Test git.rev_parse
@ -764,6 +786,7 @@ class GitModuleTest(ModuleCase):
# Test for git.revision happens in test_merge_base
@skipIf(True, "SLOWTEST skip")
def test_rm(self):
"""
Test git.rm
@ -785,6 +808,7 @@ class GitModuleTest(ModuleCase):
self.run_function("git.rm", [self.repo, entire_dir], opts="-r"), expected
)
@skipIf(True, "SLOWTEST skip")
def test_stash(self):
"""
Test git.stash
@ -814,6 +838,7 @@ class GitModuleTest(ModuleCase):
)
)
@skipIf(True, "SLOWTEST skip")
def test_status(self):
"""
Test git.status
@ -851,6 +876,7 @@ class GitModuleTest(ModuleCase):
# TODO: Add git.submodule test
@skipIf(True, "SLOWTEST skip")
def test_symbolic_ref(self):
"""
Test git.symbolic_ref
@ -863,6 +889,7 @@ class GitModuleTest(ModuleCase):
@skipIf(
not _worktrees_supported(), "Git 2.5 or newer required for worktree support"
)
@skipIf(True, "SLOWTEST skip")
def test_worktree_add_rm(self):
"""
This tests git.worktree_add, git.is_worktree, git.worktree_rm, and

View file

@ -25,6 +25,7 @@ class TestModulesGrains(ModuleCase):
Test the grains module
"""
@skipIf(True, "SLOWTEST skip")
def test_items(self):
"""
grains.items
@ -35,6 +36,7 @@ class TestModulesGrains(ModuleCase):
opts["grains"]["test_grain"],
)
@skipIf(True, "SLOWTEST skip")
def test_item(self):
"""
grains.item
@ -45,6 +47,7 @@ class TestModulesGrains(ModuleCase):
opts["grains"]["test_grain"],
)
@skipIf(True, "SLOWTEST skip")
def test_ls(self):
"""
grains.ls
@ -89,6 +92,7 @@ class TestModulesGrains(ModuleCase):
os.environ.get("TRAVIS_PYTHON_VERSION", None) is not None,
"Travis environment can't keep up with salt refresh",
)
@skipIf(True, "SLOWTEST skip")
def test_set_val(self):
"""
test grains.set_val
@ -105,12 +109,14 @@ class TestModulesGrains(ModuleCase):
ret = self.run_function("grains.item", ["setgrain"])
self.assertTrue(ret)
@skipIf(True, "SLOWTEST skip")
def test_get(self):
"""
test grains.get
"""
self.assertEqual(self.run_function("grains.get", ["level1:level2"]), "foo")
@skipIf(True, "SLOWTEST skip")
def test_get_core_grains(self):
"""
test to ensure some core grains are returned
@ -130,6 +136,7 @@ class TestModulesGrains(ModuleCase):
self.assertTrue(get_grain)
@skipIf(True, "SLOWTEST skip")
def test_get_grains_int(self):
"""
test to ensure int grains
@ -168,6 +175,7 @@ class GrainsAppendTestCase(ModuleCase):
if not self.wait_for_grain(self.GRAIN_KEY, []):
raise Exception("Failed to set grain")
@skipIf(True, "SLOWTEST skip")
def test_grains_append(self):
"""
Tests the return of a simple grains.append call.
@ -175,6 +183,7 @@ class GrainsAppendTestCase(ModuleCase):
ret = self.run_function("grains.append", [self.GRAIN_KEY, self.GRAIN_VAL])
self.assertEqual(ret[self.GRAIN_KEY], [self.GRAIN_VAL])
@skipIf(True, "SLOWTEST skip")
def test_grains_append_val_already_present(self):
"""
Tests the return of a grains.append call when the value is already
@ -199,6 +208,7 @@ class GrainsAppendTestCase(ModuleCase):
assert msg == ret
@flaky
@skipIf(True, "SLOWTEST skip")
def test_grains_append_val_is_list(self):
"""
Tests the return of a grains.append call when val is passed in as a list.
@ -211,6 +221,7 @@ class GrainsAppendTestCase(ModuleCase):
)
self.assertEqual(ret[self.GRAIN_KEY], [self.GRAIN_VAL, second_grain])
@skipIf(True, "SLOWTEST skip")
def test_grains_append_call_twice(self):
"""
Tests the return of a grains.append call when the value is already present
@ -251,6 +262,7 @@ class GrainsAppendTestCase(ModuleCase):
time.sleep(sleep)
return False
@skipIf(True, "SLOWTEST skip")
def test_grains_remove_add(self):
second_grain = self.GRAIN_VAL + "-2"
ret = self.run_function("grains.get", [self.GRAIN_KEY])

View file

@ -103,6 +103,7 @@ class GroupModuleTest(ModuleCase):
return gid
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_add(self):
"""
Test the add group function
@ -117,6 +118,7 @@ class GroupModuleTest(ModuleCase):
@destructiveTest
@skipIf(salt.utils.platform.is_windows(), "Skip on Windows")
@skipIf(True, "SLOWTEST skip")
def test_add_system_group(self):
"""
Test the add group function with system=True
@ -134,6 +136,7 @@ class GroupModuleTest(ModuleCase):
@destructiveTest
@skipIf(salt.utils.platform.is_windows(), "Skip on Windows")
@skipIf(True, "SLOWTEST skip")
def test_add_system_group_gid(self):
"""
Test the add group function with system=True and a specific gid
@ -150,6 +153,7 @@ class GroupModuleTest(ModuleCase):
self.assertFalse(self.run_function("group.add", [self._group, gid]))
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_delete(self):
"""
Test the delete group function
@ -162,6 +166,7 @@ class GroupModuleTest(ModuleCase):
# group does not exist
self.assertFalse(self.run_function("group.delete", [self._no_group]))
@skipIf(True, "SLOWTEST skip")
def test_info(self):
"""
Test the info group function
@ -176,6 +181,7 @@ class GroupModuleTest(ModuleCase):
self.assertIn(self._user, str(group_info["members"]))
@skipIf(salt.utils.platform.is_windows(), "gid test skipped on windows")
@skipIf(True, "SLOWTEST skip")
def test_chgid(self):
"""
Test the change gid function
@ -185,6 +191,7 @@ class GroupModuleTest(ModuleCase):
group_info = self.run_function("group.info", [self._group])
self.assertEqual(group_info["gid"], self._new_gid)
@skipIf(True, "SLOWTEST skip")
def test_adduser(self):
"""
Test the add user to group function
@ -207,6 +214,7 @@ class GroupModuleTest(ModuleCase):
self.run_function("group.adduser", [self._no_group, self._no_user])
)
@skipIf(True, "SLOWTEST skip")
def test_deluser(self):
"""
Test the delete user from group function
@ -218,6 +226,7 @@ class GroupModuleTest(ModuleCase):
group_info = self.run_function("group.info", [self._group])
self.assertNotIn(self._user, str(group_info["members"]))
@skipIf(True, "SLOWTEST skip")
def test_members(self):
"""
Test the members function
@ -232,6 +241,7 @@ class GroupModuleTest(ModuleCase):
self.assertIn(self._user, str(group_info["members"]))
self.assertIn(self._user1, str(group_info["members"]))
@skipIf(True, "SLOWTEST skip")
def test_getent(self):
"""
Test the getent function

View file

@ -13,6 +13,7 @@ import salt.utils.files
import salt.utils.stringutils
from tests.support.case import ModuleCase
from tests.support.runtests import RUNTIME_VARS
from tests.support.unit import skipIf
log = logging.getLogger(__name__)
@ -40,6 +41,7 @@ class HostsModuleTest(ModuleCase):
shutil.copyfile(os.path.join(RUNTIME_VARS.FILES, "hosts"), self.hosts_file)
self.addCleanup(self.__clear_hosts)
@skipIf(True, "SLOWTEST skip")
def test_list_hosts(self):
"""
hosts.list_hosts
@ -49,6 +51,7 @@ class HostsModuleTest(ModuleCase):
self.assertEqual(hosts["::1"], {"aliases": ["ip6-localhost", "ip6-loopback"]})
self.assertEqual(hosts["127.0.0.1"], {"aliases": ["localhost", "myname"]})
@skipIf(True, "SLOWTEST skip")
def test_list_hosts_nofile(self):
"""
hosts.list_hosts
@ -59,6 +62,7 @@ class HostsModuleTest(ModuleCase):
hosts = self.run_function("hosts.list_hosts")
self.assertEqual(hosts, {})
@skipIf(True, "SLOWTEST skip")
def test_get_ip(self):
"""
hosts.get_ip
@ -68,6 +72,7 @@ class HostsModuleTest(ModuleCase):
self.__clear_hosts()
self.assertEqual(self.run_function("hosts.get_ip", ["othername"]), "")
@skipIf(True, "SLOWTEST skip")
def test_get_alias(self):
"""
hosts.get_alias
@ -79,6 +84,7 @@ class HostsModuleTest(ModuleCase):
self.__clear_hosts()
self.assertEqual(self.run_function("hosts.get_alias", ["127.0.0.1"]), [])
@skipIf(True, "SLOWTEST skip")
def test_has_pair(self):
"""
hosts.has_pair
@ -88,6 +94,7 @@ class HostsModuleTest(ModuleCase):
self.run_function("hosts.has_pair", ["127.0.0.1", "othername"])
)
@skipIf(True, "SLOWTEST skip")
def test_set_host(self):
"""
hosts.set_hosts
@ -101,6 +108,7 @@ class HostsModuleTest(ModuleCase):
"should remove second entry",
)
@skipIf(True, "SLOWTEST skip")
def test_add_host(self):
"""
hosts.add_host
@ -113,12 +121,14 @@ class HostsModuleTest(ModuleCase):
)
self.assertEqual(len(self.run_function("hosts.list_hosts")), 11)
@skipIf(True, "SLOWTEST skip")
def test_rm_host(self):
self.assertTrue(self.run_function("hosts.has_pair", ["127.0.0.1", "myname"]))
self.assertTrue(self.run_function("hosts.rm_host", ["127.0.0.1", "myname"]))
self.assertFalse(self.run_function("hosts.has_pair", ["127.0.0.1", "myname"]))
self.assertTrue(self.run_function("hosts.rm_host", ["127.0.0.1", "unknown"]))
@skipIf(True, "SLOWTEST skip")
def test_add_host_formatting(self):
"""
Ensure that hosts.add_host isn't adding duplicates and that

View file

@ -6,10 +6,12 @@ import re
import pytest
from tests.support.case import ModuleCase
from tests.support.unit import skipIf
@pytest.mark.windows_whitelisted
class KeyModuleTest(ModuleCase):
@skipIf(True, "SLOWTEST skip")
def test_key_finger(self):
"""
test key.finger to ensure we receive a valid fingerprint
@ -18,6 +20,7 @@ class KeyModuleTest(ModuleCase):
match = re.match("([0-9a-z]{2}:){15,}[0-9a-z]{2}$", out)
self.assertTrue(match)
@skipIf(True, "SLOWTEST skip")
def test_key_finger_master(self):
"""
test key.finger_master to ensure we receive a valid fingerprint

View file

@ -77,6 +77,7 @@ class ServiceModuleTest(ModuleCase):
del self.service_name
@flaky
@skipIf(True, "SLOWTEST skip")
def test_service_status_running(self):
"""
test service.status execution module
@ -86,6 +87,7 @@ class ServiceModuleTest(ModuleCase):
check_service = self.run_function("service.status", [self.service_name])
self.assertTrue(check_service)
@skipIf(True, "SLOWTEST skip")
def test_service_status_dead(self):
"""
test service.status execution module
@ -95,12 +97,14 @@ class ServiceModuleTest(ModuleCase):
check_service = self.run_function("service.status", [self.service_name])
self.assertFalse(check_service)
@skipIf(True, "SLOWTEST skip")
def test_service_restart(self):
"""
test service.restart
"""
self.assertTrue(self.run_function("service.restart", [self.service_name]))
@skipIf(True, "SLOWTEST skip")
def test_service_enable(self):
"""
test service.get_enabled and service.enable module
@ -111,6 +115,7 @@ class ServiceModuleTest(ModuleCase):
self.assertTrue(self.run_function("service.enable", [self.service_name]))
self.assertIn(self.service_name, self.run_function("service.get_enabled"))
@skipIf(True, "SLOWTEST skip")
def test_service_disable(self):
"""
test service.get_disabled and service.disable module
@ -124,6 +129,7 @@ class ServiceModuleTest(ModuleCase):
else:
self.assertIn(self.service_name, self.run_function("service.get_disabled"))
@skipIf(True, "SLOWTEST skip")
def test_service_disable_doesnot_exist(self):
"""
test service.get_disabled and service.disable module
@ -172,6 +178,7 @@ class ServiceModuleTest(ModuleCase):
self.assertNotIn(srv_name, self.run_function("service.get_disabled"))
@skipIf(not salt.utils.platform.is_windows(), "Windows Only Test")
@skipIf(True, "SLOWTEST skip")
def test_service_get_service_name(self):
"""
test service.get_service_name

View file

@ -54,6 +54,7 @@ class ShadowModuleTest(ModuleCase):
)
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_info(self):
"""
Test shadow.info
@ -70,6 +71,7 @@ class ShadowModuleTest(ModuleCase):
self.assertEqual(ret["name"], "")
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_del_password(self):
"""
Test shadow.del_password
@ -87,6 +89,7 @@ class ShadowModuleTest(ModuleCase):
self.assertFalse(self.run_function("shadow.del_password", [self._no_user]))
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_set_password(self):
"""
Test shadow.set_password
@ -105,6 +108,7 @@ class ShadowModuleTest(ModuleCase):
)
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_set_inactdays(self):
"""
Test shadow.set_inactdays
@ -121,6 +125,7 @@ class ShadowModuleTest(ModuleCase):
self.assertFalse(self.run_function("shadow.set_inactdays", [self._no_user, 12]))
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_set_maxdays(self):
"""
Test shadow.set_maxdays
@ -135,6 +140,7 @@ class ShadowModuleTest(ModuleCase):
self.assertFalse(self.run_function("shadow.set_maxdays", [self._no_user, 12]))
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_set_mindays(self):
"""
Test shadow.set_mindays
@ -150,6 +156,7 @@ class ShadowModuleTest(ModuleCase):
@flaky
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_lock_password(self):
"""
Test shadow.lock_password
@ -165,6 +172,7 @@ class ShadowModuleTest(ModuleCase):
self.assertFalse(self.run_function("shadow.lock_password", [self._no_user]))
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_unlock_password(self):
"""
Test shadow.lock_password
@ -180,6 +188,7 @@ class ShadowModuleTest(ModuleCase):
self.assertFalse(self.run_function("shadow.unlock_password", [self._no_user]))
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_set_warndays(self):
"""
Test shadow.set_warndays
@ -194,6 +203,7 @@ class ShadowModuleTest(ModuleCase):
self.assertFalse(self.run_function("shadow.set_warndays", [self._no_user, 12]))
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_set_date(self):
"""
Test shadow.set_date
@ -212,6 +222,7 @@ class ShadowModuleTest(ModuleCase):
)
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_set_expire(self):
"""
Test shadow.set_exipre
@ -230,6 +241,7 @@ class ShadowModuleTest(ModuleCase):
)
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_set_del_root_password(self):
"""
Test set/del password for root

View file

@ -25,6 +25,7 @@ class LocaleModuleTest(ModuleCase):
self.assertNotIn("Unsupported platform!", locale)
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_gen_locale(self):
# Make sure charmaps are available on test system before attempting
# call gen_locale. We log this error to the user in the function, but
@ -46,6 +47,7 @@ class LocaleModuleTest(ModuleCase):
self.assertTrue(ret)
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_set_locale(self):
original_locale = self.run_function("locale.get_locale")
locale_to_set = _find_new_locale(original_locale)

View file

@ -9,6 +9,7 @@ from __future__ import absolute_import, print_function, unicode_literals
# Import Salt Testing Libs
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, skip_if_not_root
from tests.support.unit import skipIf
OSA_SCRIPT = "/usr/bin/osascript"
@ -45,6 +46,7 @@ class MacAssistiveTest(ModuleCase):
if smile_bundle_present:
self.run_function("assistive.remove", [smile_bundle])
@skipIf(True, "SLOWTEST skip")
def test_install_and_remove(self):
"""
Tests installing and removing a bundled ID or command to use assistive access.
@ -53,6 +55,7 @@ class MacAssistiveTest(ModuleCase):
self.assertTrue(self.run_function("assistive.install", [new_bundle]))
self.assertTrue(self.run_function("assistive.remove", [new_bundle]))
@skipIf(True, "SLOWTEST skip")
def test_installed(self):
"""
Tests the True and False return of assistive.installed.
@ -64,6 +67,7 @@ class MacAssistiveTest(ModuleCase):
# Installed should now return False
self.assertFalse(self.run_function("assistive.installed", [OSA_SCRIPT]))
@skipIf(True, "SLOWTEST skip")
def test_enable(self):
"""
Tests setting the enabled status of a bundled ID or command.
@ -78,6 +82,7 @@ class MacAssistiveTest(ModuleCase):
# Double check the script was enabled, as intended.
self.assertTrue(self.run_function("assistive.enabled", [OSA_SCRIPT]))
@skipIf(True, "SLOWTEST skip")
def test_enabled(self):
"""
Tests if a bundled ID or command is listed in assistive access returns True.

View file

@ -34,6 +34,7 @@ class BrewModuleTest(ModuleCase):
Integration tests for the brew module
"""
@skipIf(True, "SLOWTEST skip")
def test_brew_install(self):
"""
Tests the installation of packages
@ -50,6 +51,7 @@ class BrewModuleTest(ModuleCase):
self.run_function("pkg.remove", [ADD_PKG])
raise
@skipIf(True, "SLOWTEST skip")
def test_remove(self):
"""
Tests the removal of packages
@ -70,6 +72,7 @@ class BrewModuleTest(ModuleCase):
self.run_function("pkg.remove", [DEL_PKG])
raise
@skipIf(True, "SLOWTEST skip")
def test_version(self):
"""
Test pkg.version for mac. Installs a package and then checks we can get
@ -117,6 +120,7 @@ class BrewModuleTest(ModuleCase):
self.run_function("pkg.remove", [ADD_PKG])
raise
@skipIf(True, "SLOWTEST skip")
def test_latest_version(self):
"""
Test pkg.latest_version:
@ -142,6 +146,7 @@ class BrewModuleTest(ModuleCase):
self.run_function("pkg.remove", [ADD_PKG])
raise
@skipIf(True, "SLOWTEST skip")
def test_refresh_db(self):
"""
Integration test to ensure pkg.refresh_db works with brew
@ -149,6 +154,7 @@ class BrewModuleTest(ModuleCase):
refresh_brew = self.run_function("pkg.refresh_db")
self.assertTrue(refresh_brew)
@skipIf(True, "SLOWTEST skip")
def test_list_upgrades(self):
"""
Test pkg.list_upgrades: data is in the form {'name1': 'version1',
@ -169,6 +175,7 @@ class BrewModuleTest(ModuleCase):
self.run_function("pkg.remove", [ADD_PKG])
raise
@skipIf(True, "SLOWTEST skip")
def test_info_installed(self):
"""
Test pkg.info_installed: info returned has certain fields used by

View file

@ -12,6 +12,7 @@ from salt.ext import six
# Import Salt Testing Libs
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, skip_if_not_root
from tests.support.unit import skipIf
@destructiveTest
@ -36,6 +37,7 @@ class MacDesktopTestCase(ModuleCase):
ret = self.run_function("desktop.get_output_volume")
self.assertIsNotNone(ret)
@skipIf(True, "SLOWTEST skip")
def test_set_output_volume(self):
"""
Tests the return of set_output_volume.
@ -65,6 +67,7 @@ class MacDesktopTestCase(ModuleCase):
"""
self.assertTrue(self.run_function("desktop.lock"))
@skipIf(True, "SLOWTEST skip")
def test_say(self):
"""
Tests the return of the say function.

View file

@ -19,6 +19,7 @@ from salt.ext.six.moves import range # pylint: disable=import-error,redefined-b
# Import Salt Testing Libs
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, skip_if_not_root
from tests.support.unit import skipIf
def __random_string(size=6):
@ -53,6 +54,7 @@ class MacGroupModuleTest(ModuleCase):
if os_grain["kernel"] not in "Darwin":
self.skipTest("Test not applicable to '{kernel}' kernel".format(**os_grain))
@skipIf(True, "SLOWTEST skip")
def test_mac_group_add(self):
"""
Tests the add group function
@ -65,6 +67,7 @@ class MacGroupModuleTest(ModuleCase):
self.run_function("group.delete", [ADD_GROUP])
raise
@skipIf(True, "SLOWTEST skip")
def test_mac_group_delete(self):
"""
Tests the delete group function
@ -78,6 +81,7 @@ class MacGroupModuleTest(ModuleCase):
ret = self.run_function("group.delete", [DEL_GROUP])
self.assertTrue(ret)
@skipIf(True, "SLOWTEST skip")
def test_mac_group_chgid(self):
"""
Tests changing the group id
@ -95,6 +99,7 @@ class MacGroupModuleTest(ModuleCase):
self.run_function("group.delete", [CHANGE_GROUP])
raise
@skipIf(True, "SLOWTEST skip")
def test_mac_adduser(self):
"""
Tests adding user to the group
@ -112,6 +117,7 @@ class MacGroupModuleTest(ModuleCase):
self.run_function("group.delete", [ADD_GROUP])
raise
@skipIf(True, "SLOWTEST skip")
def test_mac_deluser(self):
"""
Test deleting user from a group
@ -130,6 +136,7 @@ class MacGroupModuleTest(ModuleCase):
group_info = self.run_function("group.info", [ADD_GROUP])
self.assertNotIn(ADD_USER, "".join(group_info["members"]))
@skipIf(True, "SLOWTEST skip")
def test_mac_members(self):
"""
Test replacing members of a group
@ -152,6 +159,7 @@ class MacGroupModuleTest(ModuleCase):
self.assertIn(REP_USER_GROUP, six.text_type(group_info["members"]))
self.assertNotIn(ADD_USER, six.text_type(group_info["members"]))
@skipIf(True, "SLOWTEST skip")
def test_mac_getent(self):
"""
Test returning info on all groups

View file

@ -18,6 +18,7 @@ from salt.ext import six
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, skip_if_not_root
from tests.support.runtests import RUNTIME_VARS
from tests.support.unit import skipIf
@destructiveTest
@ -53,6 +54,7 @@ class MacKeychainModuleTest(ModuleCase):
if self.cert_alias in certs_list:
self.run_function("keychain.uninstall", [self.cert_alias])
@skipIf(True, "SLOWTEST skip")
def test_mac_keychain_install(self):
"""
Tests that attempts to install a certificate
@ -64,6 +66,7 @@ class MacKeychainModuleTest(ModuleCase):
certs_list = self.run_function("keychain.list_certs")
self.assertIn(self.cert_alias, certs_list)
@skipIf(True, "SLOWTEST skip")
def test_mac_keychain_uninstall(self):
"""
Tests that attempts to uninstall a certificate
@ -85,6 +88,7 @@ class MacKeychainModuleTest(ModuleCase):
except CommandExecutionError:
self.run_function("keychain.uninstall", [self.cert_alias])
@skipIf(True, "SLOWTEST skip")
def test_mac_keychain_get_friendly_name(self):
"""
Test that attempts to get friendly name of a cert
@ -100,6 +104,7 @@ class MacKeychainModuleTest(ModuleCase):
)
self.assertEqual(get_name, self.cert_alias)
@skipIf(True, "SLOWTEST skip")
def test_mac_keychain_get_default_keychain(self):
"""
Test that attempts to get the default keychain

View file

@ -16,6 +16,7 @@ from tests.support.helpers import destructiveTest, skip_if_not_root
# Import Salt Testing libs
from tests.support.runtests import RUNTIME_VARS
from tests.support.unit import skipIf
TEST_PKG_URL = (
"https://distfiles.macports.org/MacPorts/MacPorts-2.3.4-10.11-ElCapitan.pkg"
@ -57,6 +58,7 @@ class MacPkgutilModuleTest(ModuleCase):
self.run_function("pkgutil.forget", [TEST_PKG_NAME])
self.run_function("file.remove", ["/opt/local"])
@skipIf(True, "SLOWTEST skip")
def test_list(self):
"""
Test pkgutil.list
@ -64,6 +66,7 @@ class MacPkgutilModuleTest(ModuleCase):
self.assertIsInstance(self.run_function("pkgutil.list"), list)
self.assertIn(self.pkg_name, self.run_function("pkgutil.list"))
@skipIf(True, "SLOWTEST skip")
def test_is_installed(self):
"""
Test pkgutil.is_installed
@ -75,6 +78,7 @@ class MacPkgutilModuleTest(ModuleCase):
self.assertFalse(self.run_function("pkgutil.is_installed", ["spongebob"]))
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_install_forget(self):
"""
Test pkgutil.install

View file

@ -45,6 +45,7 @@ class MacPowerModuleTest(ModuleCase):
self.run_function("power.set_harddisk_sleep", [self.HARD_DISK_SLEEP])
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_computer_sleep(self):
"""
Test power.get_computer_sleep
@ -78,6 +79,7 @@ class MacPowerModuleTest(ModuleCase):
)
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_display_sleep(self):
"""
Test power.get_display_sleep
@ -111,6 +113,7 @@ class MacPowerModuleTest(ModuleCase):
)
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_harddisk_sleep(self):
"""
Test power.get_harddisk_sleep
@ -143,6 +146,7 @@ class MacPowerModuleTest(ModuleCase):
self.run_function("power.set_harddisk_sleep", [True]),
)
@skipIf(True, "SLOWTEST skip")
def test_restart_freeze(self):
"""
Test power.get_restart_freeze
@ -189,6 +193,7 @@ class MacPowerModuleTestSleepOnPowerButton(ModuleCase):
if self.SLEEP_ON_BUTTON is not None:
self.run_function("power.set_sleep_on_power_button", [self.SLEEP_ON_BUTTON])
@skipIf(True, "SLOWTEST skip")
def test_sleep_on_power_button(self):
"""
Test power.get_sleep_on_power_button

View file

@ -45,6 +45,7 @@ class MacServiceModuleTest(ModuleCase):
self.run_function("service.stop", [self.SERVICE_NAME])
self.run_function("service.disable", [self.SERVICE_NAME])
@skipIf(True, "SLOWTEST skip")
def test_show(self):
"""
Test service.show
@ -59,6 +60,7 @@ class MacServiceModuleTest(ModuleCase):
"Service not found", self.run_function("service.show", ["spongebob"])
)
@skipIf(True, "SLOWTEST skip")
def test_launchctl(self):
"""
Test service.launchctl
@ -80,6 +82,7 @@ class MacServiceModuleTest(ModuleCase):
self.run_function("service.launchctl", ["error", "bootstrap"]),
)
@skipIf(True, "SLOWTEST skip")
def test_list(self):
"""
Test service.list
@ -96,6 +99,7 @@ class MacServiceModuleTest(ModuleCase):
)
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_enable(self):
"""
Test service.enable
@ -107,6 +111,7 @@ class MacServiceModuleTest(ModuleCase):
)
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_disable(self):
"""
Test service.disable
@ -118,6 +123,7 @@ class MacServiceModuleTest(ModuleCase):
)
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_start(self):
"""
Test service.start
@ -131,6 +137,7 @@ class MacServiceModuleTest(ModuleCase):
)
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_stop(self):
"""
Test service.stop
@ -142,6 +149,7 @@ class MacServiceModuleTest(ModuleCase):
)
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_status(self):
"""
Test service.status
@ -159,6 +167,7 @@ class MacServiceModuleTest(ModuleCase):
# Service not found
self.assertEqual("", self.run_function("service.status", ["spongebob"]))
@skipIf(True, "SLOWTEST skip")
def test_available(self):
"""
Test service.available
@ -166,6 +175,7 @@ class MacServiceModuleTest(ModuleCase):
self.assertTrue(self.run_function("service.available", [self.SERVICE_NAME]))
self.assertFalse(self.run_function("service.available", ["spongebob"]))
@skipIf(True, "SLOWTEST skip")
def test_missing(self):
"""
Test service.missing
@ -174,6 +184,7 @@ class MacServiceModuleTest(ModuleCase):
self.assertTrue(self.run_function("service.missing", ["spongebob"]))
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_enabled(self):
"""
Test service.enabled
@ -187,6 +198,7 @@ class MacServiceModuleTest(ModuleCase):
self.assertFalse(self.run_function("service.enabled", ["spongebob"]))
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_disabled(self):
"""
Test service.disabled
@ -201,6 +213,7 @@ class MacServiceModuleTest(ModuleCase):
self.assertFalse(self.run_function("service.disabled", ["spongebob"]))
@skipIf(True, "SLOWTEST skip")
def test_get_all(self):
"""
Test service.get_all
@ -209,6 +222,7 @@ class MacServiceModuleTest(ModuleCase):
self.assertIsInstance(services, list)
self.assertIn(self.SERVICE_NAME, services)
@skipIf(True, "SLOWTEST skip")
def test_get_enabled(self):
"""
Test service.get_enabled

View file

@ -55,6 +55,7 @@ class MacShadowModuleTest(ModuleCase):
"""
self.run_function("user.delete", [TEST_USER])
@skipIf(True, "SLOWTEST skip")
def test_info(self):
"""
Test shadow.info
@ -68,6 +69,7 @@ class MacShadowModuleTest(ModuleCase):
self.assertEqual(ret["name"], "")
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_get_account_created(self):
"""
Test shadow.get_account_created
@ -85,6 +87,7 @@ class MacShadowModuleTest(ModuleCase):
)
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_get_last_change(self):
"""
Test shadow.get_last_change
@ -102,6 +105,7 @@ class MacShadowModuleTest(ModuleCase):
)
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_get_login_failed_last(self):
"""
Test shadow.get_login_failed_last
@ -119,6 +123,7 @@ class MacShadowModuleTest(ModuleCase):
)
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_get_login_failed_count(self):
"""
Test shadow.get_login_failed_count
@ -135,6 +140,7 @@ class MacShadowModuleTest(ModuleCase):
)
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_get_set_maxdays(self):
"""
Test shadow.get_maxdays
@ -155,6 +161,7 @@ class MacShadowModuleTest(ModuleCase):
)
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_get_set_change(self):
"""
Test shadow.get_change
@ -179,6 +186,7 @@ class MacShadowModuleTest(ModuleCase):
)
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_get_set_expire(self):
"""
Test shadow.get_expire
@ -203,6 +211,7 @@ class MacShadowModuleTest(ModuleCase):
)
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_del_password(self):
"""
Test shadow.del_password
@ -218,6 +227,7 @@ class MacShadowModuleTest(ModuleCase):
)
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_set_password(self):
"""
Test shadow.set_password

View file

@ -60,6 +60,7 @@ class MacSoftwareUpdateModuleTest(ModuleCase):
super(MacSoftwareUpdateModuleTest, self).tearDown()
@skipIf(True, "SLOWTEST skip")
def test_list_available(self):
"""
Test softwareupdate.list_available
@ -69,6 +70,7 @@ class MacSoftwareUpdateModuleTest(ModuleCase):
self.assertIsInstance(self.run_function("softwareupdate.list_available"), dict)
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_ignore(self):
"""
Test softwareupdate.ignore
@ -88,6 +90,7 @@ class MacSoftwareUpdateModuleTest(ModuleCase):
self.assertIn("squidward", self.run_function("softwareupdate.list_ignored"))
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_schedule(self):
"""
Test softwareupdate.schedule_enable
@ -102,6 +105,7 @@ class MacSoftwareUpdateModuleTest(ModuleCase):
self.assertFalse(self.run_function("softwareupdate.schedule_enabled"))
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_update(self):
"""
Test softwareupdate.update_all
@ -126,6 +130,7 @@ class MacSoftwareUpdateModuleTest(ModuleCase):
self.run_function("softwareupdate.update", ["spongebob"]),
)
@skipIf(True, "SLOWTEST skip")
def test_list_downloads(self):
"""
Test softwareupdate.list_downloads
@ -133,6 +138,7 @@ class MacSoftwareUpdateModuleTest(ModuleCase):
self.assertIsInstance(self.run_function("softwareupdate.list_downloads"), list)
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_download(self):
"""
Test softwareupdate.download
@ -147,6 +153,7 @@ class MacSoftwareUpdateModuleTest(ModuleCase):
)
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_download_all(self):
"""
Test softwareupdate.download_all
@ -154,6 +161,7 @@ class MacSoftwareUpdateModuleTest(ModuleCase):
self.assertIsInstance(self.run_function("softwareupdate.download_all"), list)
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_get_set_reset_catalog(self):
"""
Test softwareupdate.download_all

View file

@ -16,6 +16,7 @@ from salt.exceptions import CommandExecutionError
# Import Salt Testing Libs
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, skip_if_not_root
from tests.support.unit import skipIf
# Module Variables
ASSIGN_CMD = "net.inet.icmp.icmplim"
@ -52,6 +53,7 @@ class DarwinSysctlModuleTest(ModuleCase):
raise CommandExecutionError(msg.format(CONFIG))
os.remove(CONFIG)
@skipIf(True, "SLOWTEST skip")
def test_assign(self):
"""
Tests assigning a single sysctl parameter
@ -71,6 +73,7 @@ class DarwinSysctlModuleTest(ModuleCase):
self.run_function("sysctl.assign", [ASSIGN_CMD, self.val])
raise
@skipIf(True, "SLOWTEST skip")
def test_persist_new_file(self):
"""
Tests assigning a sysctl value to a system without a sysctl.conf file
@ -87,6 +90,7 @@ class DarwinSysctlModuleTest(ModuleCase):
os.remove(CONFIG)
raise
@skipIf(True, "SLOWTEST skip")
def test_persist_already_set(self):
"""
Tests assigning a sysctl value that is already set in sysctl.conf file
@ -102,6 +106,7 @@ class DarwinSysctlModuleTest(ModuleCase):
os.remove(CONFIG)
raise
@skipIf(True, "SLOWTEST skip")
def test_persist_apply_change(self):
"""
Tests assigning a sysctl value and applying the change to system

View file

@ -81,6 +81,7 @@ class MacSystemModuleTest(ModuleCase):
)
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_get_set_remote_login(self):
"""
Test system.get_remote_login
@ -109,6 +110,7 @@ class MacSystemModuleTest(ModuleCase):
)
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_get_set_remote_events(self):
"""
Test system.get_remote_events
@ -137,6 +139,7 @@ class MacSystemModuleTest(ModuleCase):
)
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_get_set_subnet_name(self):
"""
Test system.get_subnet_name
@ -145,6 +148,7 @@ class MacSystemModuleTest(ModuleCase):
self.assertTrue(self.run_function("system.set_subnet_name", [SET_SUBNET_NAME]))
self.assertEqual(self.run_function("system.get_subnet_name"), SET_SUBNET_NAME)
@skipIf(True, "SLOWTEST skip")
def test_get_list_startup_disk(self):
"""
Test system.get_startup_disk
@ -181,6 +185,7 @@ class MacSystemModuleTest(ModuleCase):
self.run_function("system.set_restart_delay", [70]),
)
@skipIf(True, "SLOWTEST skip")
def test_get_set_disable_keyboard_on_lock(self):
"""
Test system.get_disable_keyboard_on_lock
@ -262,6 +267,7 @@ class MacSystemComputerNameTest(ModuleCase):
# investigate
# @skipIf(salt.utils.platform.is_darwin() and six.PY3, 'This test hangs on OS X on Py3. Skipping until #53566 is merged.')
@destructiveTest
@skipIf(True, "SLOWTEST skip")
def test_get_set_computer_name(self):
"""
Test system.get_computer_name

View file

@ -90,6 +90,7 @@ class MacTimezoneModuleTest(ModuleCase):
"Invalid Date/Time Format: 13/12/2014",
)
@skipIf(True, "SLOWTEST skip")
def test_get_time(self):
"""
Test timezone.get_time
@ -180,6 +181,7 @@ class MacTimezoneModuleTest(ModuleCase):
)
self.assertEqual(self.run_function("timezone.get_zonecode"), "WAKT")
@skipIf(True, "SLOWTEST skip")
def test_list_zones(self):
"""
Test timezone.list_zones

View file

@ -23,6 +23,7 @@ from salt.ext.six.moves import range # pylint: disable=import-error,redefined-b
# Import Salt Testing Libs
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, skip_if_not_root
from tests.support.unit import skipIf
def __random_string(size=6):
@ -57,6 +58,7 @@ class MacUserModuleTest(ModuleCase):
if os_grain["kernel"] not in "Darwin":
self.skipTest("Test not applicable to '{kernel}' kernel".format(**os_grain))
@skipIf(True, "SLOWTEST skip")
def test_mac_user_add(self):
"""
Tests the add function
@ -69,6 +71,7 @@ class MacUserModuleTest(ModuleCase):
self.run_function("user.delete", [ADD_USER])
raise
@skipIf(True, "SLOWTEST skip")
def test_mac_user_delete(self):
"""
Tests the delete function
@ -83,6 +86,7 @@ class MacUserModuleTest(ModuleCase):
ret = self.run_function("user.delete", [DEL_USER])
self.assertTrue(ret)
@skipIf(True, "SLOWTEST skip")
def test_mac_user_primary_group(self):
"""
Tests the primary_group function
@ -105,6 +109,7 @@ class MacUserModuleTest(ModuleCase):
self.run_function("user.delete", [PRIMARY_GROUP_USER])
raise
@skipIf(True, "SLOWTEST skip")
def test_mac_user_changes(self):
"""
Tests mac_user functions that change user properties
@ -149,6 +154,7 @@ class MacUserModuleTest(ModuleCase):
self.run_function("user.delete", [CHANGE_USER])
raise
@skipIf(True, "SLOWTEST skip")
def test_mac_user_enable_auto_login(self):
"""
Tests mac_user functions that enable auto login
@ -201,6 +207,7 @@ class MacUserModuleTest(ModuleCase):
if self.run_function("user.get_auto_login"):
raise Exception("Failed to disable auto login")
@skipIf(True, "SLOWTEST skip")
def test_mac_user_disable_auto_login(self):
"""
Tests mac_user functions that disable auto login

View file

@ -15,6 +15,7 @@ from tests.support.case import ModuleCase
# Import Salt Testing libs
from tests.support.runtests import RUNTIME_VARS
from tests.support.unit import skipIf
class MacXattrModuleTest(ModuleCase):
@ -46,6 +47,7 @@ class MacXattrModuleTest(ModuleCase):
if os.path.exists(self.test_file):
os.remove(self.test_file)
@skipIf(True, "SLOWTEST skip")
def test_list_no_xattr(self):
"""
Make sure there are no attributes
@ -62,6 +64,7 @@ class MacXattrModuleTest(ModuleCase):
"ERROR: File not found: {0}".format(self.no_file),
)
@skipIf(True, "SLOWTEST skip")
def test_write(self):
"""
Write an attribute
@ -94,6 +97,7 @@ class MacXattrModuleTest(ModuleCase):
"ERROR: File not found: {0}".format(self.no_file),
)
@skipIf(True, "SLOWTEST skip")
def test_read(self):
"""
Test xattr.read
@ -126,6 +130,7 @@ class MacXattrModuleTest(ModuleCase):
"ERROR: Attribute not found: patrick",
)
@skipIf(True, "SLOWTEST skip")
def test_delete(self):
"""
Test xattr.delete
@ -169,6 +174,7 @@ class MacXattrModuleTest(ModuleCase):
"ERROR: Attribute not found: patrick",
)
@skipIf(True, "SLOWTEST skip")
def test_clear(self):
"""
Test xattr.clear

View file

@ -11,6 +11,7 @@ import pytest
import salt.utils.platform
from tests.support.case import ModuleCase, ShellCase
from tests.support.runtests import RUNTIME_VARS
from tests.support.unit import skipIf
@pytest.mark.windows_whitelisted
@ -25,6 +26,7 @@ class MineTest(ModuleCase, ShellCase):
self.tgt = "*"
self.wait_for_all_jobs()
@skipIf(True, "SLOWTEST skip")
def test_get(self):
"""
test mine.get and mine.update
@ -35,6 +37,7 @@ class MineTest(ModuleCase, ShellCase):
# mine.update will return True
self.assertTrue(self.run_function("mine.get", ["minion", "test.ping"]))
@skipIf(True, "SLOWTEST skip")
def test_get_allow_tgt(self):
"""
test mine.get and mine.update using allow_tgt
@ -53,6 +56,7 @@ class MineTest(ModuleCase, ShellCase):
min_ret = self.run_call("mine.get {0} test.arg".format(self.tgt))
assert " - isn't" not in min_ret
@skipIf(True, "SLOWTEST skip")
def test_send_allow_tgt(self):
"""
test mine.send with allow_tgt set
@ -76,6 +80,7 @@ class MineTest(ModuleCase, ShellCase):
# ensure we did not get the mine_name mine function for minion
assert " - one" not in min_ret
@skipIf(True, "SLOWTEST skip")
def test_send_allow_tgt_compound(self):
"""
test mine.send with allow_tgt set
@ -100,6 +105,7 @@ class MineTest(ModuleCase, ShellCase):
for ret in [min_ret, sub_ret]:
assert " - one" in ret
@skipIf(True, "SLOWTEST skip")
def test_send_allow_tgt_doesnotexist(self):
"""
test mine.send with allow_tgt set when
@ -124,6 +130,7 @@ class MineTest(ModuleCase, ShellCase):
for ret in [sub_ret, min_ret]:
assert " - one" not in ret
@skipIf(True, "SLOWTEST skip")
def test_send(self):
"""
test mine.send
@ -142,6 +149,7 @@ class MineTest(ModuleCase, ShellCase):
)
self.assertEqual(ret["minion"]["id"], "minion")
@skipIf(True, "SLOWTEST skip")
def test_mine_flush(self):
"""
Test mine.flush
@ -166,6 +174,7 @@ class MineTest(ModuleCase, ShellCase):
self.assertEqual(ret_flushed.get("minion", None), None)
self.assertEqual(ret_flushed["sub_minion"]["id"], "sub_minion")
@skipIf(True, "SLOWTEST skip")
def test_mine_delete(self):
"""
Test mine.delete

View file

@ -17,6 +17,7 @@ class NetworkTest(ModuleCase):
Validate network module
"""
@skipIf(True, "SLOWTEST skip")
def test_network_ping(self):
"""
network.ping
@ -27,6 +28,7 @@ class NetworkTest(ModuleCase):
self.assertIn(out, ret.lower())
@skipIf(salt.utils.platform.is_darwin(), "not supported on macosx")
@skipIf(True, "SLOWTEST skip")
def test_network_netstat(self):
"""
network.netstat
@ -37,6 +39,7 @@ class NetworkTest(ModuleCase):
for out in exp_out:
self.assertIn(out, val)
@skipIf(True, "SLOWTEST skip")
def test_network_traceroute(self):
"""
network.traceroute
@ -52,6 +55,7 @@ class NetworkTest(ModuleCase):
self.assertIn(out, exp_out)
@skipIf(not salt.utils.platform.is_windows(), "windows only test")
@skipIf(True, "SLOWTEST skip")
def test_network_nslookup(self):
"""
network.nslookup

View file

@ -5,6 +5,7 @@ from __future__ import absolute_import, print_function, unicode_literals
import pytest
from tests.support.case import ModuleCase
from tests.support.runtests import RUNTIME_VARS
from tests.support.unit import skipIf
@pytest.mark.windows_whitelisted
@ -13,6 +14,7 @@ class PillarModuleTest(ModuleCase):
Validate the pillar module
"""
@skipIf(True, "SLOWTEST skip")
def test_data(self):
"""
pillar.data
@ -26,6 +28,7 @@ class PillarModuleTest(ModuleCase):
else:
self.assertEqual(pillar["class"], "other")
@skipIf(True, "SLOWTEST skip")
def test_issue_5449_report_actual_file_roots_in_pillar(self):
"""
pillar['master']['file_roots'] is overwritten by the master
@ -38,18 +41,21 @@ class PillarModuleTest(ModuleCase):
self.run_function("pillar.data")["master"]["file_roots"]["base"],
)
@skipIf(True, "SLOWTEST skip")
def test_ext_cmd_yaml(self):
"""
pillar.data for ext_pillar cmd.yaml
"""
self.assertEqual(self.run_function("pillar.data")["ext_spam"], "eggs")
@skipIf(True, "SLOWTEST skip")
def test_issue_5951_actual_file_roots_in_opts(self):
self.assertIn(
RUNTIME_VARS.TMP_STATE_TREE,
self.run_function("pillar.data")["ext_pillar_opts"]["file_roots"]["base"],
)
@skipIf(True, "SLOWTEST skip")
def test_pillar_items(self):
"""
Test to ensure we get expected output
@ -61,6 +67,7 @@ class PillarModuleTest(ModuleCase):
{"knights": ["Lancelot", "Galahad", "Bedevere", "Robin"]}, get_items
)
@skipIf(True, "SLOWTEST skip")
def test_pillar_command_line(self):
"""
Test to ensure when using pillar override

View file

@ -111,6 +111,7 @@ class PipModuleTest(ModuleCase):
return expect.issubset(set(success_for))
@skipIf(True, "SLOWTEST skip")
def test_issue_2087_missing_pip(self):
# Let's create the testing virtualenv
self._create_virtualenv(self.venv_dir)
@ -142,6 +143,7 @@ class PipModuleTest(ModuleCase):
ret,
)
@skipIf(True, "SLOWTEST skip")
def test_requirements_as_list_of_chains__cwd_set__absolute_file_path(self):
self._create_virtualenv(self.venv_dir)
@ -187,6 +189,7 @@ class PipModuleTest(ModuleCase):
)
)
@skipIf(True, "SLOWTEST skip")
def test_requirements_as_list_of_chains__cwd_not_set__absolute_file_path(self):
self._create_virtualenv(self.venv_dir)
@ -230,6 +233,7 @@ class PipModuleTest(ModuleCase):
)
)
@skipIf(True, "SLOWTEST skip")
def test_requirements_as_list__absolute_file_path(self):
self._create_virtualenv(self.venv_dir)
@ -265,6 +269,7 @@ class PipModuleTest(ModuleCase):
)
)
@skipIf(True, "SLOWTEST skip")
def test_requirements_as_list__non_absolute_file_path(self):
self._create_virtualenv(self.venv_dir)
@ -309,6 +314,7 @@ class PipModuleTest(ModuleCase):
)
)
@skipIf(True, "SLOWTEST skip")
def test_chained_requirements__absolute_file_path(self):
self._create_virtualenv(self.venv_dir)
@ -342,6 +348,7 @@ class PipModuleTest(ModuleCase):
)
)
@skipIf(True, "SLOWTEST skip")
def test_chained_requirements__non_absolute_file_path(self):
self._create_virtualenv(self.venv_dir)
@ -382,6 +389,7 @@ class PipModuleTest(ModuleCase):
)
)
@skipIf(True, "SLOWTEST skip")
def test_issue_4805_nested_requirements(self):
self._create_virtualenv(self.venv_dir)
@ -419,6 +427,7 @@ class PipModuleTest(ModuleCase):
)
)
@skipIf(True, "SLOWTEST skip")
def test_pip_uninstall(self):
# Let's create the testing virtualenv
self._create_virtualenv(self.venv_dir)
@ -461,6 +470,7 @@ class PipModuleTest(ModuleCase):
)
)
@skipIf(True, "SLOWTEST skip")
def test_pip_install_upgrade(self):
# Create the testing virtualenv
self._create_virtualenv(self.venv_dir)
@ -527,6 +537,7 @@ class PipModuleTest(ModuleCase):
)
)
@skipIf(True, "SLOWTEST skip")
def test_pip_install_multiple_editables(self):
editables = [
"git+https://github.com/jek/blinker.git#egg=Blinker",
@ -561,6 +572,7 @@ class PipModuleTest(ModuleCase):
)
)
@skipIf(True, "SLOWTEST skip")
def test_pip_install_multiple_editables_and_pkgs(self):
editables = [
"git+https://github.com/jek/blinker.git#egg=Blinker",

View file

@ -46,6 +46,7 @@ class PkgModuleTest(ModuleCase, SaltReturnAssertsMixin):
self.ctx["refresh"] = True
@requires_salt_modules("pkg.list_pkgs")
@skipIf(True, "SLOWTEST skip")
def test_list(self):
"""
verify that packages are installed
@ -55,6 +56,7 @@ class PkgModuleTest(ModuleCase, SaltReturnAssertsMixin):
@requires_salt_modules("pkg.version_cmp")
@requires_system_grains
@skipIf(True, "SLOWTEST skip")
def test_version_cmp(self, grains):
"""
test package version comparison on supported platforms
@ -81,6 +83,7 @@ class PkgModuleTest(ModuleCase, SaltReturnAssertsMixin):
@requires_salt_modules("pkg.mod_repo", "pkg.del_repo", "pkg.get_repo")
@requires_network()
@requires_system_grains
@skipIf(True, "SLOWTEST skip")
def test_mod_del_repo(self, grains):
"""
test modifying and deleting a software repository
@ -142,6 +145,7 @@ class PkgModuleTest(ModuleCase, SaltReturnAssertsMixin):
if repo is not None:
self.run_function("pkg.del_repo", [repo])
@skipIf(True, "SLOWTEST skip")
def test_mod_del_repo_multiline_values(self):
"""
test modifying and deleting a software repository defined with multiline values
@ -215,6 +219,7 @@ class PkgModuleTest(ModuleCase, SaltReturnAssertsMixin):
@destructiveTest
@requires_salt_modules("pkg.version", "pkg.install", "pkg.remove")
@requires_network()
@skipIf(True, "SLOWTEST skip")
def test_install_remove(self):
"""
successfully install and uninstall a package
@ -251,6 +256,7 @@ class PkgModuleTest(ModuleCase, SaltReturnAssertsMixin):
@requires_salt_states("pkg.installed")
@requires_network()
@requires_system_grains
@skipIf(True, "SLOWTEST skip")
def test_hold_unhold(self, grains):
"""
test holding and unholding a package
@ -297,6 +303,7 @@ class PkgModuleTest(ModuleCase, SaltReturnAssertsMixin):
@requires_salt_modules("pkg.refresh_db")
@requires_network()
@requires_system_grains
@skipIf(True, "SLOWTEST skip")
def test_refresh_db(self, grains):
"""
test refreshing the package database
@ -328,6 +335,7 @@ class PkgModuleTest(ModuleCase, SaltReturnAssertsMixin):
@requires_salt_modules("pkg.info_installed")
@requires_system_grains
@skipIf(True, "SLOWTEST skip")
def test_pkg_info(self, grains):
"""
Test returning useful information on Ubuntu systems.
@ -364,6 +372,7 @@ class PkgModuleTest(ModuleCase, SaltReturnAssertsMixin):
"pkg.list_upgrades",
)
@requires_system_grains
@skipIf(True, "SLOWTEST skip")
def test_pkg_upgrade_has_pending_upgrades(self, grains):
"""
Test running a system upgrade when there are packages that need upgrading
@ -442,6 +451,7 @@ class PkgModuleTest(ModuleCase, SaltReturnAssertsMixin):
@requires_salt_modules("pkg.remove", "pkg.latest_version")
@requires_salt_states("pkg.removed")
@requires_system_grains
@skipIf(True, "SLOWTEST skip")
def test_pkg_latest_version(self, grains):
"""
Check that pkg.latest_version returns the latest version of the uninstalled package.

View file

@ -5,6 +5,7 @@ from __future__ import absolute_import, print_function, unicode_literals
import pytest
from tests.support.case import ModuleCase
from tests.support.mixins import SaltReturnAssertsMixin
from tests.support.unit import skipIf
@pytest.mark.windows_whitelisted
@ -13,6 +14,7 @@ class PublishModuleTest(ModuleCase, SaltReturnAssertsMixin):
Validate the publish module
"""
@skipIf(True, "SLOWTEST skip")
def test_publish(self):
"""
publish.publish
@ -50,6 +52,7 @@ class PublishModuleTest(ModuleCase, SaltReturnAssertsMixin):
self.assertEqual(ret["__pub_id"], "minion")
self.assertEqual(ret["__pub_fun"], "test.kwarg")
@skipIf(True, "SLOWTEST skip")
def test_publish_yaml_args(self):
"""
test publish.publish yaml args formatting
@ -86,6 +89,7 @@ class PublishModuleTest(ModuleCase, SaltReturnAssertsMixin):
self.assertEqual(ret["kwargs"]["__pub_id"], "minion")
self.assertEqual(ret["kwargs"]["__pub_fun"], "test.arg")
@skipIf(True, "SLOWTEST skip")
def test_full_data(self):
"""
publish.full_data
@ -96,6 +100,7 @@ class PublishModuleTest(ModuleCase, SaltReturnAssertsMixin):
self.assertTrue(ret)
self.assertEqual(ret["minion"]["ret"][0], 6765)
@skipIf(True, "SLOWTEST skip")
def test_kwarg(self):
"""
Verify that the pub data is making it to the minion functions
@ -133,6 +138,7 @@ class PublishModuleTest(ModuleCase, SaltReturnAssertsMixin):
)
self.assertIn("The following keyword arguments are not valid", ret)
@skipIf(True, "SLOWTEST skip")
def test_reject_minion(self):
"""
Test bad authentication

View file

@ -7,6 +7,7 @@ from __future__ import absolute_import, print_function, unicode_literals
# Import Salt Testing libs
from tests.support.case import ModuleCase
from tests.support.unit import skipIf
class SaltcheckModuleTest(ModuleCase):
@ -14,6 +15,7 @@ class SaltcheckModuleTest(ModuleCase):
Test the saltcheck module
"""
@skipIf(True, "SLOWTEST skip")
def test_saltcheck_run(self):
"""
saltcheck.run_test
@ -27,6 +29,7 @@ class SaltcheckModuleTest(ModuleCase):
ret = self.run_function("saltcheck.run_test", test=saltcheck_test)
self.assertDictContainsSubset({"status": "Pass"}, ret)
@skipIf(True, "SLOWTEST skip")
def test_saltcheck_state(self):
"""
saltcheck.run_state_tests
@ -37,6 +40,7 @@ class SaltcheckModuleTest(ModuleCase):
{"status": "Pass"}, ret[0]["validate-saltcheck"]["echo_test_hello"]
)
@skipIf(True, "SLOWTEST skip")
def test_topfile_validation(self):
"""
saltcheck.run_highstate_tests
@ -47,6 +51,7 @@ class SaltcheckModuleTest(ModuleCase):
for top_state_dict in ret:
self.assertIn(list(top_state_dict)[0], expected_top_states)
@skipIf(True, "SLOWTEST skip")
def test_saltcheck_checkall(self):
"""
Validate saltcheck.run_state_tests check_all for the default saltenv of base.
@ -64,6 +69,7 @@ class SaltcheckModuleTest(ModuleCase):
{"status": "Pass"}, ret[0]["validate-saltcheck"]["check_all_validate"]
)
@skipIf(True, "SLOWTEST skip")
def test_saltcheck_checkall_saltenv(self):
"""
Validate saltcheck.run_state_tests check_all for the prod saltenv

Some files were not shown because too many files have changed in this diff Show more