Commit Graph

327 Commits

Author SHA1 Message Date
rallytime
84ec655c24
Merge branch '2017.7' into '2018.3'
Conflicts:
  - doc/ref/configuration/minion.rst
  - salt/minion.py
  - salt/modules/dockermod.py
  - salt/modules/lxc.py
  - salt/utils/__init__.py
  - tests/unit/modules/test_mount.py
2018-06-21 14:22:15 -04:00
Ch3LL
236773e3e9
Skip new sha256 files on repo.saltstack.com/windows 2018-06-20 14:28:31 -04:00
Erik Johnson
1cbe89feee
Implement tell() for filehandle iteration 2018-06-18 16:23:35 -05:00
Erik Johnson
38df912fa6
Operate on a copy of the read_data
This keeps us from mangling it if it contains lists, which we would be
popping items off of. We don't want to pop items from the list that was
passed in.
2018-06-18 14:45:40 -05:00
Erik Johnson
67c036dc2d
Add MockCall to tests.support.mock to track calls 2018-06-18 10:34:33 -05:00
Erik Johnson
fd9d700157
Add additional docs to MockOpen class 2018-06-18 00:28:06 -05:00
Erik Johnson
fc0aa9934f
Track call_count in MockOpen 2018-06-18 00:21:26 -05:00
Erik Johnson
51b3faa7b4
Add support for passing multiple strings for a given match in read_data 2018-06-18 00:21:26 -05:00
Erik Johnson
f5823252bb
Track call args/kwargs in MockFH
This allows for them to be verified in tests
2018-06-18 00:21:25 -05:00
Erik Johnson
335591ca90
Mock the seek function in MockFH 2018-06-18 00:21:25 -05:00
Erik Johnson
2be19cfa89
Report correct location when reading using explicit size and EOF reached 2018-06-18 00:21:25 -05:00
Erik Johnson
5ec95ba5ca
On second thought, actually implement tell() 2018-06-18 00:21:25 -05:00
Erik Johnson
19022eb9e5
Add tell mock to MockFH 2018-06-18 00:21:25 -05:00
Erik Johnson
4e67955572
Replace the rest of mock_open with a class 2018-06-18 00:21:25 -05:00
Erik Johnson
836fde9a30
Allow Python 2 to accept an exception as read_data 2018-06-18 00:21:25 -05:00
Erik Johnson
543385fd02
Add writelines_calls property 2018-06-18 00:21:25 -05:00
Erik Johnson
42fa842456
Make read funcs mocks so their calls can be tracked
Also add a property func as a shorthand to return all the write calls
for a given filehandle.
2018-06-18 00:21:25 -05:00
Erik Johnson
b9200dbc3e
add a dict containing the handles to the mock_open return object
This allows tests to access the MockFH objects opened during the
execution of the unit test.
2018-06-18 00:16:03 -05:00
Erik Johnson
852ba4b982
Add mocked close() function to MockFH 2018-06-18 00:16:02 -05:00
Erik Johnson
1861e9b944
mock_open: rewrite multi-file support
The initial approach tied all opened files to the same mocked
filehandle. This new approach moves all the read functions into a class,
and then uses a separate instance of that class for each opened file.
2018-06-18 00:16:02 -05:00
Erik Johnson
5e6b539770
Use function for empty string
Missed this when making changes for multi-file support
2018-06-18 00:16:02 -05:00
Erik Johnson
5d09b178d7
Separate mocked file contents per filename, not glob
This allows for multiple opens of a file matching the same glob.
Otherwise, subsequent opens would already be at EOF.
2018-06-18 00:16:02 -05:00
Erik Johnson
875102f538
Modify mock_open to support multiple file paths 2018-06-18 00:16:02 -05:00
Erik Johnson
8ba6cadac7
More mock_open bugfixes
This makes readline() a regular function and not an iterator. It also
makes the different side_effect functions all operate on the same
generator representing the file contents, and adds support for reading
an explicit amount of bytes from the file. The side effect functions can
now be run one after another and the mocked filehandle will work
properly.
2018-06-18 00:16:02 -05:00
rallytime
f23207002d
Merge branch '2018.3' into 'develop'
Conflicts:
  - salt/states/file.py
  - tests/unit/beacons/test_btmp_beacon.py
  - tests/unit/beacons/test_wtmp_beacon.py
  - tests/unit/grains/test_core.py
