rallytime
15bfba7143
Merge branch '2017.7' into '2018.3'
...
Conflicts:
- salt/modules/slsutil.py
- salt/modules/win_timezone.py
- salt/states/pkg.py
- tests/integration/states/test_pkg.py
2018-07-31 18:18:58 -04:00
Gareth J. Greenaway
11cb86e6eb
General cleanup in pkg state, reducing duplicate code. Fixing the requires_salt_modules decorator, sys.doc was returning too much information for the event to handle. This change specifically calls sys.doc with the module name.
2018-07-31 09:46:05 -07:00
Nicole Thomas
27a0e95174
Merge pull request #48279 from terminalmage/mock_open-docs
...
Add documentation/further enhancements to rewritten mock_open
2018-06-25 09:12:29 -04:00
Erik Johnson
3b6356f4b0
Raise TypeError when trying to read from filehandles not opened for reading
2018-06-23 21:27:58 -05:00
Erik Johnson
0e8c83bac6
2 MockFH enhancements:
...
1. Raise appropriate TypeErrors when wrong type is written
2. Don't raise exception about read_data unless we actually try to read
from the filehandle. This makes it a bit more permissive when testing
code where the file is only being written to.
2018-06-23 15:00:26 -05:00
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
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
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
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
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