Commit Graph

248 Commits

Author SHA1 Message Date
rallytime
94c2a12be6
Merge branch '2017.7' into '2018.3'
Conflicts:
  - tests/integration/modules/test_state.py
  - tests/unit/templates/test_jinja.py
  - tests/unit/test_minion.py
2018-04-17 10:54:42 -04:00
Mike Place
b8990f5258
Pass the timeout variable to the CLI when calling salt in tests 2018-04-13 16:37:01 -06:00
Erik Johnson
db11317400
Add ability to run a shell command to depends decorator
This adds the ability to suppress loading of a function based on the
retcode of a command.
2018-04-12 18:02:21 -05:00
rallytime
fe10957ce0
Merge branch '2018.3' into 'develop'
Conflicts:
  - salt/cloud/clouds/azurearm.py
2018-04-12 11:00:14 -04:00
Gareth J. Greenaway
2ccf2c5fe0
Fixing test_path_which to check that the filter is available rather than results. 2018-04-11 08:19:07 -07:00
Nicole Thomas
ffaee26540
Merge pull request #46990 from rallytime/merge-2018.3
[2018.3] Merge forward from 2017.7 to 2018.3
2018-04-10 13:07:32 -04:00
Nicole Thomas
a34b92ae82
Merge pull request #46339 from DSRCorporation/bugs/ssh_state_test_failures
SSH State test failures
2018-04-10 13:06:50 -04:00
rallytime
2f1cf3e511
Merge branch '2017.7' into '2018.3'
Conflicts:
  - .kitchen.yml
2018-04-10 10:11:35 -04:00
Gareth J. Greenaway
0adfee9b11
Updating a couple tests. Fixing check_whitelist_blacklist to work with PY3 when non-iterables are passed. Adding warning about lst_avg results being wrong and future updates in Neon. 2018-04-09 19:38:18 -07:00
Gareth J. Greenaway
f3f42146ca
Removing expected from strftime and hashsum tests since the results are always different and we are only concerned about the filter being available. 2018-04-06 13:19:11 -07:00
Gareth J. Greenaway
860234c045
Fixing lint. 2018-04-06 13:19:11 -07:00
Gareth J. Greenaway
0599759e5b
cleaning up some test doc strings. 2018-04-06 13:19:10 -07:00
Gareth J. Greenaway
dceda5eb88
Moving all jinja filter tests into support/jinja_filters.py. Updaitng integration/ssh/test_jinja_filters.py to use those tests. Adding integration/modules/test_state_jinja_filters.py to also use the common jinja filter tests. 2018-04-06 13:19:10 -07:00
rallytime
5b50eaf6b0
Merge branch '2018.3' into 'develop'
Conflicts:
  - doc/ref/proxy/all/salt.proxy.cimc.rst
  - doc/ref/proxy/all/salt.proxy.panos.rst
  - doc/topics/releases/2018.3.0.rst
  - salt/modules/cmdmod.py
  - salt/modules/state.py
  - salt/utils/schedule.py
  - tests/integration/modules/test_state.py
2018-04-05 13:25:46 -04:00
Mike Place
bd98c49dc7
Merge branch '2018.3' into bugs/ssh_state_test_failures 2018-04-05 09:58:54 -05:00
Daniel Wallace
2edd5eaf9e
fix path 2018-04-04 13:37:39 -05:00
rallytime
893196d3e6
Merge branch '2017.7' into '2018.3'
Conflicts:
  - doc/conf.py
  - salt/loader.py
  - salt/modules/dockermod.py
  - salt/modules/sensehat.py
  - salt/utils/parsers.py
  - tests/integration/cloud/providers/test_ec2.py
  - tests/integration/modules/test_cp.py
  - tests/integration/modules/test_groupadd.py
  - tests/integration/spm/test_man_spm.py
  - tests/integration/states/test_npm.py
  - tests/unit/states/test_environ.py
