Commit graph

111 commits

Author SHA1 Message Date
Pedro Algarvio
41a39417f8 Remaining test fixes regarding the recent GitHub RSA key change
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-03-28 05:06:43 +01:00
Pedro Algarvio
681d37fa8d Migrate integration.states.test_file to functional tests
In the process, split the tests into sub-modules which target each
function tested from the ``file`` state modules.
A lot of text files used during testing, which can be created at runtime
were also deleted.
2022-12-02 11:19:30 +00:00
Megan Wilhite
b7a9497614
Merge pull request #62510 from s0undt3ch/hotfix/payload
Remove skip added on `freeze`. A litle refactor and timeouts relax.
2022-09-22 13:06:00 -06:00
MKLeb
3cd2d1c39e move matchers unit tests to pytest 2022-09-21 11:35:34 -06:00
Thomas Phipps
37ad4fac35
Merge branch 'master' into hotfix/payload 2022-09-15 14:40:48 -07:00
Caleb Beard
7e161354dd
Merge branch 'master' into pytest/cache-unit-tests 2022-09-11 23:29:35 -04: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
4ebb9c41d4 Migrate tests/integration/ssh/test_deploy.py to pytest
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-08-26 11:39:54 -07:00
Pedro Algarvio
3d4dc9f274 Migrate tests/integration/ssh/test_master.py to pytest
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-08-26 11:39:26 -07:00
Pedro Algarvio
5160ea4284 Migrate tests/integration/ssh/test_mine.py to pytest
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-08-26 15:42:35 +01:00
Pedro Algarvio
e5b8bac199 Migrate tests/integration/ssh/test_raw.py to pytest
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-08-25 20:35:38 -07:00
MKLeb
01d18c449d
move remaining cache unit tests to pytest 2022-08-25 13:13:48 -04:00
Pedro Algarvio
49c210f70b Migrate tests/integration/states/test_docker_network.py to functional
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-08-23 12:50:32 -06:00
Pedro Algarvio
458ab605ed
Move tests into their proper transport. Relax timeouts on the IPC tests.
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-08-23 07:11:55 +01:00
Pedro Algarvio
81d3112046 Migrate mysql execution and state tests to functional tests.
-----

As an added bonus, running mysql module integration tests:
```
=== 195 passed, 2 warnings in 2067.57s (0:34:27) ===
```
as functional tests:
```
=== 195 passed, 5 warnings in 222.23s (0:03:42) ===
```

-----

As an added bonus, running mysql state integration tests:
```
=== 62 passed, 3 skipped, 2 warnings in 576.79s (0:09:36) ===
```
as functional tests:
```
=== 62 passed, 3 skipped, 5 warnings in 253.27s (0:04:13) ===
```

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-07-05 08:14:31 -07:00
Pedro Algarvio
97afb78694 Stop loading imported functions.
Fixes #62190

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-06-29 07:39:30 -06:00
Pedro Algarvio
44ffb72840 Factor out sum and sorting of permissions into separate functions.
Fixes #56495

Additionally, the same logic was applied to the rest_cherrypy netapi
2022-06-15 12:28:06 -06:00
Pedro Algarvio
e33074231b Fix wildcard eauth.
Migrate ``tests/integration/client/test_runner.py`` and ``tests/integration/wheel/`` to PyTest
2022-06-13 13:14:51 -06: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
044007145b Migrate `rest_tornado` tests to PyTest(those possible) 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
Twangboy
d1bb1bf358 Update filename_map 2022-04-19 16:44:43 -07:00
Pedro Algarvio
8ea83784ac Move deferred handler tests to pytest
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-04-12 09:46:02 -04: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
cedccff8c7 Migrate `tests.integration.states.test_pkgrepo` to functional tests.
Additionally, for Debian based distributions, test ``pkgrepo`` with the
system ``aptsources`` package and without it.

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-04-11 15:02:54 -04:00
Pedro Algarvio
676e3c061e Be sure to import the required fixtures 2022-03-17 14:08:04 -07:00
Daniel A. Wozniak
f6ca55a2d7 Fix multimaster tests when using zeromq transport 2022-02-10 15:58:02 -08:00
Twangboy
a35b29b265 Add some funtional tests
Add functional tests for the following:
- file.readlink
- file.replace
- file.symlink