2018-06-15 17:00:59 -04:00
rallytime
398cc78224
Merge branch '2017.7' into '2018.3'
Conflicts:
  - .kitchen.yml
  - doc/topics/releases/2017.7.6.rst
  - salt/modules/timezone.py
  - tests/support/case.py
  - tests/unit/modules/test_timezone.py
2018-06-15 16:51:45 -04:00
Ch3LL
48b5d2e9d3
Add timeout argument to run_salt for ShellCase 2018-06-14 16:19:33 -04:00
Erik Johnson
e6a4744f85
Use errno instead of hard-coding error 2 2018-06-13 01:11:55 -05:00
Erik Johnson
ff63f36932
Fixes / enhancements for mock_open
This makes the following changes:

1. Now works properly when read_data is a bytestring
2. Now works properly when mocked filehandle is iterated (e.g. `for line in fh:`)
3. Adds ability to make mocked filehandle raise an IOError when the path
   being opened doesn't match a pattern (or one of a list of patterns).
2018-06-13 01:05:44 -05:00
plastikos
a6a5441510
Merge branch 'develop' into issue-13889 2018-06-08 11:23:11 -06:00
plastikos
540bcde985
Merge branch 'develop' into issue-13889 2018-06-08 01:50:02 -06:00
rallytime
d991430715
Merge branch '2018.3' into 'develop'
No conflicts.
2018-06-07 13:03:54 -04:00
rallytime
7dc1e770c4
Merge branch '2018.3' into 'develop'
Conflicts:
  - doc/topics/installation/freebsd.rst
  - salt/cloud/clouds/oneandone.py
  - salt/grains/core.py
  - salt/modules/napalm_ntp.py
  - salt/modules/win_update.py
  - salt/modules/win_wua.py
  - salt/modules/zabbix.py
  - salt/renderers/pass.py
  - salt/states/vault.py
  - tests/unit/states/test_win_update.py
