Commit Graph

9187 Commits

Author SHA1 Message Date
Pedro Algarvio
8337a164ee
Make sure we have the required library before even calling vb_machine_exists 2017-02-23 23:19:44 +00:00
Pedro Algarvio
ea2cb8470e
Py2 compat 2017-02-23 23:19:44 +00:00
Pedro Algarvio
fbc2af52fc
Full module path import 2017-02-23 23:19:44 +00:00
Pedro Algarvio
2ebb0a56cc
Port some more options of runtests.py 2017-02-23 23:19:44 +00:00
Pedro Algarvio
bb5757c74f
A little hackish but enough to prove it runs 2017-02-23 23:19:43 +00:00
Pedro Algarvio
cb7a25e4a2
Somehow salt.utils.boto3 is "landing" as boto3 in sys.modules 2017-02-23 23:19:43 +00:00
Pedro Algarvio
1e2753c875
Fix imports after renames 2017-02-23 23:19:43 +00:00
Pedro Algarvio
5576f6ed33
Gate it! 2017-02-23 23:19:42 +00:00
Pedro Algarvio
bc728001a7
Start laying out py.test conftest.py. Add destructive_test marker support. 2017-02-23 23:19:42 +00:00
Pedro Algarvio
5d5a3ee01e
All tests now follow the test_*.py pattern. 2017-02-23 23:19:42 +00:00
Pedro Algarvio
15af4c9728
Test filenames conformity. Adjust for pytest. 2017-02-23 23:19:42 +00:00
Nicole Thomas
e6f5e8a474 Merge pull request #39565 from terminalmage/issue39512
states.file.patch/modules.file.check_hash: use hash length to determine type
2017-02-23 12:14:27 -07:00
Erik Johnson
cbdf905b9f Update test to reflect new state comment 2017-02-23 11:21:33 -06:00
Pedro Algarvio
ce71f6d45f
Code cleanup 2017-02-23 12:55:53 +00:00
Pedro Algarvio
9bb56da613
Fix skipIf call and _docker_py_version 2017-02-23 12:55:52 +00:00
Pedro Algarvio
1416dd2e9a
We must compare tuples 2017-02-23 10:40:59 +00:00
Pedro Algarvio
8dc1c780b7
Add missing mock patch 2017-02-23 10:40:58 +00:00
Pedro Algarvio
e48ea8fa1b
Don't use assert_called_once() or assert_not_called().
These worked in Py2 but not in Py3.
A read of http://engineroom.trackmaven.com/blog/mocking-mistakes/ specially the section "Mocking the unexpected" will enlighten one.
2017-02-23 10:40:58 +00:00
Pedro Algarvio
e16dc832b2
Code cleanup. Tests are not destructive. Py3 compat. 2017-02-23 10:40:58 +00:00
Mike Place
43e3cafac5 Merge pull request #39580 from twangboy/win_fix_fileserver_roots_tests
Fix fileserver roots tests for Windows
2017-02-22 19:16:30 -07:00
Mike Place
4279c39f41 Merge pull request #39576 from rallytime/merge-develop
[develop] Merge forward from 2016.11 to develop
2017-02-22 19:09:56 -07:00
rallytime
5db986860c [develop] Fix some pylint errors that snuck into develop 2017-02-22 17:02:21 -07:00
twangboy
db645da0bf Fix fileserver roots tests for Windows 2017-02-22 16:53:27 -07:00
rallytime
7b9b3f700d Merge branch '2016.3' into '2016.11'
Conflicts:
  - salt/modules/dockerng.py
  - salt/states/dockerng.py
2017-02-22 16:27:08 -07:00
rallytime
2595ac383d Merge branch '2016.11' into 'develop'
Conflicts:
  - salt/config/__init__.py
  - salt/modules/docker.py
  - salt/states/docker.py
2017-02-22 16:24:36 -07:00
Mike Place
c10965833a Merge pull request #39289 from bobrik/autodetect-ipv6
Autodetect IPv6 connectivity from minion to master
2017-02-22 12:05:32 -07:00
Sergei Zviagintsev
ad5b52ce3c Add unit test for salt.utils.cloud.check_key_path_and_mode 2017-02-22 11:38:40 +01:00
Sergei Zviagintsev
313e9cae06 Add unit test for _validate_key_file_permissions in ec2 module 2017-02-22 11:38:40 +01:00
Pedro Algarvio
0b3071ee3a
.iter<items|keys|values>() Py3 compatibility 2017-02-22 10:20:26 +00:00
rallytime
c613d19e76 Merge branch '2016.3' into '2016.11'
Conflicts:
  - salt/modules/dockerng.py
  - salt/states/dockerng.py
