Commit Graph

30 Commits

Author SHA1 Message Date
rallytime
2317b5ef58
Merge branch '2017.7' into '2018.3'
Conflicts:
  - salt/client/ssh/__init__.py
  - tests/integration/modules/test_win_ntp.py
2018-09-04 12:01:38 -04:00
Daniel A. Wozniak
f214929740 Fix a flaky test and mark another as flaky 2018-08-31 20:20:10 +00:00
rallytime
f7226f400f
Merge branch '2017.7' into '2018.3'
Conflicts:
  - pkg/osx/build_env.sh
  - salt/modules/win_useradd.py
  - salt/utils/yamldumper.py
  - tests/integration/modules/test_archive.py
  - tests/integration/output/test_output.py
2018-08-30 14:23:23 -04:00
Daniel Wallace
be7c041d75
add test 2018-08-28 21:14:05 -05:00
Daniel A. Wozniak
7d045eb235
Fix decorator wart 2018-04-24 19:09:08 -07:00
Daniel Wozniak
f591cff643
Merge pull request #47290 from dwoz/test_cp_fix
Run cache_master test in tmp dir
2018-04-24 16:37:20 -07:00
Daniel A. Wozniak
5ff51affbd
Run cache_master test in tmp dir 2018-04-24 14:58:20 -07: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
a0fcd5c053
Fix test_cp failure: forgot to add tgt to test when @with_tempfile is present 2018-04-04 11:43:03 -04:00
rallytime
d0202cab72
Resolve bad merge: there should only be one test_get_file_from_env_in_url test 2018-04-03 16:19:12 -04:00
rallytime
4ad50bbdee
Update old utils paths to new paths 2018-04-03 14:46:56 -04: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
twangboy
5afc66452c
Remove unused/redundant imports 2018-03-28 12:30:26 -06:00
twangboy
88fd72c52c
Use with_tempfile decorator where possible 2018-03-28 11:38:32 -06:00
rallytime
7243baf2c0
Merge branch '2017.7' into '2018.3'
Conflicts:
  - doc/topics/orchestrate/orchestrate_runner.rst
  - salt/grains/core.py
  - salt/modules/git.py
  - salt/pillar/ec2_pillar.py
  - salt/runner.py
  - salt/utils/ssh.py
  - tests/integration/modules/test_cp.py
  - tests/unit/grains/test_core.py
  - tests/unit/modules/test_file.py
  - tests/unit/modules/test_git.py
2018-02-27 17:13:28 -05:00
Erik Johnson
0eb012659c
Fix hanging tests in integration suite
A recent change to nginx appears to be causing this test to fail to
cache the test file in the temp nginx instance we've spun up. This
causes the return of cp.cache_file to be False, which in and of itself
should be enough to fail the test. But since we're not asserting on the
cp.cache_file results, flow proceeds to the next block of code, in which
we open the "file" that we cached. Some genius thought it would be a
swell idea to make io.open() successfully open a filehandle when the
path passed to it is a boolean False. When you try to read from this
filehandle, an AMAZING thing happens... It just blocks. Forever. I know,
right? Pure genius.

This commit adds an assert so that the test fails gracefully and doesn't
try to read from a bogus filehandle that SHOULDN'T EVEN EXIST.
2018-02-27 13:32:57 -06:00
Erik Johnson
9c86cd627a
[PY3] Add unicode_literals to high-priority modules/states 2018-01-24 10:33:58 -06:00
Erik Johnson
3184168365 Use explicit unicode strings + break up salt.utils
This PR is part of what will be an ongoing effort to use explicit
unicode strings in Salt. Because Python 3 does not suport Python 2's raw
unicode string syntax (i.e. `ur'\d+'`), we must use
`salt.utils.locales.sdecode()` to ensure that the raw string is unicode.
However, because of how `salt/utils/__init__.py` has evolved into the
hulking monstrosity it is today, this means importing a large module in
places where it is not needed, which could negatively impact
performance. For this reason, this PR also breaks out some of the
functions from `salt/utils/__init__.py` into new/existing modules under
`salt/utils/`. The long term goal will be that the modules within this
directory do not depend on importing `salt.utils`.

A summary of the changes in this PR is as follows:

* Moves the following functions from `salt.utils` to new locations
  (including a deprecation warning if invoked from `salt.utils`):
  `to_bytes`, `to_str`, `to_unicode`, `str_to_num`, `is_quoted`,
  `dequote`, `is_hex`, `is_bin_str`, `rand_string`,
  `contains_whitespace`, `clean_kwargs`, `invalid_kwargs`, `which`,
  `which_bin`, `path_join`, `shlex_split`, `rand_str`, `is_windows`,
  `is_proxy`, `is_linux`, `is_darwin`, `is_sunos`, `is_smartos`,
  `is_smartos_globalzone`, `is_smartos_zone`, `is_freebsd`, `is_netbsd`,
  `is_openbsd`, `is_aix`
* Moves the functions already deprecated by @rallytime to the bottom of
  `salt/utils/__init__.py` for better organization, so we can keep the
  deprecated ones separate from the ones yet to be deprecated as we
  continue to break up `salt.utils`
* Updates `salt/*.py` and all files under `salt/client/` to use explicit
  unicode string literals.
* Gets rid of implicit imports of `salt.utils` (e.g. `from salt.utils
  import foo` becomes `import salt.utils.foo as foo`).
* Renames the `test.rand_str` function to `test.random_hash` to more
  accurately reflect what it does
* Modifies `salt.utils.stringutils.random()` (née `salt.utils.rand_string()`)
  such that it returns a string matching the passed size. Previously
  this function would get `size` bytes from `os.urandom()`,
  base64-encode it, and return the result, which would in most cases not
  be equal to the passed size.
2017-08-08 13:33:43 -05:00
rallytime
ccf790a83f Update all references for moved functions to use "files" util
- fopen
- flopen
- fpopen
- safe_rm
- is_empty
- is_fcntl_available
2017-07-18 10:31:01 -06:00
jmacfar
dba9558b73 Support cp.get_file|url to download files to a directory
Integrations tests
2017-06-16 10:45:18 -05:00
Erik Johnson
c512142899 Add integration test for cp.cache_file 2017-06-01 17:20:58 -05:00
Pedro Algarvio
61003bca0a
Take care of resource leakage on tests 2017-04-04 18:58:20 +01:00
Pedro Algarvio
2ee6d5d589
Import from the original modules not tests.integration 2017-04-04 18:58:19 +01:00
Pedro Algarvio
b58241648a
Use the tests support paths module 2017-03-08 18:34:34 +00:00
Pedro Algarvio
979090d225
We need bytes under Py3 to compute the hash 2017-03-02 19:56:04 +00:00
Pedro Algarvio
40a64191a1
Absolute imports and A LOT of code cleanup. 2017-03-01 01:33:07 +00:00
Pedro Algarvio
3beb3fb801
Move whatever we need from salttesting to salt.
Let's drop the salttesting dependency cycle.
2017-02-28 22:52:49 +00:00
Pedro Algarvio
7278a6c868
You need to pass a list. How did this ever pass?! 2017-02-28 22:52:48 +00:00
Erik Johnson
9f6d08d606 Update tests which used string kwargs 2017-02-25 20:11:06 -06:00
Pedro Algarvio
15af4c9728
Test filenames conformity. Adjust for pytest. 2017-02-23 23:19:42 +00:00