2018-06-06 13:35:36 -04:00
Erik Johnson
41e5a75027
Add catch_timeout to run_script
One of the tests depends on forcing a timeout, but since we no longer
include the timeout message in the stdout/stderr return, we needed a way
to return whether or not the script timed out.
2018-06-06 09:04:09 -05:00
Erik Johnson
a1ce0631fd
Use @property instead of @staticmethod for config_dir
We're not passing arguments and we're just getting back a string
contstant, so there's no need to make this a staticmethod.
2018-06-05 14:10:33 -05:00
Erik Johnson
551ada8e4d
Capture and log output of processes that timed out and were killed
Before, tests.support.case.ShellTestCase.run_script would just go
¯\_(ツ)_/¯ and return that it killed the process. But you can still run
`.communicate()` on a process that was terminated, so this commit does
that and uses it to log the output from the killed process.
2018-06-05 13:33:39 -05:00
Nicole Thomas
a46e42ab11
Merge pull request #47927 from rallytime/merge-2018.3
[2018.3] Merge forward from 2017.7 to 2018.3
2018-06-04 14:55:11 -04:00
Erik Johnson
af02d5ba7b
Add result logging to run_script, make returns DRY 2018-06-04 00:17:41 -05:00
rallytime
be8d34ec21
Merge branch '2018.3' into 'develop'
No conflicts.
2018-06-01 15:19:09 -04:00
rallytime
3273bbdab7
Merge branch '2017.7' into '2018.3'
Conflicts:
  - doc/ref/configuration/master.rst
  - doc/ref/modules/all/index.rst
  - doc/topics/grains/index.rst
  - doc/topics/releases/2016.3.4.rst
  - doc/topics/spm/spm_formula.rst
  - doc/topics/tutorials/cron.rst
  - doc/topics/tutorials/index.rst
  - doc/topics/tutorials/stormpath.rst
  - salt/engines/slack.py
  - salt/log/handlers/fluent_mod.py
  - salt/modules/cyg.py
  - salt/modules/junos.py
  - salt/modules/namecheap_dns.py
  - salt/modules/namecheap_domains.py
  - salt/modules/namecheap_ns.py
  - salt/modules/namecheap_ssl.py
  - salt/modules/namecheap_users.py
  - salt/modules/reg.py
  - salt/modules/tomcat.py
  - salt/modules/vault.py
  - salt/modules/win_file.py
  - salt/modules/zpool.py
  - salt/output/highstate.py
  - salt/renderers/pass.py
  - salt/runners/cache.py
  - salt/states/boto_apigateway.py
  - salt/states/boto_iam.py
  - salt/states/boto_route53.py
  - salt/states/msteams.py
  - salt/states/reg.py
  - salt/states/win_iis.py
  - tests/integration/modules/test_cmdmod.py
  - tests/integration/states/test_user.py
  - tests/support/helpers.py
  - tests/unit/cloud/clouds/test_openstack.py
  - tests/unit/fileserver/test_gitfs.py
  - tests/unit/modules/test_junos.py
  - tests/unit/pillar/test_git.py
  - tests/unit/states/test_win_path.py
  - tests/unit/test_pillar.py
  - tests/unit/utils/test_format_call.py
  - tests/unit/utils/test_utils.py
  - tests/unit/utils/test_warnings.py
2018-06-01 14:54:12 -04:00
Nicole Thomas
a2b588299b
Merge pull request #47860 from terminalmage/state-writing-docs
Clean up doc build warnings, add best practices for writing states
2018-06-01 10:42:54 -04:00
Daniel Wallace
735e92093e
Merge pull request #47917 from dwoz/winsuite
Fix windows tests suite breakage
2018-06-01 06:42:14 -05:00
Daniel A Wozniak
118601ebd6
Fix windows tests suite breakage 2018-05-31 23:17:18 -07:00
Erik Johnson
93ee5ee2b0
Fix all Sphinx warnings
Well, all but one, which we expect to see
2018-05-31 15:28:25 -05:00
Nicole Thomas
ae73cb3947
Merge pull request #47899 from terminalmage/salt-jenkins-1000
salt-jenkins issue 1000
2018-05-31 14:24:48 -04:00
Erik Johnson
25afc932f7
WIP salt-jenkins issue 1000
This adds logging of the output and retcode when the output file fails
to be created. As I have thus far been unable to reproduce this locally,
this is the best shot at seeing what is causing the issue, since
ShellCase's run_script is rather opaque about what happens in the script
itself. We do know from the salt-runtests.log that the `salt-call -g` is
successfully returning, what we don't know is what happened after that
data was returned, and this should provide that insight.
2018-05-30 11:40:51 -05:00
rallytime
120ee16b70
Replace old utils paths with new utils paths 2018-05-29 11:19:34 -04:00
rallytime
dc32b67c03
Merge branch '2017.7' into '2018.3'
Conflicts:
  - salt/modules/win_snmp.py
  - tests/integration/modules/test_saltutil.py
  - tests/integration/states/test_pkg.py
  - tests/support/helpers.py
  - tests/support/runtests.py
  - tests/unit/fileserver/test_gitfs.py
  - tests/whitelist.txt