Remove unit tests for file.replace as they are duplicated in the added
functional test
2022-01-21 13:04:02 -05:00
Daniel A. Wozniak
9db1af7147 Clean up transports 2022-01-12 21:54:04 -08:00
MKLeb
2e9242c353 remap filename_map.yml for new file exec module tests 2021-12-13 08:45:27 -05:00
Megan Wilhite
a2ba9b9c40 Add test and migrate spm test to pytest 2021-12-08 09:19:26 -05:00
Gareth J. Greenaway
cbabd4b008
Moving tests/integration/states/test_pkg.py to pytest (#61025)
* Moving tests/integration/states/test_pkg.py to tests/pytests/functional/states/test_pkg.py

* Fixing failing tests.

* fixing test_pkg_011_latest_only_upgrade

* Fixing failing test when the test is skipped.

* Adding needed decorators to tests via the pytestmark.
2021-11-02 14:14:07 -04:00
Gareth J. Greenaway
5f0659c510 Moving tests/integration/modules/test_pkg.py to tests/pytests/functional/states/test_pkg.py 2021-10-13 14:10:23 -04:00
Gareth J. Greenaway
b9fef5dbd2
Fixing various functions in the file state module that use user.info (#60502)
* Fixing various functions in the file state module that use user.info to get group information, certain hosts particularly proxy minions do not have the user.info function avaiable.  In those cases we fall back to using the username for the group name.  Also moving the existing file state module unit tests over to pytest and breaking them out into seperate files for easier management.

* Adding changelog.

* Fixing the failing tests for test_hardlink. We want to make sure that user.info is not in __salt__ so the changed logic takes effect.

* Skip the selinux tests unless running on Linux.

* Add a reason for the skip.

* Get results of file.check_perms into different variable then check result in that dictionary if the check_perms failed.  Update tests to mock file.check_perms with more accurate return.

* check_perms in file module returns objects while the file module for windows returns one.  Updating changes and tests

* Mock return from file.check_perms depending on the platform we are running tests on.

* requested changes.  round one.

* requested changes.  round two.

* requested changes.  round three.

* black changes.

* Converting things over to pytest.
2021-08-24 11:43:50 -04:00
Pedro Algarvio
3c2cd16e70 Remove tests now that we properly check ALL module's docstrings.
Refs #58537
2021-08-19 07:31:52 -04:00
Daniel A. Wozniak
e065dd6733 Refactor loader into subdirectory 2021-07-28 17:47:23 -07:00
Pedro Algarvio
23123e5baa Migrate `tests/integration/states/test_user.py` to Pytest functional tests 2021-07-20 07:12:00 -04:00
Pedro Algarvio
8ddabaafe9 `warn_until now handles instances of SaltVersion`. Migrate tests to Pytest. 2021-07-12 19:07:53 -07:00
Pedro Algarvio
cedc24249c Migrate unit.states.test_ansiblegate to PyTest 2021-06-30 11:39:28 -07:00
Pedro Algarvio
2d2c1c2005 Migrate the ansiblegate state integration tests to pytest 2021-06-30 11:39:28 -07:00
Pedro Algarvio
241009d4fa Fix calling ansible modules.
They cannot be called by passing their path, for example:
```
Traceback (most recent call last):
  File ".nox/pytest-parametrized-3-7-crypto-none-transport-zeromq-coverage-false/lib/python3.7/site-packages/ansible/modules/ping.py", line 63, in <module>
    from ansible.module_utils.basic import AnsibleModule
  File "/home/vampas/projects/SaltStack/salt/hotfix/ansiblegate-59792/.nox/pytest-parametrized-3-7-crypto-none-transport-zeromq-coverage-false/lib/python3.7/site-packages/ansible/module_utils/basic.py", line 53, in <module>
    import tempfile
  File "/home/vampas/projects/SaltStack/salt/hotfix/ansiblegate-59792/.nox/pytest-parametrized-3-7-crypto-none-transport-zeromq-coverage-false/lib/python3.7/site-packages/ansible/modules/tempfile.py", line 79, in <module>
    from tempfile import mkstemp, mkdtemp
ImportError: cannot import name 'mkstemp' from 'tempfile' (/home/vampas/projects/SaltStack/salt/hotfix/ansiblegate-59792/.nox/pytest-parametrized-3-7-crypto-none-transport-zeromq-coverage-false/lib/python3.7/site-packages/ansible/modules/tempfile.py)
```
2021-06-30 11:39:28 -07:00
Pedro Algarvio
e466589a6e Inject the ansible functions into Salt's ansiblegate module.
This was broken in 3001(92438882a9 (diff-519146c38c0ed7bc961ffc5f408d3dd380abb8760d48e839743dbd38dc28ba15R323)).

Fixes #60207
2021-06-30 11:39:28 -07:00
Daniel A. Wozniak
cbbee775c0 Set the name of engine processes #60259 2021-06-24 13:33:23 -04:00
Pedro Algarvio
ed650b4569 Add back support to load old entrypoints by iterating instead of type checking
Fixes #59961
2021-05-13 12:50:29 -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
krionbsd
aecebd8854 Move multiple state tests to pytest 2021-04-28 14:15:37 -04:00
Megan Wilhite
66cf74140b
Merge Freeze into Master (#60074)
* 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

* Fix failing test tests.unit.grains.test_core.CoreGrainsTestCase.test_xen_virtual

* Fix pre-commit for docs.txt reqs

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>
2021-04-27 11:47:47 -04:00
krionbsd
3c55ce4fe2 Move apache, zabbix, postgresql and rabbitmq state tests into own
directories.
2021-03-22 14:00:06 -04:00