Pedro Algarvio
e7768705f9
Allow passing different loader_module_globals per loader_module
2017-03-28 19:02:51 +01:00
Pedro Algarvio
93ad2cc428
Proper mocking. Code is mocked! Runs on non windows too.
2017-03-28 19:02:51 +01:00
Pedro Algarvio
5c13f7b2bb
Proper mocking.
2017-03-28 19:02:50 +01:00
Pedro Algarvio
cb532fb9ef
Code cleanup. Proper mocking.
2017-03-28 19:02:50 +01:00
Pedro Algarvio
f23596cbd1
Proper mocking. Py3 Compat.
2017-03-28 19:02:50 +01:00
Pedro Algarvio
9b1e55aa85
Import the full module namespace to avoid import shadowing.
...
https://github.com/saltstack/salt/pull/39996#issuecomment-287857698
2017-03-28 19:02:47 +01:00
Pedro Algarvio
8325a58a35
Proper mocking but I'm lost as to what is actually being tests here
2017-03-28 19:00:53 +01:00
Pedro Algarvio
a894eebf31
Code cleanup. Proper mocking!!!
2017-03-28 19:00:53 +01:00
Pedro Algarvio
5216ff0932
Code cleanup. Proper mocking
2017-03-28 19:00:52 +01:00
Pedro Algarvio
ea81540cce
Code cleanup. Proper mocking.
2017-03-28 19:00:52 +01:00
Pedro Algarvio
1f7a0aa65b
Proper mocking
2017-03-28 19:00:51 +01:00
Pedro Algarvio
87e9f5e676
Mock patching. The right way.
2017-03-28 19:00:51 +01:00
Pedro Algarvio
b25b26e23d
Cleanup test attributes once finished
2017-03-28 19:00:51 +01:00
Pedro Algarvio
6f79dd6af3
Not an integration test
2017-03-28 19:00:51 +01:00
Mike Place
d7e745a53a
Merge pull request #40281 from terminalmage/rename-docker
...
Rename docker execution module to avoid shadowing in the loader
2017-03-28 11:06:08 -06:00
Erik Johnson
808ad76419
systemd.py: when getting all services, don't repeat gathering of systemd services
...
Now that we are not caching these in the context dunder, we should pass
them into this function so that we don't repeat gathering the systemd
services inside _get_sysv_services().
Also, this fixes an incorrect change to the mocking that was apparently
made at some point to the get_all unit test.
2017-03-28 10:52:50 -05:00
Erik Johnson
774a3f1147
Rename docker execution module to avoid shadowing in the loader
...
With the merging of #39996 , salt/modules/docker.py now imports
salt.utils.docker. However, our loader appends the module dir (in
this case salt/modules/) to sys.path temporarily for the length of the
loading process. So, as the docker execution module tries to import
salt.utils.docker, when salt.utils.docker attempts to do an "import
docker", and docker-py is *not* installed, this results in
salt/modules/docker.py (the docker execution module) being loaded in its
place, which results in tracebacks in the minion log.
Renaming the docker execution module keeps this import shadowing from
occurring. Note that we don't need to do this for the placeholder
salt/states/docker.py as it does not import salt.utils.docker.
2017-03-28 10:50:47 -05:00
zer0def
d68067f1d7
Merge remote-tracking branch 'main/2016.11' into pip-cache-fixes
2017-03-28 16:39:19 +02:00
zer0def
4f23a23ca8
Fixed the test_install_download_cache_argument_in_resulting_command
to accomodate introduced cache directory argument fixes and renamed it to test_install_download_cache_dir_arguments_in_resulting_command
.
2017-03-28 11:53:54 +02:00
Mike Place
75565df5da
Merge pull request #39884 from Juniper/develop
...
unit tests for junos specific code
2017-03-27 18:35:58 -06:00
rallytime
0f263a52e0
Mock out the get_client_args mocks in the dockerng module tests more aggressively
...
The tests pass fine when run independently, but when the full unit test suite
runs, the dockerng state tests are setting global values. This change makes the
module tests avoid those problem by relying on its own mocks.
2017-03-27 11:27:52 -06:00
vnitinv
a9acd532d1
fix lint in test_junos.py
2017-03-27 11:33:42 +05:30
rajvidhimar
f629feaabd
Take care of import error and add condition to skip tests if PyEZ is not installed
2017-03-26 17:27:32 +05:30
rallytime
f1352fe253
Add one more dockerng.version mock that was missed previously
2017-03-24 10:57:12 -06:00
vnitinv
146f8abc4c
sync with upstream
2017-03-24 12:18:14 +05:30
Sergey Kizunov
64d224ad02
rabbitmq: Do not use __context__
for persistent globals
...
The rabbitmq module was using `__context__` to store paths of
rabbitmq executables. `__context__` may be cleared but the module
still could remain in use, in which case it would fail to work
correctly. Move the paths of the rabbitmq executables to their own
global variables so that they are not affected by the lifespan of
`__context__`.
Signed-off-by: Sergey Kizunov <sergey.kizunov@ni.com>
2017-03-23 14:46:36 -05:00
rallytime
0d31d2c4d1
Add a couple more patches for docker.version information
2017-03-23 12:57:46 -06:00
rallytime
a9c5eebaf0
Clean up dockerng unit tests to avoid global variables and fixup some patching
2017-03-23 12:44:57 -06:00
rajvidhimar
2868755128
Remove usage of nose in junos unit tests
2017-03-22 17:08:19 +05:30
Erik Johnson
5ad476936d
Overhaul Docker support
...
This does the following:
- Splits states for container/volume/image/network management into four
separate state modules.
- Preserves backward compatibility by making ``docker.image_present``
invoke ``docker_image.present``, etc.
- Changes how Salt detects that a container needs to be replaced.
Instead of comparing each passed argument to the named container's
configuration, it creates a temporary container, and compares that
container to the named container. If the two differ, then the older
container is removed, and the new one is renamed and started, becoming
the named container.
- Removes the unit tests for container management and replaces them with
integration tests.
- Adds unit tests for the new salt.utils.docker
2017-03-21 16:53:19 -05:00
rallytime
a6a7538fe4
Pylint fix
2017-03-21 13:39:34 -06:00
Erik Johnson
6caedb0de8
Change imports for dockerng tests
...
This should fix path issues in the test suite.
2017-03-21 11:56:29 -05:00
rallytime
2222e1cae9
Merge branch '2016.11' into 'develop'
...
Conflicts:
- salt/modules/napalm_network.py
- tests/integration/states/test_archive.py
- tests/integration/states/test_file.py
- tests/unit/modules/test_docker.py
2017-03-21 10:19:52 -06:00
rallytime
f32d8a8683
Don't try to run the dockerng unit tests if docker-py is missing
2017-03-20 13:34:15 -06:00
vnitinv
1b726b7f2e
moving import unittest2 to unittest
2017-03-15 15:53:39 +05:30
vnitinv
24dcee86a9
Merge remote-tracking branch 'upstream/develop' into develop
2017-03-15 15:52:22 +05:30
Nitin Kr
8c6f636a06
Merge pull request #20 from rajvidhimar/salt_test
...
Lint changes
2017-03-15 11:16:09 +05:30
rajvidhimar
dc2e3f4f2e
Clean up lint
2017-03-15 10:42:10 +05:30
Nicole Thomas
dd2bcb7c26
Merge pull request #39888 from ni3mm4nd/module_grains
...
Add function for matching key/value grains
2017-03-14 11:36:40 -06:00
Jan Kadlec
a797a58ee6
Change function name to equals
2017-03-14 17:15:52 +01:00
Daniel Wallace
b839193443
Use linux_distribution from distro if not in platform
...
http://bugs.python.org/issue1322
python 3.7 is deprecating the platform.{linux_distribution,dist}
functions. They are being moved to the `distro` module on pypi. This
adds support for using the distro module if platform does not have the
needed functions.
2017-03-14 10:09:47 -05:00
Nitin Kr
30b0e1c9cd
Merge pull request #19 from rajvidhimar/salt_test
...
Fixed broken unit tests
2017-03-14 17:52:17 +05:30
rajvidhimar
0393ffab1c
Took care of commits
2017-03-14 17:51:17 +05:30
rajvidhimar
9c6b7279dc
Fixed broken unit tests
2017-03-14 17:46:04 +05:30
Nitin Kr
62e0281f85
Merge pull request #18 from rajvidhimar/salt_test
...
More unit tests
2017-03-14 17:41:56 +05:30
Jan Kadlec
ea7faa0935
Rename function key_value_match to is
2017-03-11 07:35:24 +01:00
rallytime
9ddf032e8e
Merge branch '2016.11' into 'develop'
...
Conflicts:
- doc/ref/configuration/minion.rst
- salt/beacons/status.py
- salt/modules/saltutil.py
- salt/utils/schedule.py
- tests/integration/modules/test_beacons.py
- tests/unit/beacons/inotify_beacon_test.py
2017-03-10 14:57:31 -07:00
Nicole Thomas
c2d4d17589
Merge pull request #39770 from rallytime/merge-2016.11
...
[2016.11] Merge forward from 2016.3 to 2016.11
2017-03-09 15:00:17 -07:00
Nicole Thomas
2f0f7cd224
Merge pull request #39897 from rallytime/merge-develop
...
[develop] Merge forward from 2016.11 to develop
2017-03-09 09:03:46 -07:00
Pedro Algarvio
50e49f1353
Merge pull request #39907 from gtmanfred/listen
...
Move stuff to make it available for salt-ssh
2017-03-09 09:33:46 +00:00
rajvidhimar
beba5a7331
Clean up
2017-03-09 11:15:15 +05:30
rajvidhimar
d8363d0958
Unit tests
2017-03-09 10:48:42 +05:30
Daniel Wallace
587b7fc7f3
fix test
2017-03-08 18:53:19 -06:00
Pedro Algarvio
0b41b92d7d
Use salt.utils.versions
instead of distutils.version
2017-03-08 19:22:33 +00:00
Kadlec Jan
93306ba8a8
Fix linode white space
2017-03-08 17:14:56 +01:00
rallytime
4fc9b5484b
Merge branch '2016.11' into 'develop'
...
Conflicts:
- salt/client/ssh/__init__.py
- salt/pillar/makostack.py
- tests/integration/client/test_runner.py
- tests/integration/states/test_file.py
2017-03-08 09:04:26 -07:00
Kadlec Jan
2c67cfdbdb
Add function for matching key/value grains
2017-03-08 15:14:46 +01:00
vnitinv
4faee656c3
Merge remote-tracking branch 'upstream/develop' into develop
2017-03-08 17:30:21 +05:30
rajvidhimar
c49c8860ac
More test cases
2017-03-08 00:25:41 +05:30
rajvidhimar
a5527f690f
Fix tests
2017-03-07 16:14:23 +05:30
rajvidhimar
839cb66872
remove old file
2017-03-07 12:40:29 +05:30
rajvidhimar
3abbcc4ad3
Bug fixes
2017-03-07 12:34:09 +05:30
rajvidhimar
3a1b6558b6
Merge remote-tracking branch 'upstream/develop' into salt_test
2017-03-07 12:30:21 +05:30
rajvidhimar
6ff57331c5
Fix few bugs in the salt module
2017-03-07 12:29:09 +05:30
rajvidhimar
002f97bfe8
Adding unit tests
2017-03-07 11:22:15 +05:30
Pedro Algarvio
3ec0870ef6
Disable 3rd-party-module-not-gated
2017-03-06 14:42:31 +00:00
Pedro Algarvio
ffec7dc299
Lint fixes
2017-03-06 14:35:16 +00:00
rajvidhimar
691f602e7e
Unit tests
2017-03-06 16:58:53 +05:30
rajvidhimar
1f8fe142dd
Test cases
2017-03-06 14:55:40 +05:30
rajvidhimar
e047fd74ad
Test cases
2017-03-06 12:16:41 +05:30
rajvidhimar
47f9d32d80
Cover more code
2017-03-03 16:55:05 +05:30
rajvidhimar
d464a954ac
More tests and changes in junos module
2017-03-03 12:48:24 +05:30
rajvidhimar
970060e0d4
Unit tests
2017-03-02 10:50:41 +05:30
rallytime
776a9431b9
Merge branch '2016.3' into '2016.11'
...
Conflicts:
- salt/minion.py
2017-03-01 16:07:14 -07:00
Erik Johnson
3bb0ebd872
Update tests for PR 39727
...
Also reduce the complexity of some of the mocking by adding the cachedir
to the global state.__opts__.
2017-03-01 12:10:28 -06: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
rallytime
ddf8f87249
Add some additional mocks for win_iis unit test
2017-02-28 10:36:11 -07:00
rallytime
b4366103a6
Merge branch '2016.11' into 'develop'
...
Conflicts:
- .pylintrc
- .testing.pylintrc
- salt/fileclient.py
- salt/minion.py
- salt/modules/docker.py
- salt/modules/win_iis.py
- salt/states/docker.py
- salt/states/file.py
- salt/utils/__init__.py
- tests/integration/modules/test_sysmod.py
2017-02-27 15:11:37 -07:00
rallytime
756f1de2d2
Merge branch '2016.3' into '2016.11'
...
Conflicts:
- salt/states/file.py
2017-02-27 13:13:46 -07:00
rajvidhimar
6b9d89d706
Test cases
2017-02-27 12:44:23 +05:30
Erik Johnson
c7dfb494a6
Fix mocking for grains refresh
2017-02-25 21:04:48 -06:00
Erik Johnson
28564da966
Implement no_block for service.running/service.dead (systemd only)
2017-02-24 15:14:09 -06:00
Daniel Wallace
89101fa342
allow sls_build to be used with states
2017-02-24 11:47:13 -06:00
Pedro Algarvio
0e1e133169
Fix a weird import issue
...
```
ImportError: Failed to import test module: unit.modules.docker_test
Traceback (most recent call last):
File "/usr/lib64/python2.7/unittest/loader.py", line 252, in _find_tests
module = self._get_module_from_name(name)
File "/usr/lib64/python2.7/unittest/loader.py", line 230, in _get_module_from_name
__import__(name)
File "/testing/tests/unit/modules/docker_test.py", line 39, in <module>
class DockerTestCase(TestCase):
File "/testing/tests/unit/modules/docker_test.py", line 103, in DockerTestCase
@skipIf(_docker_py_version() < (1, 4, 0),
File "/testing/tests/unit/modules/docker_test.py", line 34, in _docker_py_version
return docker_mod.docker.version_info
AttributeError: 'module' object has no attribute 'version_info'
```
2017-02-24 09:11:23 +00:00
Erik Johnson
ca54541abe
Add missing unit test for disable func
2017-02-24 01:12:42 -06:00
rajvidhimar
4cc6fd187b
Add junos test file
2017-02-24 10:19:24 +05:30
Pedro Algarvio
5d0110d98b
Code cleanup
2017-02-24 00:49:33 +00:00
Pedro Algarvio
ae46b0da3a
Code cleanup
2017-02-24 00:49:32 +00:00
Pedro Algarvio
5576f6ed33
Gate it!
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
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
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
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
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