Commit graph

65 commits

Author SHA1 Message Date
Pedro Algarvio
c920ba443d
Remove all kitchen and jenkins related resources
The salt-project hasn't been using them for a very long time.
2024-02-29 10:27:02 +00:00
Pedro Algarvio
8c56caec7b Migrate tests/integration/ssh/test_jinja_filters.py to pytest
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-08-28 10:27:00 +01:00
Pedro Algarvio
b767b52b16 Migrate tests/integration/modules/test_state_jinja_filters.py to functional
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-08-26 11:40:34 -07:00
Pedro Algarvio
e931632b23 Migrate `tests/integration/netapi/test_client.py` to Pytest 2022-06-13 13:14:51 -06:00
Pedro Algarvio
7c905ac7b0 Migrate `rest_cherrypy` tests to pytest 2022-06-13 13:14:51 -06:00
Pedro Algarvio
5bfbc6d60e Switch cache functional tests to the new container support code in salt-factories
Additionally, split the tests into their own modules and clean up unused, or
no longer necessary code.

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-06-02 07:05:09 -06:00
Pedro Algarvio
a9d5e75b52 Add the new refactored salt logging.
It also handles multiprocessing logging.
2022-04-12 09:46:02 -04:00
Pedro Algarvio
df7d64b921 Stop using `pytest.helpers.loader_mock()` under pytest
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-04-07 15:59:29 -04:00
Pedro Algarvio
76e50885b0 Fix strings 2021-08-06 13:09:47 -07:00
Megan Wilhite
90ed88638a
Merge freeze into master (#60396)
* Merge 3002.6 bugfix changes (#59822)

* Pass `CI_RUN` as an environment variable to the test run.

This allows us to know if we're running the test suite under a CI
environment or not and adapt/adjust if needed

* Migrate `unit.setup` to PyTest

* Backport ae36b15 just for test_install.py

* Only skip tests on CI runs

* Always store git sha in _version.py during installation

* Fix PEP440 compliance.

The wheel metadata version 1.2 states that the package version MUST be
PEP440 compliant.

This means that instead of `3002.2-511-g033c53eccb`, the salt version
string should look like `3002.2+511.g033c53eccb`, a post release of
`3002.2` ahead by 511 commits with the git sha `033c53eccb`

* Fix and migrate `tests/unit/test_version.py` to PyTest

* Skip test if `easy_install` is not available

* We also need to be PEP440 compliant when there's no git history

* Allow extra_filerefs as sanitized kwargs for SSH client

* Fix regression on cmd.run when passing tuples as cmd

Co-authored-by: Alexander Graul <agraul@suse.com>

* Add unit tests to ensure cmd.run accepts tuples

* Add unit test to check for extra_filerefs on SSH opts

* Add changelog file

* Fix comment for test case

* Fix unit test to avoid failing on Windows

* Skip failing test on windows

* Fix test to work on Windows

* Add all ssh kwargs to sanitize_kwargs method

* Run pre-commit

* Fix pylint

* Fix cmdmod loglevel and module_names tests

* Fix pre-commit

* Skip ssh tests if binary does not exist

* Use setup_loader for cmdmod test

* Prevent argument injection in restartcheck

* Add changelog for restartcheck fix

* docs_3002.6

* Add back tests removed in merge

Co-authored-by: Pedro Algarvio <pedro@algarvio.me>
Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com>
Co-authored-by: Bryce Larson <brycel@vmware.com>
Co-authored-by: Pablo Suárez Hernández <psuarezhernandez@suse.com>
Co-authored-by: Alexander Graul <agraul@suse.com>
Co-authored-by: Frode Gundersen <fgundersen@saltstack.com>

* Remove glance state module in favor of glance_image

* update wording in changelog

* bump deprecation warning to Silicon.

* Updating warnutil version to Phosphorous.

* Update salt/modules/keystone.py

Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com>

* Check $HOMEBREW_PREFIX when linking against libcrypto

When loading `libcrypto`, Salt checks for a Homebrew installation of `openssl`
at Homebrew's default prefix of `/usr/local`. However, on Apple Silicon Macs,
Homebrew's default installation prefix is `/opt/homebrew`. On all platforms,
the prefix is configurable.  If Salt doesn't find one of those `libcrypto`s,
it will fall back on the un-versioned `/usr/lib/libcrypto.dylib`, which will
cause the following crash:

    Application Specific Information:
    /usr/lib/libcrypto.dylib
    abort() called
    Invalid dylib load. Clients should not load the unversioned libcrypto dylib as it does not have a stable ABI.

This commit checks $HOMEBREW_PREFIX instead of hard-coding `/usr/local`.

* Add test case

* Add changelog for 59808

* Add changelog entry

* Make _find_libcrypto fail on Big Sur if it can't find a library

Right now, if `_find_libcrypto` can't find any externally-managed versions of
libcrypto, it will fall back on the pre-Catalina un-versioned system libcrypto.
This does not exist on Big Sur and it would be better to raise an exception
here rather than crashing later when trying to open it.

* Update _find_libcrypto tests

This commit simplifies the unit tests for _find_libcrypto by mocking out the
host's filesystem and testing the common libcrypto installations (brew, ports,
etc.) on Big Sur. It simplifies the tests for falling back on system versions
of libcrypto on previous versions of macOS.

* Fix description of test_find_libcrypto_with_system_before_catalina

* Patch sys.platform for test_rsax931 tests

* modules/match: add missing "minion_id" in Pillar example

The documented Pillar example for `match.filter_by` lacks the `minion_id` parameter. Without it, the assignment won't work as expected.
- fix documentation
- add tests:
  - to prove the misbehavior of the documented example
  - to prove the proper behaviour when supplying `minion_id`
  - to ensure some misbehaviour observed with compound matchers doesn't occur

* Fix for issue #59773

- When instantiating the loader grab values of grains and pillars if
  they are NamedLoaderContext instances.
- The loader uses a copy of opts.
- Impliment deepcopy on NamedLoaderContext instances.

* Add changelog for #59773

* _get_initial_pillar function returns pillar

* Fix linter issues

* Clean up test

* Bump deprecation release for neutron

* Uncomment Sulfur release name

* Removing the _ext_nodes deprecation warning and alias.

* Adding changelog.

* Renaming changelog file.

* Update 59804.removed

* Initial pass at fips_mode config option

* Fix pre-commit

* Fix tests and add changelog

* update docs 3003

* update docs 3003 - newline

* Fix warts in changelog

* update releasenotes 3003

* add ubuntu-2004-amd64 m2crypto pycryptodome and tcp tests

* add distro_arch

* changing the cloud platforms file missed in 1a9b7be0e2

* Update __utils__ calls to import utils in azure

* Add changelog for 59744

* Fix azure unit tests and move to pytest

* Use contextvars from site-packages for thin

If a contextvars package exists one of the site-packages locations use
it for the generated thin tarball. This overrides python's builtin
contextvars and allows salt-ssh to work with python <=3.6 even when the
master's python is >3.6 (Fixes #59942)

* Add regression test for #59942

* Add changelog for #59942

* Update filemap to include test_py_versions

* Fix broken thin tests

* Always install the `contextvars` backport, even on Py3.7+

Without this change, salt-ssh cannot target systems with Python <= 3.6

* Use salt-factories to handle the container. Don't override default roster

* Fix thin tests on windows

* No need to use warn log level here

* Fix getsitepackages for old virtualenv versions

* Add explicit pyobjc reqs

* Add back the passthrough stuff

* Remove a line so pre-commit will run

* Bugfix release docs

* Bugfix release docs

* Removing pip-compile log files

* Bump requirements to address a few security issues

* Address traceback on macOS

```
Traceback (most recent call last):
  File "setup.py", line 1448, in <module>
    setup(distclass=SaltDistribution)
  File "/Users/jenkins/setup-tests/.venv/lib/python3.7/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/opt/salt/lib/python3.7/distutils/core.py", line 108, in setup
    _setup_distribution = dist = klass(attrs)
  File "setup.py", line 1068, in __init__
    self.update_metadata()
  File "setup.py", line 1074, in update_metadata
    attrvalue = getattr(self, attrname, None)
  File "setup.py", line 1182, in _property_install_requires
    install_requires += _parse_requirements_file(reqfile)
  File "setup.py", line 270, in _parse_requirements_file
    platform.python_version(), _parse_op(op), _parse_ver(ver)
  File "setup.py", line 247, in _check_ver
    return getattr(operator, "__{}__".format(op))(pyver, wanted)
  File "/opt/salt/lib/python3.7/distutils/version.py", line 46, in __eq__
    c = self._cmp(other)
  File "/opt/salt/lib/python3.7/distutils/version.py", line 337, in _cmp
    if self.version < other.version:
TypeError: '<' not supported between instances of 'str' and 'int'
```

* Replace `saltstack.com` with `saltproject.io` on URLs being tested

* Add back support to load old entrypoints by iterating instead of type checking

Fixes #59961

* Fix issue #59975

* Fix pillar serialization for jinja #60083

* Fix test

* Add changelog for #60083

* Update changelog and release for 3003.1

* Remove the changelog source refs

* Add connect to IPCMessageSubscriber's async_methods

Fixes #60049 by making sure an IPCMessageSubscriber that is wrapped by
SyncWrapper has a connect method that runs the coroutine rather than
returns a fugure.

* Add changelog for #60049

* Update 60049.fixed

* Fix coroutine spelling error

Co-authored-by: Wayne Werner <waynejwerner@gmail.com>

* IPC on windows cannot use socket paths

Fixes #60298

* Update Jinja2 and lxml due to security related bugfix releases

Jinja2
------

CVE-2020-28493
moderate severity
Vulnerable versions: < 2.11.3
Patched version: 2.11.3

This affects the package jinja2 from 0.0.0 and before 2.11.3. The ReDOS vulnerability of the regex is mainly due to the sub-pattern [a-zA-Z0-9.-]+.[a-zA-Z0-9.-]+ This issue can be mitigated by Markdown to format user content instead of the urlize filter, or by implementing request timeouts and limiting process memory.

lxml
----

CVE-2021-28957
moderate severity
Vulnerable versions: < 4.6.3
Patched version: 4.6.3

An XSS vulnerability was discovered in the python lxml clean module versions before 4.6.3. When disabling the safe_attrs_only and forms arguments, the Cleaner class does not remove the formaction attribute allowing for JS to bypass the sanitizer. A remote attacker could exploit this flaw to run arbitrary JS code on users who interact with incorrectly sanitized HTML. This issue is patched in lxml 4.6.3.

* fix github actions jobs on branch until bullseye comes out

* Upgrade to `six==1.16.0` to avoid problems on CI runs

```
13:59:02  nox > Session invoke-pre-commit was successful.
13:59:02  nox > Running session invoke-pre-commit
13:59:02  nox > pip install --progress-bar=off -r requirements/static/ci/py3.7/invoke.txt
13:59:02  Collecting blessings==1.7
13:59:02    Using cached blessings-1.7-py3-none-any.whl (18 kB)
13:59:02  Collecting invoke==1.4.1
13:59:02    Using cached invoke-1.4.1-py3-none-any.whl (210 kB)
13:59:02  Collecting pyyaml==5.3.1
13:59:02    Using cached PyYAML-5.3.1.tar.gz (269 kB)
13:59:02  Collecting six==1.15.0
13:59:02    Using cached six-1.15.0-py2.py3-none-any.whl (10 kB)
13:59:02  Building wheels for collected packages: pyyaml
13:59:02    Building wheel for pyyaml (setup.py) ... - \ | / - \ | done
13:59:02    Created wheel for pyyaml: filename=PyYAML-5.3.1-cp37-cp37m-linux_x86_64.whl size=546391 sha256=e42e1d66cc32087f4d33ceb81268c86b59f1a97029b19459f91b8d6ad1430167
13:59:02    Stored in directory: /var/jenkins/.cache/pip/wheels/5e/03/1e/e1e954795d6f35dfc7b637fe2277bff021303bd9570ecea653
13:59:02  Successfully built pyyaml
13:59:02  Installing collected packages: six, pyyaml, invoke, blessings
13:59:02    Attempting uninstall: six
13:59:02      Found existing installation: six 1.16.0
13:59:02      Uninstalling six-1.16.0:
13:59:02  ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/var/jenkins/.cache/pre-commit/repomw8oee1s/py_env-python3/lib/python3.7/site-packages/__pycache__/six.cpython-37.pyc'
13:59:02
13:59:02  nox > Command pip install --progress-bar=off -r requirements/static/ci/py3.7/invoke.txt failed with exit code 1
13:59:02  nox > Session invoke-pre-commit failed.
```

* add changelog for https://github.com/saltstack/salt/issues/59982

* Regression test for #56273

* Fix race condition in batch. #56273

* Add changelog for #56273

* Update salt/client/__init__.py

Co-authored-by: Pedro Algarvio <pedro@algarvio.me>

* Update doc for salt/client

* Update changelog/56273.fixed

Thoreau said, "Simplify, Simplify"

* Update docs

* Update docs

* Update CHANGELOG.md

* Update 3003.1.rst

* Fix changelog

Co-authored-by: Daniel Wozniak <dwozniak@saltstack.com>
Co-authored-by: Pedro Algarvio <pedro@algarvio.me>
Co-authored-by: Bryce Larson <brycel@vmware.com>
Co-authored-by: Pablo Suárez Hernández <psuarezhernandez@suse.com>
Co-authored-by: Alexander Graul <agraul@suse.com>
Co-authored-by: Frode Gundersen <fgundersen@saltstack.com>
Co-authored-by: Gareth J. Greenaway <gareth@saltstack.com>
Co-authored-by: Gareth J. Greenaway <gareth@wiked.org>
Co-authored-by: Hoa-Long Tam <hoalong@apple.com>
Co-authored-by: krionbsd <krion@freebsd.org>
Co-authored-by: Elias Probst <e.probst@ssc-services.de>
Co-authored-by: Daniel A. Wozniak <dwozniak@vmware.com>
Co-authored-by: Frode Gundersen <frogunder@gmail.com>
Co-authored-by: twangboy <slee@saltstack.com>
Co-authored-by: twangboy <leesh@vmware.com>
Co-authored-by: ScriptAutomate <derek@icanteven.io>
Co-authored-by: Wayne Werner <waynejwerner@gmail.com>
2021-06-23 12:46:52 -04:00
Gareth J. Greenaway
55b48783c0 Updating the add, delete, modify, enable_job, and disable_job functions to return appropriate changes. Moving all scheduler tests to pytest. 2021-05-05 14:23:04 -04:00
Daniel Wozniak
0b5a3536c5
Merge 3003 changes forward to the master branch (#59879)
* Merge 3002.6 bugfix changes (#59822)

* Pass `CI_RUN` as an environment variable to the test run.

This allows us to know if we're running the test suite under a CI
environment or not and adapt/adjust if needed

* Migrate `unit.setup` to PyTest

* Backport ae36b15 just for test_install.py

* Only skip tests on CI runs

* Always store git sha in _version.py during installation

* Fix PEP440 compliance.

The wheel metadata version 1.2 states that the package version MUST be
PEP440 compliant.

This means that instead of `3002.2-511-g033c53eccb`, the salt version
string should look like `3002.2+511.g033c53eccb`, a post release of
`3002.2` ahead by 511 commits with the git sha `033c53eccb`

* Fix and migrate `tests/unit/test_version.py` to PyTest

* Skip test if `easy_install` is not available

* We also need to be PEP440 compliant when there's no git history

* Allow extra_filerefs as sanitized kwargs for SSH client

* Fix regression on cmd.run when passing tuples as cmd

Co-authored-by: Alexander Graul <agraul@suse.com>

* Add unit tests to ensure cmd.run accepts tuples

* Add unit test to check for extra_filerefs on SSH opts

* Add changelog file

* Fix comment for test case

* Fix unit test to avoid failing on Windows

* Skip failing test on windows

* Fix test to work on Windows

* Add all ssh kwargs to sanitize_kwargs method

* Run pre-commit

* Fix pylint

* Fix cmdmod loglevel and module_names tests

* Fix pre-commit

* Skip ssh tests if binary does not exist

* Use setup_loader for cmdmod test

* Prevent argument injection in restartcheck

* Add changelog for restartcheck fix

* docs_3002.6

* Add back tests removed in merge

Co-authored-by: Pedro Algarvio <pedro@algarvio.me>
Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com>
Co-authored-by: Bryce Larson <brycel@vmware.com>
Co-authored-by: Pablo Suárez Hernández <psuarezhernandez@suse.com>
Co-authored-by: Alexander Graul <agraul@suse.com>
Co-authored-by: Frode Gundersen <fgundersen@saltstack.com>

* Remove glance state module in favor of glance_image

* update wording in changelog

* bump deprecation warning to Silicon.

* Updating warnutil version to Phosphorous.

* Update salt/modules/keystone.py

Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com>

* Check $HOMEBREW_PREFIX when linking against libcrypto

When loading `libcrypto`, Salt checks for a Homebrew installation of `openssl`
at Homebrew's default prefix of `/usr/local`. However, on Apple Silicon Macs,
Homebrew's default installation prefix is `/opt/homebrew`. On all platforms,
the prefix is configurable.  If Salt doesn't find one of those `libcrypto`s,
it will fall back on the un-versioned `/usr/lib/libcrypto.dylib`, which will
cause the following crash:

    Application Specific Information:
    /usr/lib/libcrypto.dylib
    abort() called
    Invalid dylib load. Clients should not load the unversioned libcrypto dylib as it does not have a stable ABI.

This commit checks $HOMEBREW_PREFIX instead of hard-coding `/usr/local`.

* Add test case

* Add changelog for 59808

* Add changelog entry

* Make _find_libcrypto fail on Big Sur if it can't find a library

Right now, if `_find_libcrypto` can't find any externally-managed versions of
libcrypto, it will fall back on the pre-Catalina un-versioned system libcrypto.
This does not exist on Big Sur and it would be better to raise an exception
here rather than crashing later when trying to open it.

* Update _find_libcrypto tests

This commit simplifies the unit tests for _find_libcrypto by mocking out the
host's filesystem and testing the common libcrypto installations (brew, ports,
etc.) on Big Sur. It simplifies the tests for falling back on system versions
of libcrypto on previous versions of macOS.

* Fix description of test_find_libcrypto_with_system_before_catalina

* Patch sys.platform for test_rsax931 tests

* modules/match: add missing "minion_id" in Pillar example

The documented Pillar example for `match.filter_by` lacks the `minion_id` parameter. Without it, the assignment won't work as expected.
- fix documentation
- add tests:
  - to prove the misbehavior of the documented example
  - to prove the proper behaviour when supplying `minion_id`
  - to ensure some misbehaviour observed with compound matchers doesn't occur

* Fix for issue #59773

- When instantiating the loader grab values of grains and pillars if
  they are NamedLoaderContext instances.
- The loader uses a copy of opts.
- Impliment deepcopy on NamedLoaderContext instances.

* Add changelog for #59773

* _get_initial_pillar function returns pillar

* Fix linter issues

* Clean up test

* Bump deprecation release for neutron

* Uncomment Sulfur release name

* Removing the _ext_nodes deprecation warning and alias.

* Adding changelog.

* Renaming changelog file.

* Update 59804.removed

* Initial pass at fips_mode config option

* Fix pre-commit

* Fix tests and add changelog

* update docs 3003

* update docs 3003 - newline

* Fix warts in changelog

Co-authored-by: Pedro Algarvio <pedro@algarvio.me>
Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com>
Co-authored-by: Bryce Larson <brycel@vmware.com>
Co-authored-by: Pablo Suárez Hernández <psuarezhernandez@suse.com>
Co-authored-by: Alexander Graul <agraul@suse.com>
Co-authored-by: Frode Gundersen <fgundersen@saltstack.com>
Co-authored-by: Gareth J. Greenaway <gareth@saltstack.com>
Co-authored-by: Gareth J. Greenaway <gareth@wiked.org>
Co-authored-by: Hoa-Long Tam <hoalong@apple.com>
Co-authored-by: krionbsd <krion@freebsd.org>
Co-authored-by: Elias Probst <e.probst@ssc-services.de>
Co-authored-by: Frode Gundersen <frogunder@gmail.com>
2021-03-24 10:52:25 -04:00
Pedro Algarvio
66ef908ffc Fix and migrate tests/unit/utils/test_cache.py to PyTest 2021-02-04 18:27:19 +00:00
Pedro Algarvio
2477ebfb35 Migrate multimaster tests to PyTest 2020-12-04 20:14:37 +00:00
Pedro Algarvio
ed4b34525a Fix the filemap checks 2020-12-04 07:44:52 +00:00
Pedro Algarvio
19c72464df Migrate integration.minion.test_pillar to PyTest 2020-12-04 07:44:52 +00:00
Pedro Algarvio
2d3d26a6cd Migrate the minion blackout integration tests to PyTest 2020-12-03 09:32:12 +00:00
Benjamin Drung
5539fc0f52
Support testing against system installed version (#57764)
* Drop six usage and Py2 support

Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>

* Fix import grouping in tests/unit/modules/test_baredoc.py

Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>

* Support testing against system installed version

The Debian package of salt comes with an autopkgtest, which runs the
unit tests against the install salt package:

```
cp -r conf scripts tests "$AUTOPKGTEST_TMP"
cd "$AUTOPKGTEST_TMP"
LC_ALL=C.UTF-8 NO_INTERNET=1 python3 ./tests/runtests.py -v --no-report --unit
```

Some test cases fail, because the salt source code is not in `CODE_DIR`.
To support testing against system installed version, just import `salt`
to determine the location of the module and set `SALT_CODE_DIR` to it.

`test_check_virtualname` and `test_module_name_source_match` can now run
against the system installed version and do not need to be skipped any
more.

Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>

* Running pre-commit bits manually.

Co-authored-by: Gareth J. Greenaway <gareth@wiked.org>
Co-authored-by: Gareth J. Greenaway <gareth@saltstack.com>
2020-10-05 15:36:49 -07:00
Pedro Algarvio
5809d34a48
This code is no longer used. Nuke it. 2020-09-14 11:07:38 +01:00
Pedro Algarvio
1b4d6bde59
This test module does not target linux service alone 2020-08-26 15:16:08 +01:00
Pedro Algarvio
333fe1a570 Sort and ignore duplicates 2020-05-22 09:17:36 -07:00
Pedro Algarvio
f9cc30acf2 Add tests to ensure proper pytest pass/fail behavior.
This is specially important because we're hacking pytest's fixture
termination and doing so in important pytest hooks which can change the
normal behavior of pytest.
2020-05-21 23:59:36 -07:00
Pedro Algarvio
762e9ed784 Merge egg and bdist tests in to a test module.
Additionally, several other asserts are made against the installed salt

Fixes #57316
2020-05-15 14:53:49 -07:00
Pedro Algarvio
48e7e20e22 Move setup tests to unit tests. Adjust. 2020-05-13 21:57:54 -07:00
David Hilton
1c7ce9d793
merge nxos-specific work from develop into master. (#54931)
* Combine proxy and native minion workflows for NXOS

 - Normalize SSH and NX-API proxy minion workflows
 - Add NX-API over unix domain socket support for native minions

* Fix typo

* Fix states correct_roles bug

* Add comment clarification for nxos states

* Fix lint issues

* Address python3 incompatibility

* Fix additional lint issues

* Disable pylint W1699 warning

* Use new style class syntax

* Correct typo

* Fix nxos grains

* Pass data to grains function

* Return nxos grains key

* Protect nxos grain with proper __virtual__() check

The changes in PR #49676 made the following stacktrace occur when running
on a system that doesn't have the proper NXOS/NXAPIClient settings exposed:

```
[CRITICAL] Failed to load grains defined in grain file nxos.system_information in function <function system_information at 0x3aeb758>, error:
Traceback (most recent call last):
  File "/testing/salt/loader.py", line 773, in grains
    ret = funcs[key](**kwargs)
  File "/testing/salt/grains/nxos.py", line 36, in system_information
    data = salt.utils.nxos.version_info()
  File "/testing/salt/utils/nxos.py", line 318, in version_info
    client = NxapiClient()
  File "/testing/salt/utils/nxos.py", line 78, in __init__
    raise RuntimeError("No host specified and no UDS found at {0}\n".format(self.NXAPI_UDS))
RuntimeError: No host specified and no UDS found at /tmp/nginx_local/nginx_1_be_nxapi.sock

local:
    True
```

We need to protect the grains from loading when the settings are missing.

* Initial nxos_upgrade changes

* Revert "Initial nxos_upgrade changes"

This reverts commit e17ca19fbc.

* New NX-OS salt minion install doc

* Add guestshell sync information

* Initial nxos_upgrade changes

* Initial nxos_upgrade changes

* Revert "Initial nxos_upgrade changes"

This reverts commit e17ca19fbc.

* Revert "Initial nxos_upgrade changes"

This reverts commit e17ca19fbc.

* Add nxos to index.rst

* New nxos_upgrade execution and state modules

* Added NXOS UT support - initially for nxos_upgrade.py

* Resolved one pylint 'old class style' issue.  Excluding 'nxos' sub-directory under tests/unit/modules

* Add __init__.py file to treat directory as a package directory.

* Addressed PR comments.

* Removed pylint disable-msg that was only applicable to python 3+

* Document NAPALM installation inside Guestshell

Adding step-by-step guide to install NAPALM inside of the NXOS Guestshell.

* show and sendline method fixes

* Update doc for starting minion in nxos GuestShell

* Revert show method changes

* Revert sendline method doc changes

* Resolve lint errors

* Remove nxos guestshell napalm references

This work is delayed so removing the references

* Address review comments

* Address salt style guide comment

* Doc and module updates

* Initial nxos module and proxy unit tests

* Additional nxos module and proxy unit tests

* Add nxos state unit tests

* Add tests for replace function

* Bug fixes

* Fix test_check_password_password_encrypted_false test

* Add test_config_nxos_error_ssh test

* remove opts modification in init

* reduce scope of variable to function where it's used

* minor nxos cleanup - raise instead of exit, use named kwargs

* use create_autospec in place of raw mocks

* _init_ssh's raise is now caught by ping

* allow gen_hash to work on any system

* change no_save_config option to save_config

* update set_password to work with updated gen_hash

* passing an invalid algorithm to pycrypto.hash raises

* blacken nxos-related files

* _fallback_gen_hash also works without a password

* remove debugging line, improve error message

* lint and black

* nxos docfix

* remove unused variable

* Review comments addressed

* mark old nxos functions as deprecated

* black

* remove unused variables

* clean up arguments

* simplify save_config logic

* minor doc cleanup

* make sendline with a list of commands reliably work

* Update various doc index files for nxos_upgrade

* Fix a few bugs in nxos proxy and execution modules

* doc indent fix

Co-authored-by: mikewiebe <mwiebe@cisco.com>
Co-authored-by: rallytime <nicole@saltstack.com>
Co-authored-by: Thomas Stoner <tmstoner@cisco.com>
Co-authored-by: tstoner <33665760+tstoner@users.noreply.github.com>
Co-authored-by: Chris Van Heuveln <cvanheuv@cisco.com>
2020-05-04 01:13:07 -07:00
Pedro Algarvio
2352457b35 Man pages test does not need to be an integration test 2020-04-29 16:28:47 -07:00
Daniel A. Wozniak
dcde50d4ee Fix rebase/merge wargs 2020-04-29 15:00:46 -07:00
Daniel A. Wozniak
d5801df94b Fix CVE-2020-11652
Sanitize paths in ClearFuncs methods provided by salt-master. This
ensures we do not allow access to un-intended files and directories.
2020-04-29 15:00:46 -07:00
Pedro Algarvio
10a33a9eeb
These are not integration tests.
Additionally, created a base class which takes care of setup and cleanup
2020-04-24 09:55:50 +01:00
Benjamin Drung
a8d9492f50 Skip test_module_name_source_match if source directory is not found
Running the unittest with autopkgtest against the installed version of
salt fails:

```
======================================================================
FAIL: test_module_name_source_match
(unit.test_module_names.BadTestModuleNamesTestCase)
[CPU:0.0%|MEM:66.8%]
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests/unit/test_module_names.py", line 233, in
test_module_name_source_match
    assert not errors, _format_errors(errors)
AssertionError: The following 787 test module(s) could not be matched to
a source code file:

unit.test_minion (expected: salt/minion.py)
unit.test_version (expected: salt/version.py)
unit.test_transport (expected: salt/transport.py)
unit.test_template (expected: salt/template.py)
unit.test_state (expected: salt/state.py)
unit.test_spm (expected: salt/spm.py)
unit.test_pillar (expected: salt/pillar.py)
unit.test_payload (expected: salt/payload.py)
unit.test_master (expected: salt/master.py)
unit.test_log (expected: salt/log.py)
[...]
```

Therefore skip `test_module_name_source_match` if the source directory
`salt` is not found.

Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>
2020-04-15 13:36:06 +02:00
Benjamin Drung
d3b6b327b8 Blacken tests/unit/test_module_names.py
Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>
2020-04-15 13:33:52 +02:00
ch3ll
04af219af9
run black against changes 2020-04-09 15:40:03 -04:00
Blacken Salt
0b2a5613b3
Blacken salt 2020-04-03 13:05:41 -05:00
ch3ll
85d7c784ef
Fix integration setup egg test 2020-03-20 11:27:40 -04:00
ch3ll
22cccd2107
Use virtualenv test helper that already exists and fix setup.py 2020-03-16 15:33:43 -04:00
Wayne Werner
759290a055
Use encoding when caching pillar data
Fixes #51854 and ports #52195 to master
2020-02-12 13:03:23 -06:00
Megan Wilhite
9b7e0dac06
Merge branch 'master' into develop 2020-01-09 10:32:49 -05:00
Christian McHugh
ea47eac3a1 Merge branch 'port-49822' of github.com:mchugh19/salt into salt-check-fullmerge 2020-01-05 07:39:04 +00:00
stanislaw_jakiel
8d3bc80323 ignoring test_module_names.py for test_logstash_mod since the error message is ambiguous 2019-12-29 13:51:16 +01:00
Daniel Wozniak
1292b6d184
Merge pull request #55527 from s0undt3ch/features/pytest-staged-21
[PyTest #21] Test related fixes/cleanup
2019-12-12 09:44:36 -07:00
Pedro Algarvio
e84b695c77
Always ignore PyTest's conftest.py files 2019-12-11 16:02:54 +00:00
Pedro Algarvio
18eea08cff
Remove unneeded file 2019-12-11 16:02:51 +00:00
Pedro Algarvio
ac0db895ab
Prefer RUNTIME_VARS usage 2019-12-03 15:22:34 +00:00
Christian McHugh
7ccba0cd2c Fresh import on master 2019-12-02 20:35:56 +00:00
Pedro Algarvio
38e779e54f
Function name must not start with test_ of pytest picks it up
Conflicts:
* tests/support/parser/__init__.py
2019-11-23 09:49:18 +00:00
Wayne Werner
321710e7c8 Merge pull request #52773 from bloomberg/exec_2019
2019.2: bug: executors lazyloader is missing functions and proxy args
2019-11-13 16:15:37 +07:00
Gareth J. Greenaway
549cfb8b7b
Fixing test_run_job test to ensure the right data is being asserted. Updating unit/test_module_names.py to include integration.scheduler.test_run_job. 2019-09-29 10:29:42 -07:00
Pedro Algarvio
bdf24f4064
Make sure we tests salt-master's event_return setting 2019-09-25 16:11:18 +01:00
Dmitry Kuzmenko
723f363891
Ignore the multimaster minion subgroup test in module names test. 2019-08-18 14:00:47 +03:00
Gareth J. Greenaway
ab72e1b821
Adding unit.test_proxy_minion to ignore list 2019-08-07 13:35:49 -07:00