2018-04-03 14:33:11 -04:00
Dmitry Kuzmenko
6fdc458a7f
Increase timeout for run_run in ShellCase 2018-03-29 22:46:23 +03:00
Dmitry Kuzmenko
92a6c43c73
More logging and assertion fixes. Extended ssh ops timeout. 2018-03-29 22:46:22 +03:00
Daniel A. Wozniak
5c22a0f88d
Use aboslute imports 2018-03-28 22:32:30 -07:00
Daniel A. Wozniak
78c9cb9584
Fix TestResult constructor calls 2018-03-28 21:09:59 -07:00
Daniel A. Wozniak
5ac89ad307
Use winrm_verify_ssl option causing tests to pass 2018-03-28 20:21:40 -07:00
Daniel A. Wozniak
ba5f11476c
Adding windows minion tests for salt cloud 2018-03-28 15:16:54 -07:00
Daniel A. Wozniak
4cb0c3f228
Failfast will be '-F' instead of '-f'
Avoid potential confusion with '-f' for '--force'
2018-03-21 20:31:25 -07:00
Daniel A. Wozniak
641f1f2293
Add fail-fast option to test runner 2018-03-20 22:53:01 -07:00
Erik Johnson
f9f187e915
Improve reliability/idempotence of file.blockreplace state
This makes the following changes:

- The `append_newline` argument to the `file.blockreplace`
  remote-execution function has been modified so that if its value is
  `None`, it only appends a newline when the content block does not end
  in one.
- A couple of fixes were made to newline handling. The existing code
  normalized the newlines in the content block, replacing them with
  os.linesep. However, when the file contains newlines that don't match
  the OS (i.e. POSIX newlines in a file on a Windows box, or Windows
  newlines on a Linux/Mac/BSD/etc. box), then we would still end up with
  mixed newlines. The line separator is now detected when we read in the
  original file, and the detected line separator is used when writing
  the content block. Additionally, the same newline mismatch was
  possible when appending/prepending the content block. This has been
  fixed by using a common function for appending, prepending, and
  replacing the content block.
- Support for the `append_newline` argument has been added to the
  `file.blockreplace` state. The default value for the state is `None`.
  A `versionchanged` has been added to the remote execution function to
  let users know that the Fluorine release will change the default value
  of that variable.
- 20 new integration tests have been written to test the
  `file.blockreplace` state.
2018-03-07 22:29:39 -06:00
Erik Johnson
4798187035
Improve reliability/idempotence of file.blockreplace state (2018.3 branch)
This makes the following changes:

- The `append_newline` argument to the `file.blockreplace`
  remote-execution function has been modified so that if its value is
  `None`, it only appends a newline when the content block does not end
  in one.
- A couple of fixes were made to newline handling. The existing code
  normalized the newlines in the content block, replacing them with
  os.linesep. However, when the file contains newlines that don't match
  the OS (i.e. POSIX newlines in a file on a Windows box, or Windows
  newlines on a Linux/Mac/BSD/etc. box), then we would still end up with
  mixed newlines. The line separator is now detected when we read in the
  original file, and the detected line separator is used when writing
  the content block. Additionally, the same newline mismatch was
  possible when appending/prepending the content block. This has been
  fixed by using a common function for appending, prepending, and
  replacing the content block.
- Support for the `append_newline` argument has been added to the
  `file.blockreplace` state. The default value for the state is `None`.
  A `versionchanged` has been added to the remote execution function to
  let users know that the Fluorine release will change the default value
  of that variable.
- 20 new integration tests have been written to test the
  `file.blockreplace` state.