2018-05-29 11:14:39 -04:00
Daniel A. Wozniak
c2f8aef7c5
Fix for py3 ec2 cloud tests 2018-05-27 14:09:50 -07:00
Daniel A. Wozniak
e5948902af
Use salt utils method for this_user 2018-05-24 00:40:20 -07:00
Daniel A. Wozniak
a056a293f1
Centeralize test username lookup 2018-05-23 16:16:35 -07:00
Daniel A Wozniak
6a6ab69722
Get the current username on windows 2018-05-23 16:16:32 -07:00
rallytime
4abfd26e86
Merge branch '2017.7' into '2018.3'
Conflicts:
  - requirements/dev_python27.txt
  - requirements/dev_python34.txt
  - salt/fileclient.py
  - salt/output/__init__.py
  - salt/serializers/configparser.py
  - salt/states/pkg.py
  - salt/states/zpool.py
  - salt/transport/tcp.py
  - tests/integration/cloud/providers/test_ec2.py
  - tests/integration/modules/test_mac_user.py
  - tests/integration/modules/test_pip.py
  - tests/integration/modules/test_pkg.py
  - tests/integration/modules/test_service.py
  - tests/integration/states/test_pip_state.py
  - tests/integration/states/test_user.py
  - tests/unit/modules/test_cmdmod.py
2018-05-23 12:33:00 -04:00
plastikos
9dd9430378
Merge branch 'develop' into issue-13889 2018-05-17 23:10:44 -06:00
Erik Johnson
3b449f11fc
Add regression test for excludes issue 2018-05-16 12:26:46 -05:00
rallytime
969296ecbe
Merge branch '2018.3' into 'develop'
No conflicts.
2018-05-15 12:38:01 -04:00
plastikos
19e53fe943
Merge branch 'develop' into issue-13889 2018-05-15 10:35:59 -06:00
rallytime
cf58ae22bf
Merge branch '2018.3' into 'develop'
Conflicts:
  - salt/states/pip_state.py
  - tests/unit/utils/test_stringutils.py
2018-05-09 11:40:54 -04:00
rallytime
25f03ae425
Merge branch '2017.7' into '2018.3'
Conflicts:
  - tests/integration/modules/test_status.py
  - tests/integration/states/test_pip_state.py
  - tests/support/case.py
  - tests/whitelist.txt
2018-05-09 11:24:02 -04:00
rallytime
2ad60c7e81
Lint: remove duplicate function in helpers.py 2018-05-07 15:45:30 -04:00
rallytime
786076ac03
Merge branch '2017.7' into '2018.3'
Conflicts:
  - pkg/windows/modules/get-settings.psm1
  - salt/modules/cmdmod.py
  - salt/modules/pip.py
  - salt/modules/win_lgpo.py
  - salt/states/pip_state.py
  - tests/integration/states/test_pip.py
  - tests/support/helpers.py
  - tests/unit/modules/test_pip.py
  - tests/whitelist.txt
2018-05-07 13:17:01 -04:00
Daniel A Wozniak
c6697b9f16
Move kill process tree and re-use it 2018-05-06 09:44:55 -07:00
Daniel Wozniak
6a4d0380b1
Merge pull request #47493 from dwoz/win_run_timeout
Add support for windows timeout to run_salt
2018-05-05 22:34:30 -07:00
Daniel A Wozniak
fec1233dc4
Add support for windows timeout to run_salt
The run_salt function needs to support timeout on windows for the full
test suite to run.
2018-05-05 15:10:14 -07:00
Thayne Harbaugh
485e151507 Support Jinja imports with relative paths. Issue #13889
Jinja imports will be interpreted as originating from the top of each
of the directories in the searchpath when the template name does not
begin with './' or '../'.  When a template name begins with './' or
'../' then the import will be relative to the importing file.

Prior practices required the following construct:

.. code-block:: yaml

  {% from tpldir ~ '/foo' import bar %}

This patch supports a more "natural" construct:

.. code-block:: yaml

  {% from './foo' import bar %}

Comparatively when importing from a parent directory - prior practice:

.. code-block:: yaml

  {% from tpldir ~ '/../foo' import bar %}