2017-02-21 13:59:14 -07:00
Mihai Dinca
9fedb84607 Always return oscap's stderr 2017-02-20 10:36:01 +01:00
Mihai Dinca
0ecde2cd02 Include oscap returncode in response 2017-02-20 10:36:01 +01:00
Erik Johnson
ec2b617a5d Fixes for docker tests
These tests were failing because of improper mocking. The mocks were
assigned to the __salt__ dunder but we should have been patching the
attributes of the docker execution module directly.
2017-02-18 21:58:25 -06:00
Erik Johnson
c673d06f48 Rename dockerng state/execution module to docker 2017-02-18 21:58:25 -06:00
Erik Johnson
6e24dd85c4 Remove dockerio state/module (moved to salt-contrib) 2017-02-18 21:58:24 -06:00
Mike Place
deba6d2655 Merge pull request #39367 from gtmanfred/develop
add extmod_blacklist to make it easier to remove modules
2017-02-17 16:57:44 -07:00
Mike Place
179e143272 Merge pull request #39385 from curiositycasualty/develop
modules.file: Return true when a symlink is already in desired state
2017-02-17 15:24:53 -07:00
Mike Place
0c411bfbb0 Merge pull request #39430 from s0undt3ch/features/py3
More Py3 Fixes
2017-02-17 15:24:12 -07:00
twangboy
77d3a584a4 Set hard limit on Windows 2017-02-17 13:52:27 -07:00
Pedro Algarvio
2ed05ab399
We really don't need to be root to run these 2017-02-17 20:48:58 +00:00
Pedro Algarvio
20882bfcb4
These tests require root for default paths and create directories if non existing 2017-02-17 20:48:57 +00:00
Pedro Algarvio
a8e32cf076
**kwargs ordering is different under Py3 2017-02-17 20:48:56 +00:00
Pedro Algarvio
f921c1e131
Sort before asserting since the order changes between py2 and py3 2017-02-17 20:48:56 +00:00
Pedro Algarvio
9503045b05
Use tempfile.gettempdir() since that depends on current user and distro setup 2017-02-17 20:48:56 +00:00
Pedro Algarvio
33d8832e40
Assert different outcome under Py3 2017-02-17 20:48:56 +00:00
Pedro Algarvio
90adbe925f
Force dictionary order 2017-02-17 20:48:56 +00:00
Pedro Algarvio
9b2d79317a
Handle different test outcome under Py3 2017-02-17 20:48:55 +00:00
Pedro Algarvio
1d060096e3
Force ordering under Py3 2017-02-17 20:48:55 +00:00
Pedro Algarvio
04b4d0947e
Disable tests on Py3.
The order of attributes is sketchy under Py3 and this code will be
deprecated.
2017-02-17 20:48:55 +00:00
Pedro Algarvio
c093d97a93
Only run the ascii case on Py2 2017-02-17 20:48:55 +00:00
Pedro Algarvio
20a4d7bb39
Under Py3, stat.S_ISLNK() expects an integer. Mock it. 2017-02-17 20:47:55 +00:00
Mike Place
9c4292fb4e Merge pull request #39423 from dincamihai/openscap
Openscap module
2017-02-17 11:31:04 -07:00
Mike Place
e85eff4865 Merge pull request #39468 from twangboy/win_git_test_init
Fix test_init for Windows
2017-02-17 09:57:12 -07:00
Mihai Dinca
9d13422ac1 OpenSCAP module 2017-02-17 13:50:29 +01:00
twangboy
812c857770 Fix test_init for Windows 2017-02-16 16:00:45 -07:00
Nicole Thomas
1577bb68af Merge pull request #39459 from rallytime/merge-develop
[develop] Merge forward from 2016.11 to develop
2017-02-16 14:30:31 -07:00
Mike Place
e652a45592
Fix mocks in win_disim tests 2017-02-16 12:26:49 -07:00
rallytime
dda39d4e63 Merge branch '2016.11' into 'develop'
Conflicts:
  - salt/minion.py
  - salt/modules/file.py
  - salt/modules/grains.py
  - salt/utils/gitfs.py