2018-03-07 22:29:09 -06:00
Erik Johnson
1668a489c4
Update refrences to Oxygen codename to 2018.3.0 2018-02-21 21:47:41 -06:00
Erik Johnson
9d004f6512 Use mock 2.0.0 instead of unittest.mock on Python 3 (#2)
This preserves the custom mock_open we backported from unittest.mock,
but otherwise ditches unittest.mock as it does not have
MagicMock.assert_called in Python releases before 3.6.

This allows us to maintain a uniform mock version across all platforms
and Python releases.
2018-02-13 20:16:03 +01:00
Erik Johnson
293bdf2517
Merge pull request #45726 from rallytime/merge-oxygen
[oxygen] Merge forward from 2017.7 to oxygen
2018-01-28 13:05:00 -06:00
Nicole Thomas
2969d86237
Merge pull request #45735 from terminalmage/shellcase-debug-logging
Add debug logging to ShellCase functions
2018-01-28 08:27:20 -05:00
Erik Johnson
1cabf31a1f
Add debug logging to ShellCase functions
Some of these have been failing in ways which are not reproducible
locally. This adds debug logging so that we can check the
salt-runtests.log for the return data, to aid in troubleshooting.

NOTE: This also contains a fix for a bug in the CLI output handler that
I think may have a chance of fixing some of these odd failures.
2018-01-27 20:55:34 -06:00
Erik Johnson
f60183b95c
Use bytestrings for struct.pack/unpack
https://github.com/saltstack/salt/pull/45687 and
https://github.com/saltstack/salt/pull/45725 fixed problems with older
Python 2 versions interacting with the struct module, since
unicode_literals turned the format strings to unicode and older Python 2
releases can't accept a unicode format string. Since Python 2 and 3 both
support using bytestrings for the format strings, this commit makes sure
we are using bytestrings everywhere else we are using struct.pack/unpack.
2018-01-27 17:34:16 -06:00
rallytime
0ad101d560
Merge branch '2017.7' into 'oxygen'
Conflicts:
  - doc/man/salt.7
  - salt/modules/git.py
  - salt/modules/pacman.py
  - salt/states/git.py
  - tests/integration/modules/test_mac_user.py
  - tests/support/parser/__init__.py
2018-01-26 17:27:03 -05:00
Erik Johnson
d6d7da5c90
Replace all usage of six.b
It can't be trusted to produce bytes, it returns unicode when a unicode
string is passed.
2018-01-24 09:17:28 -06:00
Erik Johnson
6aa865cf54
Fix unnecessary/incorrect usage of six.binary_type 2018-01-22 11:17:06 -06:00
Nicole Thomas
12c0f99e8c
Merge pull request #45293 from terminalmage/py3-acl-auth-netapi
[PY3] Add unicode_literals to acl, auth, and netapi modules
2018-01-09 16:32:59 -05:00
Daniel Wallace
a8341fea01
clean up for windows tests for kitchen-salt 2018-01-06 17:14:46 -07:00
Daniel Wallace
e2824a7253
fix py3 tests 2018-01-05 13:36:08 -07:00
Erik Johnson
49dd5b32e9
[PY3] Add unicode_literals to acl, auth, and netapi modules 2018-01-05 10:31:11 -06:00
Erik Johnson
1dc6e79638
[PY3] Add unicode_literals to ext_pillar modules 2018-01-04 08:46:40 -06:00
Erik Johnson
002aa88a97
Replace yaml usage with a helper to ensure unicode is handled properly
Without allow_unicode=True, unicode characters are processed through the
str representer and on Python 2 are dumped as a Unicode code point (i.e.
a literal \u0414). This commit makes allow_unicode=True the default in
our salt.utils.yamlloader.safe_dump() helper. It also adds a new
salt.utils.yamlloader.dump() helper which wraps yaml.dump() and also
makes allow_unicode=True the default.

To make importing and using our custom yaml loader/dumper easier, a
convenience module called salt.utils.yaml has been added, which does a
wildcard import from both salt.utils.yamldumper and
salt.utils.yamlloader.

Refs to yaml.load/dump and yaml.safe_load/safe_dump have been updated to
salt.utils.yaml, to ensure that unicode is handled properly.
2018-01-03 14:14:21 -06:00
Erik Johnson
7b13a7df8b
Replace json module usage with a helper to ensure unicode content is handled properly
This adds wrappers for json.dump{,s} which disable `ensure_ascii` by
default.
2017-12-27 09:30:58 -06:00
rallytime
9ded5e1cbb
Merge branch '2017.7' into 'oxygen'
Conflicts:
  - salt/config/__init__.py
  - salt/grains/core.py
  - salt/modules/win_lgpo.py
  - salt/returners/mysql.py
  - salt/states/libcloud_dns.py
  - tests/integration/runners/test_runner_returns.py
  - tests/unit/grains/test_core.py
2017-12-21 15:58:08 -05:00
Daniel Wallace
d0586013eb
fix pylint 2017-12-21 10:40:54 -07:00
Daniel Wallace
59e2e56d13
chmod the xml files before trying to copy 2017-12-21 08:17:10 -07:00
Daniel Wallace
a5c1410e23
catch IOError when copying xml files back 2017-12-20 18:26:18 -07:00
Michael Calmer
744e698689
adapt tests to reflect reality
When CherryPy run with python3 it reads "bytes" from the wire.
In case of python2 BytesIO == StringIO, so nothing should change.

This change will do the same to make unit tests reflect reality.
2017-12-20 06:59:56 -05:00
Erik Johnson
7d6b679ac4
Fix fake importer for Python 3
Python 3 does not appear to pass all values to the `__import__` builtin
when they do not differ from the defaults. Therefore, the fake import
fails because of missing positional args.

This fix simply uses the defaults from Python 2 and 3's `__import__`
builtin.
2017-12-19 12:09:36 -06:00
Erik Johnson
15296e59a5
Add debug logging to SSHCase 2017-12-19 12:09:35 -06:00
Erik Johnson
8cdb9ea54f
[PY3] Add print_function import to files with unicode_literals already added
This makes the 2.x usage invalid syntax and forces the use of print as a
function. This adds the import to the files which I've updated in the
last couple of days but forgot to add it.
2017-12-15 12:14:18 -06:00
Nicole Thomas
ae8dd2e202
Merge pull request #44982 from terminalmage/docker-unicode
[PY3] Add unicode_literals to docker state/execution modules
2017-12-14 11:03:15 -05:00
Erik Johnson
5e1f75aab0
[PY3] Add unicode_literals to docker state/execution modules 2017-12-13 22:49:23 -06:00
Daniel Wallace
a7df9c3da3
fix py3 tests 2017-12-12 12:47:31 -07:00
rallytime
db5866d097
Update old utils paths to new utils paths 2017-12-11 18:43:33 -05:00
rallytime
08c71f13e4
Merge branch '2017.7' into 'oxygen'
Conflicts:
  - doc/ref/configuration/minion.rst
  - doc/topics/thorium/index.rst
  - salt/beacons/__init__.py
  - salt/client/mixins.py
  - salt/client/ssh/wrapper/state.py
  - salt/daemons/masterapi.py
  - salt/grains/extra.py
  - salt/minion.py
  - salt/modules/cron.py
  - salt/modules/file.py
  - salt/modules/mac_user.py
  - salt/modules/napalm_network.py
  - salt/modules/state.py
  - salt/modules/win_file.py
  - salt/modules/win_pkg.py
  - salt/proxy/dummy.py
  - salt/state.py
  - salt/states/file.py
  - salt/states/lxc.py
  - salt/utils/__init__.py
  - salt/utils/schedule.py
  - tests/integration/modules/test_file.py
  - tests/integration/modules/test_groupadd.py
  - tests/integration/ssh/test_state.py
  - tests/integration/states/test_file.py
  - tests/unit/daemons/test_masterapi.py
  - tests/unit/grains/test_core.py
  - tests/unit/modules/test_disk.py
  - tests/unit/modules/test_napalm_network.py
  - tests/unit/modules/test_state.py
  - tests/unit/test_minion.py
  - tests/unit/utils/test_process.py
2017-12-11 18:24:41 -05:00
Erik Johnson
272044c688
Roll back use of explicit unicode literals 2017-12-10 17:41:45 -06:00
Nicole Thomas
53eee476ac
Merge pull request #44638 from terminalmage/new-docker-hotness
Many improvements to docker network and container states
2017-12-07 15:50:55 -05:00
twangboy
f8110713f8
Use binary instead of unicode for loglevel 2017-12-06 21:31:43 -07:00
Erik Johnson
64aa4fbbec
Many improvements to docker network and container states
Much Improved Support for Docker Networking
===========================================

The `docker_network.present` state has undergone a full rewrite, which
includes the following improvements:

Full API Support for Network Management
---------------------------------------

The improvements made to input handling in the
`docker_container.running` state for 2017.7.0 have now been expanded to
docker_network.present`.  This brings with it full support for all
tunable configuration arguments.

Custom Subnets
--------------

Custom subnets can now be configured. Both IPv4 and mixed IPv4/IPv6
networks are supported.

Network Configuration in :py:func:`docker_container.running` States
-------------------------------------------------------------------

It is now possible to configure static IPv4/IPv6 addresses, as well as
links and labels.

Improved Handling of Images from Custom Registries
==================================================

Rather than attempting to parse the tag from the passed image name, Salt
will now resolve that tag down to an image ID and use that ID instead.

Due to this change, there are some backward-incompatible changes to
image management. See below for a full list of these changes.

Backward-incompatible Changes to Docker Image Management
--------------------------------------------------------

Passing image names to the following functions must now be done using separate
`repository` and `tag` arguments:

- `docker.build`
- `docker.commit`
- `docker.import`
- `docker.load`
- `docker.tag`
- `docker.sls_build`

Additionally, the `tag` argument must now be explicitly passed to the
`docker_image.present` state, unless the image is being pulled from a
docker registry.
2017-12-06 12:12:25 -06:00
Ch3LL
61ac5cf157
Add spm -y and -f arg integration tests 2017-12-04 16:06:14 -05:00
Anthony Shaw
3611e08a27
import absolute paths 2017-11-29 10:00:41 +11:00
Anthony Shaw
a029f70cff
merge inbound, resolve conflict and remove unfinished state test module 2017-11-29 08:21:53 +11:00
Anthony Shaw
7b3ea6f5b9
mute false negative on linter 2017-11-25 19:03:23 +11:00
Anthony Shaw
0a34c12147
tests for napalm grains module, still issue to resolve on is_proxy 2017-11-25 05:47:27 +11:00
Anthony Shaw
38eb0dd000
more test fixtures 2017-11-24 17:14:14 +01:00
Anthony Shaw
c7106d646c
complete tests for napalm_probes 2017-11-24 16:48:06 +01:00
Anthony Shaw
136816c109
fix missing commas in docstrings 2017-11-24 16:36:38 +01:00
Anthony Shaw
452a8965a3
complete coverage for NTP module 2017-11-24 16:34:16 +01:00
Ch3LL
69134e83ca
Change order of local kwarg in run_call method 2017-11-22 15:50:29 -05:00
Ch3LL
b3b5ecc6ff
Add pillar.items test for masterless 2017-11-22 15:40:57 -05:00
rallytime
052b13c98e
Merge branch '2017.7' into 'develop'
Conflicts:
  - salt/cli/daemons.py
  - salt/client/ssh/__init__.py
  - salt/modules/win_pkg.py
  - salt/netapi/rest_cherrypy/app.py
  - salt/proxy/fx2.py
  - salt/utils/__init__.py
  - salt/utils/jinja.py
  - salt/utils/napalm.py
  - salt/utils/path.py
  - salt/utils/verify.py
  - tests/integration/modules/test_saltutil.py
  - tests/integration/states/test_service.py
  - tests/unit/utils/test_verify.py
2017-11-22 12:36:03 -05:00
Anthony Shaw
dfdb43780d
coverage for ntp testing 2017-11-22 11:36:22 +01:00
Anthony Shaw
5ce67c8a7b
setup all tests for napalm_acl module 2017-11-22 09:01:26 +00:00
Anthony Shaw
cd8d87c61f
create a common module for napalm tests, setup napalm_bgp tests 2017-11-22 08:37:56 +00:00
twangboy
47114fdb30
Pass root_dirs to the win_verify_env function
Remove while loop that was hanging when `salt` wasn't in the path
Add salt.util.path.safe_path function to check for unsafe paths
Pass root_dir to all calls to `verify_env`
2017-11-13 13:05:23 -07:00
rallytime
4e2280157a
Merge branch '2017.7' into 'develop'
Conflicts:
  - .kitchen.yml
  - tests/unit/test_doc.py
  - tests/unit/utils/test_cloud.py
2017-11-13 12:27:59 -05:00
Ch3LL
308596ac8d
Add salt-ssh raw integration tests 2017-11-10 14:47:38 -05:00
Ch3LL
8089a885c2
add wipe function to other run_ssh method 2017-11-10 10:48:31 -05:00
Ch3LL
faef0886a7
Add state tests and state request system to salt-ssh 2017-11-10 10:48:30 -05:00
rallytime
2c052e34b3
Merge branch '2017.7' into 'develop'
Conflicts:
  - .gitignore
  - salt/modules/win_lgpo.py
  - salt/utils/__init__.py
  - tests/integration/spm/test_build.py
  - tests/unit/test_pydsl.py
2017-11-05 20:28:51 -07:00
Mike Place
1412a42f0e
Merge pull request #44070 from gtmanfred/kitchen
begin adding kitchen-salt into the test suite
2017-11-02 15:55:33 -06:00
Nicole Thomas
b2b0c770a4
Merge pull request #44279 from rallytime/merge-2017.7
[2017.7] Merge forward from 2016.11 to 2017.7
2017-10-27 12:17:18 -04:00
Erik Johnson
bd5b9dd0aa Merge pull request #44291 from Ch3LL/pillar_test
add saltutil.refresh_pillar test
2017-10-27 10:19:42 -05:00
Ch3LL
34e2955445
add saltutil.refresh_pillar test 2017-10-25 15:56:49 -04:00
rallytime
8237f45a46
Add print_function to __future__ import list 2017-10-25 14:54:03 -04:00
Ch3LL
03b5c4bc6d
add spm integration tests for remove and build 2017-10-25 12:09:51 -04:00
rallytime
1c3cb5c6a4
Merge branch '2016.11' into '2017.7'
Conflicts:
  - .gitignore
  - tests/unit/states/test_file.py
2017-10-25 10:04:08 -04:00
rallytime
8a1c575ae5
Update salt.utils.fopen calls to new salt.utils.files.fopen path 2017-10-25 09:59:04 -04:00
rallytime
28343f0120
Merge branch '2017.7' into 'develop'
Conflicts:
  - salt/modules/git.py
2017-10-25 09:54:37 -04:00
Daniel Wallace
56a3ad8f68
fix pylint comments 2017-10-24 12:18:27 -06:00
Daniel Wallace
4add666db1
add comment to Gemfile and move copyartifacts
moved copyartifacts.py to tests/support

Also added a comment to the Gemfile that this is only used to run the testsuite with kitchen-salt
2017-10-24 12:01:57 -06:00
Ch3LL
4729ccd32b
Add multiple spm integration tests 2017-10-23 17:13:32 -04:00
rallytime
2617cf851f
Merge branch '2017.7' into 'develop'
Conflicts:
  - salt/modules/aptpkg.py
  - salt/utils/win_functions.py
  - tests/unit/states/test_mount.py
2017-10-20 10:44:29 -04:00
Nicole Thomas
f0175623ed Merge branch 'develop' into ssh_known_hosts_improvements 2017-10-19 13:44:29 -04:00
Ch3LL
cd79e9444e
remove unneded kwarg 2017-10-18 17:21:52 -04:00
Ch3LL
1541376c4f
Add spm build test 2017-10-18 17:15:42 -04:00
Daniel Wallace
7410ffd92a
add first kitchen test 2017-10-17 14:59:10 -06:00
rallytime
c0f16dae74
Merge branch '2017.7' into 'develop'
Conflicts:
  - doc/topics/tutorials/index.rst
  - salt/crypt.py
  - salt/modules/cmdmod.py
  - salt/modules/grains.py
  - salt/pillar/git_pillar.py
  - salt/roster/clustershell.py
  - tests/unit/states/test_augeas.py
  - tests/unit/utils/test_utils.py
2017-10-16 15:26:19 -04:00
Erik Johnson
877abb89d0
Complete the salt.utils refactor
This moves the remaining 30 functions from salt.utils to new locations.
2017-10-15 09:43:31 -05:00