Construct supported by this patch:

.. code-block:: yaml

  {% from '../foo' import bar %}
2018-05-04 17:14:01 -06:00
rallytime
bd184a257f
Merge branch '2018.3' into 'develop'
Conflicts:
  - tests/unit/grains/test_core.py
2018-05-02 15:28:21 -04:00
twangboy
14ee5537b9
Add @with_tempdir helper
Fix two state tests
Remove redundent tests
2018-05-02 12:17:36 -06:00
Shane Lee
f031710af2
Merge branch '2017.7' into fix_47024 2018-05-01 16:26:04 -06:00
twangboy
7c46d9d0d4
Fix integration.modules.test_pip
Pass password as kwarg for runas on Windows
Fix issues with pip 10 in unit.states.test_pip
2018-05-01 15:33:29 -06:00
rallytime
13e8124031
Merge branch '2017.7' into '2018.3'
Due to the many merge conflicts created from #47106 against the 2017.7 branch
and #46002 against the 2018.3 branch, the changes from #47106 have been largely
removed from this merge forward and the HEAD of 2018.3 was taken.

A separate fix for Tornado 5.0 support will need to be made directly against the
2018.3 branch.

Conflicts:
  - doc/topics/development/conventions/formulas.rst
  - salt/master.py
  - salt/minion.py
  - salt/netapi/rest_tornado/saltnado.py
  - salt/states/zfs.py
  - salt/transport/ipc.py
  - salt/transport/tcp.py
  - salt/transport/zeromq.py
  - salt/utils/async.py
  - tests/support/helpers.py
  - tests/support/parser/cover.py
  - tests/unit/grains/test_core.py
  - tests/unit/modules/test_ssh.py
  - tests/unit/test_minion.py
  - tests/unit/utils/test_safe_walk.py
2018-04-27 13:38:35 -04:00
Nicole Thomas
aacd5cefe3
Merge pull request #47304 from cachedout/test_cli_timeout_arg
Pass timeout to salt CLI for tests
2018-04-27 09:11:57 -04:00
Daniel A. Wozniak
94a70e847a
Ignore gitfs tests when symlinks not enabled 2018-04-26 23:51:28 -07:00
Mike Place
85025af83c
Pass timeout to salt CLI for tests
This should hopefully fix up the race condition in the long-running
jobs test.
2018-04-25 11:04:59 -05:00
rallytime
0eab957281
Merge branch '2018.3' into 'develop'
Conflicts:
  - salt/netapi/rest_tornado/saltnado.py
  - tests/integration/states/test_file.py
  - tests/integration/states/test_git.py
  - tests/unit/modules/test_tls.py
2018-04-20 15:40:49 -04:00
Daniel A. Wozniak
ad9c7f63f0
Fix coverate on py3 windows builds
Setting a value for will cause coverage to look for a config file called
named '1' and in-turn raises an Exception. Based on the docs, if the
environment variable exists coverage is enabled. Just defined the
environment variable instead of giving it a value.
2018-04-20 12:30:43 -07:00
Daniel A. Wozniak
25803c9176
Move process target to top level module namespace 2018-04-19 18:38:28 -07:00
Nicole Thomas
1947ffdf56
Merge pull request #47122 from rallytime/merge-2018.3
[2018.3] Merge forward from 2017.7 to 2018.3
2018-04-19 16:44:17 -04:00
Nicole Thomas
3d812f64b2
Merge pull request #47040 from terminalmage/new-decorators
Add ability to run a shell command to depends decorator
2018-04-19 15:30:25 -04:00
Erik Johnson
879c557264
Use decorators for temp files/dirs in test suite
This adds a new decorator which creates a temporary directory and cleans
it after the test completes. It also modifies an existing decorator for
creating temporary files so that it accepts arguments, which will be
passed through to salt.utils.files.mkstemp().
2018-04-18 19:46:29 -05:00
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