2017-02-16 12:18:46 -07:00
Megan Wilhite
1acf00da3b add 2016.11.3 changelog to release notes (#39451) 2017-02-16 10:49:53 -07:00
rallytime
3a8bd786e0 Remove global dunder definistions from tests
These dunders are already being mocked appropriately below in the test, so we
don't need to define them in the test module's namespace.

The global definitions here were conflicting with the globals defined in
`saltmod_test.py`, and causing the following stacktrace in the test suite:

```
Traceback (most recent call last):
  File "/root/SaltStack/salt/tests/unit/saltmod_test.py", line 71, in test_state
    self.assertDictEqual(saltmod.state(name, tgt, highstate=True), test_ret)
  File "/root/SaltStack/salt/salt/states/saltmod.py", line 252, in state
    masterless = __opts__['__role'] == 'minion' and \
KeyError: '__role'
```
2017-02-16 10:33:32 -07:00
Mike Place
16332ae957 Merge pull request #39433 from twangboy/win_new_tests
Add additional tests to the Windows whitelist
2017-02-15 17:03:17 -07:00
twangboy
2e9122e134 Fix fileserver.fileclient reference 2017-02-15 22:44:09 +00:00
rallytime
2acb188ac9 Change `path` value from a tuple to a list
The type of the ``path`` value changed in #38188.

This updates the type in the unit test, as well as rearranges some
of the imports to be more standardized with ``ensure_in_syspath``.
2017-02-15 15:39:53 -07:00
twangboy
98d5cc3e1b Add additional tests to the Windows whitelist 2017-02-15 21:21:55 +00:00
Joseph Hall
b34d42f98c Add version control to SPM repo creation 2017-02-15 14:21:03 -07:00
Daniel Wallace
d332b33c8a add extmod_blacklist to make it easier to remove modules 2017-02-15 12:47:32 -06:00
rallytime
6d78adbf08 Merge branch '2016.3' into '2016.11'
Conflicts:
  - doc/topics/tutorials/gitfs.rst
  - salt/fileserver/roots.py
  - salt/loader.py
2017-02-15 10:35:02 -07:00
Erik Johnson
4ff13acf8b salt.fileserver.roots: Fix regression in symlink_list (#39409)
A recent PR of mine removed the logic in symlink_list and fell back to
the cached file list generated in _file_lists(). However, this code
dates back from before the fileserver backends' symlink_list() functions
were modified to return a dict mapping links to their destinations.

This fixes the code in _file_lists() so that it returns the correct
data. It also fixes the fact that '.' was showing up in the dir list
produced by _file_lists(), and updates the associated integration test
to include the cachedir in the mocked opts.
2017-02-15 10:06:17 -07:00
Pedro Algarvio
fc59d5e832 Python 3 Fixes (Pt. 2) (#39397)
* Typo in comment

* First convert to string if not already a string. Then to bytes under Py3.

The reason being that jids from the CLI, at least the one fed in
integration.runners.jobs.ManageTest.test_loopup_jid is loaded as an
integer, and, while the Py2 code converts JIDs to strings, under Py3, we
assume JID's are already strings.

* Mark tests which require root permissions to run

* Allow declaring that the function IS a class method.

```
Python 3.5.3 (default, Jan 21 2017, 00:29:12)
[GCC 6.3.1 20170109] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> class Foo:
...     def bar(self):
...         print('bar')
...
>>> import inspect
>>> inspect.ismethod(Foo.bar)
False
>>> inspect.ismethod(Foo().bar)
True
```

On Python 2, `inspect.ismethod` returns `True` for bound and unbound
methods while on Python 3 it only returns `True` for bound methods.
The explicit `is_class_method` is to avoid instantiating the class just
to get the function signature.

* Always decode responses to the Python version native string implementation

* Just compare the objects as matching list.

Asserting same item count doesn't make that much sense.

* Py3 compatibility

* Fix saltnado tests under Py3

* Python 3 compatibility

* Show me the full traceback

* Revert "Convert fileserver data from bytes to strings"

This reverts commit e53972f8c6.

* Revert "Under Py3, we get `bytes` when using the roots backend directly"

This reverts commit 9f73b240c1.

* Convert from bytes to str if not a binary file

* Py3 compatibility fixes.

Convert file contents from bytes to string if not a binary file
2017-02-14 16:20:56 -07:00
Nicole Thomas
3a39e15dff Rewrite blockdev unit test to target more specific state returns (#39402)
The previous way this test was written was over-mocking some of the
state returns as well as tested and asserted against incorrect
behavior as shown in issue #39255. (The test asserted that a return
of '' from the call to _checkblk() was correct, which was hiding a
bug as noted in #39255 and fixed in #39272.)
2017-02-14 13:49:14 -07:00
Ivan Babrou
e8a2cc0488
Do no try to connect to salt master in syndic config test 2017-02-14 11:16:32 -08:00
Mike Place
868e170b92 Merge pull request #39376 from jmickle/develop
adding librato metrics returner
2017-02-14 11:39:34 -07:00
Mike Place
1ecc9d1315 Add newline for lint 2017-02-14 11:26:23 -07:00
Mike Place
2b67008770 Merge pull request #39374 from techhat/spmcache
Switch SPM to salt.cache
2017-02-14 10:58:10 -07:00
Mike Place
471baea629 Merge pull request #39381 from cachedout/docs_fix
Docs test fix
2017-02-14 10:53:27 -07:00
Mihai Dinca
91383c5a19 Add cp.push test 2017-02-14 17:16:28 +01:00
Isa
72d2188cbb return true when symlinks already in desired state 2017-02-13 18:10:28 -08:00
Joseph Hall
4f072c9ad8 Add cache default for spm 2017-02-13 16:59:07 -07:00
Mike Place
89ed6a38f7
Typo 2017-02-13 16:46:53 -07:00
Mike Place
8fbbb781bc
Fix docs test 2017-02-13 16:45:47 -07:00
Jonathan Mickle
ec938e5f73 linter fixes 2017-02-13 15:27:07 -08:00
mephi42
6570392abd Support globbing in sources parameter of salt.modules.archive (#32356)
Add globbing support to tar, zip and rar.
Update tests to show bad return value on error.
2017-02-14 00:02:19 +01:00
Jonathan Mickle
d61865c2bc adding librato metrics returner 2017-02-13 14:18:54 -08:00
Mike Place
dcd9ff471f Merge pull request #39302 from terminalmage/loader-virtual-aliases
Add __virtual_aliases__ feature to the loader
2017-02-13 13:22:02 -07:00
Mike Place
03ab8b1b5a Merge pull request #39303 from kstreee/fix-testcase-rm-batch-in-netapi
Removes a redundant test case after removed 'batch' in 'netapi'.
2017-02-13 12:55:46 -07:00
Mike Place
1951216b22 Merge pull request #39320 from s0undt3ch/features/py3
Py3 Fixes
2017-02-13 12:28:32 -07:00
Pedro Algarvio
9f73b240c1
Under Py3, we get bytes when using the roots backend directly 2017-02-13 16:44:30 +00:00
Pedro Algarvio
ff1667c6d6
We really don't need to decode the string prior to writing it to file.
Plus, this also avoids handling Py2 and Py3 differently.
2017-02-13 16:25:09 +00:00
Daniel Hobley
3a3ef25b51 Fix add beacon when there are no devices
- Changed the assumption that having 0 lines means there are no devices, to actually checking there are no devices
2017-02-13 13:33:52 +01:00
Pedro Algarvio
005f21d3b5
Compare against the normalized mode string 2017-02-13 10:18:58 +00:00
Pedro Algarvio
c1b5606199
Handle bytes vs strings on the file state module tests 2017-02-13 10:18:57 +00:00
Pedro Algarvio
26b17fb044
Make sure the minion sync's modules/states/grains/etc when starting 2017-02-13 10:18:57 +00:00
Pedro Algarvio
7b7133ea25
This test case requires root permissions 2017-02-13 10:18:56 +00:00
Erik Johnson
6ee6874e11 Set time back 1 week instead of up to 36 years in system module tests
This prevents git_pillar certificate errors. Additionally, sometimes
/dev/rtc becomes unresponsive which leads the ``hwclock --compare``
command to spin indefinitely, ultimately causing the entire test run to
fail. This changeset uses a SIGALRM handler to abort the hwclock command
if no output is seen within 3 seconds and try a second time. If it times
out the second time as well, then an error will be logged but it will
not be fatal to the test (or hang it indefinitely).
2017-02-12 23:57:28 -06:00
Erik Johnson
4e577e697d Switch to non-legacy git_pillar syntax in test suite 2017-02-12 15:12:49 -06:00
Michael Calmer
17521fb23c added unit test for dockerng.sls_build dryrun option (#39305) 2017-02-10 16:11:26 -07:00
Nicole Thomas
050b4cc824 Protect hardware clock test comparison better (#39298)
In #39060, some tests were added to check for the hardware clock
getting reset when possible. The test attempted to gate the test
when access to the hardware clock was impossible, but the check
wasn't quite right and caused problems with the resulting tests.

This change makes the `has_settable_hwclock()` function public
in order to make the test gate work correctly. This function
could also be useful at the CLI level.

When running `self.run_function('status._has_settable_hwclock()')`
from the test suite, the return is a string noting that the
function is unavailable. This change allows for the `if not` check
to evaluate the return of the function.
2017-02-10 10:15:25 -07:00
Ch3LL
b3cbc5a408 improve salt-run salt.cmd test 2017-02-10 09:00:12 -07:00
Erik Johnson
954752b5fd Add test for __virtual_aliases__ 2017-02-10 08:48:57 -06:00
kstreee
51972d0724 Removes a redundant test case after removed 'batch' in 'netapi'. 2017-02-10 07:12:22 +00:00