Commit graph

821 commits

Author SHA1 Message Date
Daniel A. Wozniak
4baea1a97b Remove vendored tornado 2023-05-23 14:41:30 -07:00
Jenkins
4c4d017ddb Test fix 2023-05-23 14:41:30 -07:00
Pedro Algarvio
4dd5d53f1f Non onedir builds might be able to user the newer pip and setuptools requirements
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-01-21 07:51:50 +00:00
Pedro Algarvio
3b31ae4076 Set PYTHONPATH pointing to CODE_ROOT so that tests can run against onedir
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-01-21 07:51:50 +00:00
Pedro Algarvio
90bca1a7f9 Bump pip and setuptools requirements
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-01-21 07:51:50 +00:00
Pedro Algarvio
444bdb56f9 Stop using RUNTIME_VARS
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-12-29 13:02:58 +00:00
Pedro Algarvio
866ded4a30 The TestGitPython*HTTP and TestPygit2*HTTP tests now use a container
Instead of installing uwsgi and setting up nginx when running the test suite

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-12-29 09:12:09 +00:00
David Murphy
0bc4a359a6 Removed up debug code 2022-12-20 07:07:21 -07:00
David Murphy
e8441238e1 Initial removal usage of distutils and replacement with setuptools 2022-12-20 07:07:21 -07:00
Pedro Algarvio
79481b72c6
Use the sitecustomize.py provided by pytest-salt-factories.
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-12-06 19:14:52 +00:00
Pedro Algarvio
3afaeb50bd Skip if the nginx binary cannot be found
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-12-06 06:03:10 +00:00
Pedro Algarvio
f0ce8c0b28 The newer Opensuse golden image has git-core in /usr/share
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-12-06 06:03:10 +00:00
Pedro Algarvio
7af30ff1bd Replace the usage of @runs_on(...) and @not_runs_on(...)
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-12-06 06:03:10 +00:00
Pedro Algarvio
c668dcaf5c The minimum PyTest version is now >= 7.0
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-12-06 06:03:10 +00:00
Pedro Algarvio
8a769342d6 Remove tests code/skips targeted for Py<3.6
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-12-06 06:03:10 +00:00
Pedro Algarvio
1882be04ed change_cwd is not a pytest helper function
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-12-02 11:19:30 +00:00
Pedro Algarvio
e4c8839cd2 Add group support to the create_account pytest helper 2022-12-02 11:19:30 +00:00
Thomas Phipps
37ad4fac35
Merge branch 'master' into hotfix/payload 2022-09-15 14:40:48 -07:00
Gareth J. Greenaway
998cb0f951 removing versions of mariadb that are no longer supported, adding in 10.6 2022-09-11 10:19:17 +01:00
Pedro Algarvio
3012dc42d6 Test fixes when running with the onedir build
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-08-29 13:24:21 -07:00
Pedro Algarvio
1ed20998c8 Bump to pytest-salt-factories==1.0.0rc20
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-08-29 13:23:23 -07: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
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
MKLeb
1ccf96f633 move Keys class to test helpers for ease of reuse 2022-08-10 10:37:04 -06:00
nicholasmhughes
59ccd7e4d9 fix tests that don't use gid for groups 2022-08-08 13:25:51 -06:00
nicholasmhughes
430fc0b692 fix setting non-unique gid and tests 2022-08-08 13:25:51 -06:00
nicholasmhughes
0dd0ca60a2 handle gid default differently 2022-08-08 13:25:51 -06:00
nicholasmhughes
b452ed5663 support creating groups with non-unique GIDs for testing purposes 2022-08-08 13:25:51 -06:00
nicholasmhughes
eaa004dd64 fixes saltstack/salt#62377 groups with duplicate GIDs are not returned by get_group_list 2022-08-08 13:25:51 -06:00
Pedro Algarvio
b35e7d46dc Format source code using latest black
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-08-01 12:49:16 -06:00
Pedro Algarvio
4d49013247 Update to isort 5.10.1
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-08-01 12:49:16 -06:00
Pedro Algarvio
44cbe7ea7f Switch to the github repository container and our own container mirrors
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-07-28 11:07:12 +01:00
Pedro Algarvio
ab9def79b6 Windows seems to struggle with this check when collecting tests.
```
tests\unit\modules\inspectlib\test_collector.py:27: in <module>
    @skipIf(no_symlinks(), "Git missing 'core.symlinks=true' config")
        Inspector  = <class 'salt.modules.inspectlib.collector.Inspector'>
        MagicMock  = <class 'mock.mock.MagicMock'>
        TestCase   = <class 'tests.support.unit.TestCase'>
        __builtins__ = <builtins>
        __cached__ = 'C:\\Users\\Administrator\\AppData\\Local\\Temp\\kitchen\\testing\\tests\\unit\\modules\\inspectlib\\__pycache__\\test_collector.cpython-38.pyc'
        __doc__    = '\n    :codeauthor: Bo Maryniuk <bo@suse.de>\n'
        __file__   = 'C:\\Users\\Administrator\\AppData\\Local\\Temp\\kitchen\\testing\\tests\\unit\\modules\\inspectlib\\test_collector.py'
        __loader__ = <_pytest.assertion.rewrite.AssertionRewritingHook object at 0x0000022B0C3A6B20>
        __name__   = 'tests.unit.modules.inspectlib.test_collector'
        __package__ = 'tests.unit.modules.inspectlib'
        __spec__   = ModuleSpec(name='tests.unit.modules.inspectlib.test_collector', loader=<_pytest.assertion.rewrite.AssertionRewritingHo...C:\\Users\\Administrator\\AppData\\Local\\Temp\\kitchen\\testing\\tests\\unit\\modules\\inspectlib\\test_collector.py')
        no_symlinks = <function no_symlinks at 0x0000022B0D05CC10>
        os         = <module 'os' from 'c:\\python38\\lib\\os.py'>
        patch      = <function patch at 0x0000022B2836FB80>
        skipIf     = <function skipIf at 0x0000022B270738B0>
tests\support\helpers.py:82: in no_symlinks
    output = subprocess.Popen(
        output     = ''
c:\python38\lib\subprocess.py:858: in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
        args       = ['git', 'config', '--get', 'core.symlinks']
        bufsize    = -1
        c2pread    = 5
        c2pwrite   = Handle(2176)
        close_fds  = True
        creationflags = 0
        cwd        = 'C:\\Users\\Administrator\\AppData\\Local\\Temp\\salt-tests-tmpdir'
        encoding   = None
        env        = None
        errors     = None
        errread    = -1
        errwrite   = Handle(2196)
        executable = None
        f          = <_io.BufferedReader name=5>
        p2cread    = Handle(1984)
        p2cwrite   = -1
        pass_fds   = ()
        preexec_fn = None
        restore_signals = True
        self       = <subprocess.Popen object at 0x0000022B3012E400>
        shell      = False
        start_new_session = False
        startupinfo = None
        stderr     = None
        stdin      = None
        stdout     = -1
        text       = None
        universal_newlines = None
c:\python38\lib\subprocess.py:1311: in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
E   NotADirectoryError: [WinError 267] The directory name is invalid
        args       = 'git config --get core.symlinks'
        attribute_list = {'handle_list': [1984, 2196, 2176]}
        c2pread    = 5
        c2pwrite   = Handle(2176)
        close_fds  = False
        creationflags = 0
        cwd        = 'C:\\Users\\Administrator\\AppData\\Local\\Temp\\salt-tests-tmpdir'
        env        = None
        errread    = -1
        errwrite   = Handle(2196)
        executable = None
        handle_list = [1984, 2196, 2176]
        have_handle_list = False
        p2cread    = Handle(1984)
        p2cwrite   = -1
        pass_fds   = ()
        preexec_fn = None
        self       = <subprocess.Popen object at 0x0000022B3012E400>
        shell      = False
        startupinfo = <subprocess.STARTUPINFO object at 0x0000022B2F5E54C0>
        unused_restore_signals = True
        unused_start_new_session = False
        use_std_handles = True
```

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-07-22 07:24:35 +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
837160019a Let the container breathe a little before confirming it's running.
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-07-05 08:14:31 -07:00
MKLeb
a61362a73d account for newer entropy poolsize in EntropyGenerator 2022-06-30 11:02:16 -06:00
Daniel Wozniak
d9343cca65
Merge forward 3004.2 (#62200)
* Check only ssh-rsa encyption for set_known_host

* Windows test fix

* Fix pre-commit

* add CentOS Stream to _OS_FAMILY_MAP, fix #59161

* added changelog and test

* fix syntax

* Use centosstream 8 for testing

* Use ? for matching spaces

Technically this isn't *quite* right as 'CentOSyStream' would also
match, but it's pretty reasonable:

- OS grains shouldn't ever be that kind of close
- This test is only swapping out spaces, and only for the os grain. That
  would mean there would have to be two OSes with grains that only
  differ by one having a space where another one has any other
  character.
- This test really isn't even about matching grains, we're just using
  compound matching and that's a reasonable one to use.

* Add centos stream when detecting package manager name

* Fix pre-commit

* Remove tests for fedora 32/33 EOL

* Remove tests for fedora 32/33 EOL

* Remove tests for fedora 33 EOL

* Use centosstream 8 for testing

* Use ? for matching spaces

Technically this isn't *quite* right as 'CentOSyStream' would also
match, but it's pretty reasonable:

- OS grains shouldn't ever be that kind of close
- This test is only swapping out spaces, and only for the os grain. That
  would mean there would have to be two OSes with grains that only
  differ by one having a space where another one has any other
  character.
- This test really isn't even about matching grains, we're just using
  compound matching and that's a reasonable one to use.

* 3002.9: Fix pre-commit

* 3003.5 Fix pre-commit

* [3002.9] Replace use of 'sl' with 'paper' for Arch tests, due to 'sl' having key issues

* Remove mojave testing

* Remove mojave and high sierra testing

* Remove mojave testing

* [3002.9] Fix cloud vultr size issue

* Update package name to aspnetcore-runtime-6.0 for redhat 8 pkg tests

* Update package name to aspnetcore-runtime-6.0 for redhat 8 pkg tests

* change amazon linux AMI

* Migrate `unit.modules.test_gpg` to PyTest

* Don't leave any `gpg-agent`'s running behind

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>

* Start a background process to generate entropy.

Some tests have failed because of not enough entropy which then makes
the test timeout.

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>

* A different approach at generating entropy

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>

* Turn entropy generation into a helper

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>

* change amazon linux AMI

* change amazon linux AMI

* [3004.2] Fix cloud vultr size issue

* Fix cloud requirements

* Skip pam tests on windows

* Update ami to try to get the tests running

* Update amis to try to get the tests running

* Fixing test_publish_to_pubserv_ipc_tcp, moving the call to socket.socket into the while loop.

* Add static requirements for 3.8 and 3.9 on Windows

* Fix requirements

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>

* The whole CI process is already slower than GH Actions, no caches.

* Pre-commit must not run with ``PIP_EXTRA_INDEX_URL`` set.

* Lint fixes

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>

* Compile cloud requirements

* Run add requirements files for 3.8 and 3.9

* Fix docs and cloud requirements

* [3003.5] Fix cloud vultr size issue

* Windows test fix

* Skip test if docker not running

* [3003.5] Fix pre-commit

* Update Markup and contextfunction imports for jinja versions >=3.1.

* update bootstrap to 2022.03.15

* update bootstrap to 2022.03.15

* skipping tests/pytests/integration/modules/test_virt.py on 3002.x and 3003.x branches.

* Windows test fix

* Skip PAM tests on Windows

Windows has no ctypes with the PAM bits, so we should go ahead and skip
on Windows.

* Skip PAM auth tests on Windows

Windows lacks the correct bits, so...

* Fix pre-commit

* Skipping tests since they're also skipped on the master branch

Fixes #403

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>

* Skip test that only runs because the patch binary is now available.

The feature though, was only added in 3004.

Fixes #404

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>

* Skip test which is only supposed to run in Linux

Fixes https://github.com/saltstack/salt-priv/issues/405

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>

* GPG tests do not work on windows yet

* Fix tests

* Fix pre-commit

* skip tests.integration.modules.test_mac_brew_pkg.BrewModuleTest.test_list_upgrades and tests.integration.modules.test_state.StateModuleTest.test_get_file_from_env_in_top_match on Mac OS.

* skip tests.integration.modules.test_mac_brew_pkg.BrewModuleTest.test_list_upgrades and tests.integration.modules.test_state.StateModuleTest.test_get_file_from_env_in_top_match on Mac OS.

* Removing skip, moving it to different PR.

* Skipping tests on 3002.9.

* test fix

* Do not run patch tests on 3003.5. Feature not added till 3004

* skipping tests/pytests/integration/modules/test_virt.py on 3002.x and 3003.x branches.

* Fix pre-commit

* [3004.2] Update freebsd ami

* Bump the git version for freebsd CI tests

* removing versions that are no longer available from the tests.pytests.scenarios.compat.test_with_versions tests.

* Skip tests on windows when NOT using static requirements

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>

* removing versions that are no longer available from the tests.pytests.scenarios.compat.test_with_versions tests.

* test_issue_36469_tcp causes a fatal python error when run on Mac OS, so skipping.

* Fix tests

* Fix pre-commit

* Do not run patch tests on 3003.5. Feature not added till 3004

* Skip archive tar tests on windows

* [3002.9] Skip archive tar tests on windows

* GPG tests do not work on windows yet

* Skip test which is only supposed to run in Linux

Fixes https://github.com/saltstack/salt-priv/issues/405

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>

* Skip test that only runs because the patch binary is now available.

The feature though, was only added in 3004.

Fixes #404

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>

* Skipping tests since they're also skipped on the master branch

Fixes #403

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>

* Fix pre-commit

* Fix pre-commit

* Fix pre-commit

* Fix pre-commit

* retry sdb.get if it returns None

None is an entirely valid return - see EtcdClient.get in
salt/utils/etcd_util.py

* drop py2/six

* fix etcd sdb.set as well

* Fix etdcd-sdb test failure

If docker container is up and running, but etcd isn't responding yet
it's possible that we get some failing tests. This should wait a
reasonable amount of time for things to come up. Or just skip the test.

* Fix etdcd-sdb test failure

If docker container is up and running, but etcd isn't responding yet
it's possible that we get some failing tests. This should wait a
reasonable amount of time for things to come up. Or just skip the test.

* Skip the tests from unit/transport/test_zero.py that are hanging on Mac.

* skip tests in tests/pytests/unit/states/test_archive.py for 3002.9

* 3002.9 Skipping  CA permissions tests on Windows, similar to 3003.5 and 3004.2

* change skipif to skip

* Rollback Windows AMIs to use Python 3.7

* Rollback AMI's to Python 3.7... fix tests

* Fix failing test_archive tests

* Build using pyenv

* Add symlinks to openssl and rpath

* Add shasum for zeromq 4.3.4

* Fix docs on scripts

* Build zeromq earlier, fix symlinks

* Bring 61446 to 3004.1 branch

* Add changelog and tests

* Fix schedule test flakiness

* Retry with new port if in use

* fixing failing tests, ensuring that the correct path is used.

* fixing failing tests, ensuring that the correct path is used.

* fixing failing tests, ensuring that the correct path is used.

* Re-enable tiamat-pip on windows

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>

* Bump duration time for windwos for test_retry_option_success

* Skip test cauing hangs

* go go pylint disable

* more pre-commit

* oh lint

* so many weird hook failures

* Add unit tests for PAM auth CVE

We could add functional tests if it's important enough, but this is the
narrowest place to test.

* Fix PAM auth CVE

Credit to @ysf

Previously we weren't checking the result of PAM_ACCT_MGMT.

* pylint disable

* rewrite hook changes

* Skip PAM auth tests on Windows

Since Windows ends out lacking the correct bits, no need to run tests
there.

* pre-commit fixes

* docs 3004.2 release

* Fix bug in tcp transport

* Fix the test_zeromq_filtering test

* skip test_npm_install_url_referenced_package on centos 7 and 8.

* Swapping CentOS Linux-8 for CentOS Stream-8

* Update build scripts to use pyenv

* Fix tests on MacOS

* Fix bug in tcp transport

* Fix test failures

* Update release notes and man pages for 3003.5

* Add 3002.9 changelog, release notes, man pages

* Update doc/topics/releases/3002.9.rst

Co-authored-by: Megan Wilhite <mwilhite@vmware.com>

* Fix requirements

* Fix imports

* Test fixup

* Fix merge warts

* fix merge wart in changelog

* Fix merge warts in tests

Co-authored-by: krionbsd <krion@FreeBSD.org>
Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com>
Co-authored-by: Alexander Kriventsov <akriventsov@nic.ru>
Co-authored-by: Megan Wilhite <mwilhite@vmware.com>
Co-authored-by: Wayne Werner <wwerner@vmware.com>
Co-authored-by: Gareth J. Greenaway <gareth@saltstack.com>
Co-authored-by: David Murphy < dmurphy@saltstack.com>
Co-authored-by: Twangboy <leesh@vmware.com>
Co-authored-by: MKLeb <calebb@vmware.com>
Co-authored-by: Pedro Algarvio <pedro@algarvio.me>
Co-authored-by: Pedro Algarvio <palgarvio@vmware.com>
Co-authored-by: Thomas Phipps <tphipps@vmware.com>
Co-authored-by: Frode Gundersen <frogunder@gmail.com>
Co-authored-by: Alyssa Rock <alyssa.rock@gmail.com>
Co-authored-by: Alyssa Rock <43180546+barbaricyawps@users.noreply.github.com>
2022-06-29 10:10:06 -06:00
Pedro Algarvio
ea0e89c010 Be sure do delete groups matching the username when deleting the account.
The reason for this extra step is to support the multiple platforms
behavior and because we remove the user from it's primary group before
deleting the account.

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-06-15 12:28:06 -06:00
Pedro Algarvio
74a8b7ab3a Set the account password, even if reusing existing temporary accounts. 2022-06-13 13:14:51 -06:00
Pedro Algarvio
6e846e721f Remove `external_auth` from the static config file 2022-06-13 13:14:51 -06:00
Pedro Algarvio
c708d1929b Support using `Webserver` as a context manager 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
399a062ed3 Renamed `tests/support/saltnado.py -> tests/support/netapi.py` 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
af2964f4dd Implement `pytest.mark.requires_random_entropy` marker for simpler usage.
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-06-10 07:24:00 -06:00
Pedro Algarvio
9ff0a72e77 Reduce code duplication by creating `tests/support/pytest/etcd.py`
Additionally, we also test against a Etcd v3 container running in v2 mode.

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-06-02 07:05:09 -06:00
Pedro Algarvio
49f46b166c Switch to the new salt-factories container support
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-06-02 07:05:09 -06:00
Pedro Algarvio
4b87d8be98 Adjust the mysql container helper code to use the new check start callables
Additionally, also improve these fixtures so that they can be used in
the salt cache functional tests.

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-06-02 07:05:09 -06:00
Pedro Algarvio
29b6fe207c Updates required for `pytest-salt-factories>=1.0.0rc16`
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2022-06-02 07:05:09 -06:00