Benjamin Drung
1d6ef731fe
tests: Deduplicate _run_os_grains_tests()
...
_run_suse_os_grains_tests() and _run_ubuntu_os_grains_tests() share most
of their logic. Combine the common part in _run_os_grains_tests() and
let the remaining small parts live in their origin functions.
Signed-off-by: Benjamin Drung <benjamin.drung@profitbricks.com>
2018-02-26 13:36:33 +01:00
Bo Maryniuk
1b75f98a91
Catch proper exception type
2018-02-21 13:11:44 +01:00
Bo Maryniuk
5149cdbbd9
Fix unit test for py3
2018-02-21 10:53:20 +01:00
Bo Maryniuk
b24a8c3653
Use salt.utils.platform for OS detection
2018-02-20 18:36:27 +01:00
Bo Maryniuk
98cb94ae73
Update unit test on ignoring logging while file do not exist
2018-02-20 16:47:05 +01:00
Bo Maryniuk
2e76606edf
Update unit test for catching out permission error
2018-02-20 16:46:43 +01:00
Bo Maryniuk
e61315c956
Update unit test to handle OSError exception
2018-02-20 16:28:00 +01:00
Bo Maryniuk
8aa0e83be6
Refactor unit test for simplicity so it does not need to be splitted in two functions
2018-02-20 15:25:54 +01:00
Bo Maryniuk
8320939f5e
Add pytest
2018-02-20 15:25:19 +01:00
Bo Maryniuk
3015ed6bcb
Fix unit test for testing main functionality of linux_iqn
2018-02-20 15:18:21 +01:00
Bo Maryniuk
2aa4d02677
Add unit test for linux_iqn testing, if not iscsii available
2018-02-20 15:10:11 +01:00
Bo Maryniuk
a2ba9377f6
Add unit test for grains linux_iqn when running as non-root
2018-02-20 15:03:59 +01:00
rallytime
3c298afa72
Merge branch '2017.7' into 'oxygen'
...
Conflicts:
- salt/modules/pip.py
- salt/modules/reg.py
- salt/modules/win_pkg.py
- salt/runners/manage.py
- salt/states/pkg.py
- salt/transport/zeromq.py
- salt/utils/event.py
- tests/integration/modules/test_pip.py
- tests/integration/states/test_user.py
- tests/unit/grains/test_core.py
- tests/unit/states/test_archive.py
- tests/unit/utils/test_boto.py
2018-01-23 13:26:43 -05:00
rallytime
e0ffa32b49
Merge branch '2016.11' into '2017.7'
...
Conflicts:
- tests/integration/modules/test_pkg.py
2018-01-19 10:09:36 -05:00
Daniel Wallace
6c26025664
fix mock for opensuse
...
Opensuse needs a run_all in here, mock it so we don't see an error, and still
test the docker stuff
2018-01-18 10:48:07 -07:00
rallytime
60370f5fb6
Merge branch '2017.7' into 'oxygen'
...
Conflicts:
- salt/config/__init__.py
- salt/daemons/masterapi.py
- salt/proxy/dummy.py
- salt/states/file.py
- tests/integration/modules/test_state.py
- tests/integration/runners/test_runner_returns.py
- tests/integration/ssh/test_state.py
- tests/support/parser/__init__.py
- tests/unit/grains/test_core.py
- tests/unit/states/test_file.py
2018-01-11 16:00:08 -05:00
Erik Johnson
5473c085d9
Fix loader error in 2017.7 tests
2018-01-11 08:40:27 -06:00
Erik Johnson
f900715e1c
[PY3] add unicode_literals to log/grains modules
2018-01-10 11:37:59 -06:00
twangboy
48f12a3bbc
Skip linux specific tests
2018-01-08 15:38:26 -07:00
Ch3LL
0919d8787b
Skip iscsi grains test if MacOSX
2018-01-08 10:54:45 -05:00
Erik Johnson
d9a915fdc9
Update mocking in unit.grains.test_core.CoreGrainsTestCase.test_docker_virtual
...
This fixes this test in Oxygen, where the function name has changed.
2017-12-23 19:47:37 -06:00
rallytime
9ded5e1cbb
Merge branch '2017.7' into 'oxygen'
...
Conflicts:
- salt/config/__init__.py
- salt/grains/core.py
- salt/modules/win_lgpo.py
- salt/returners/mysql.py
- salt/states/libcloud_dns.py
- tests/integration/runners/test_runner_returns.py
- tests/unit/grains/test_core.py
2017-12-21 15:58:08 -05:00
Erik Johnson
2d0e96385f
Fix import of ipaddress on PY3
...
This should only be imported on PY2
2017-12-19 12:09:36 -06:00
rallytime
a0d2dd2069
Lint fix
2017-12-13 14:06:11 -05:00
rallytime
9db4179462
Merge branch '2016.11' into '2017.7'
...
Conflicts:
- tests/unit/grains/test_core.py
2017-12-12 15:24:30 -05:00
rallytime
db5866d097
Update old utils paths to new utils paths
2017-12-11 18:43:33 -05:00
rallytime
08c71f13e4
Merge branch '2017.7' into 'oxygen'
...
Conflicts:
- doc/ref/configuration/minion.rst
- doc/topics/thorium/index.rst
- salt/beacons/__init__.py
- salt/client/mixins.py
- salt/client/ssh/wrapper/state.py
- salt/daemons/masterapi.py
- salt/grains/extra.py
- salt/minion.py
- salt/modules/cron.py
- salt/modules/file.py
- salt/modules/mac_user.py
- salt/modules/napalm_network.py
- salt/modules/state.py
- salt/modules/win_file.py
- salt/modules/win_pkg.py
- salt/proxy/dummy.py
- salt/state.py
- salt/states/file.py
- salt/states/lxc.py
- salt/utils/__init__.py
- salt/utils/schedule.py
- tests/integration/modules/test_file.py
- tests/integration/modules/test_groupadd.py
- tests/integration/ssh/test_state.py
- tests/integration/states/test_file.py
- tests/unit/daemons/test_masterapi.py
- tests/unit/grains/test_core.py
- tests/unit/modules/test_disk.py
- tests/unit/modules/test_napalm_network.py
- tests/unit/modules/test_state.py
- tests/unit/test_minion.py
- tests/unit/utils/test_process.py
2017-12-11 18:24:41 -05:00
Daniel Wallace
3f1268d67f
fix patching for python 2.6
2017-12-07 08:25:26 -07:00
Anthony Shaw
6231d69f85
Merge remote-tracking branch 'origin/develop' into more_napalm_tests
2017-12-06 15:12:35 +11:00
Daniel Wallace
1d0bd5bb32
Merge branch '2016.11' into 2016.11
2017-12-04 10:13:15 -07:00
rallytime
3d9eafc4bd
Lint: Remove extra empty lines at end of files
2017-12-01 14:46:27 -05:00
rallytime
239f3511bf
Merge branch '2016.11' into '2017.7'
...
Conflicts:
- salt/modules/reg.py
- salt/modules/state.py
- salt/modules/win_pkg.py
- salt/netapi/rest_cherrypy/app.py
- salt/utils/__init__.py
- tests/integration/modules/test_file.py
- tests/integration/output/test_output.py
- tests/unit/grains/test_core.py
2017-12-01 11:12:44 -05:00
Gareth J. Greenaway
6ee18e4f38
Merge branch 'develop' into 43647_fix_InitiatorName_in_comments
2017-11-28 13:35:11 -08:00
Anthony Shaw
a029f70cff
merge inbound, resolve conflict and remove unfinished state test module
2017-11-29 08:21:53 +11:00
Erik Johnson
682fc1b884
Fix failing grains test on CentOS
...
Resolves https://github.com/saltstack/salt-jenkins/issues/556
2017-11-27 21:37:46 -06:00
Nicole Thomas
94001ffc64
lint: whitespace fixes
2017-11-27 16:15:44 -05:00
Erik Johnson
b4eb1527a6
Add test for PR 44335
...
This also modifies the virtual_subtype code slightly, due to an issue I
noticed in testing. We were reading from `/proc/1/cgroup` twice (once
for LXC, and then again for Docker).
2017-11-25 14:32:43 -06:00
Anthony Shaw
febee3e065
patch cache replacement
2017-11-25 19:02:02 +11:00
Anthony Shaw
8ac1144c77
complete tests for grain module
2017-11-25 06:11:25 +11:00
Anthony Shaw
0a34c12147
tests for napalm grains module, still issue to resolve on is_proxy
2017-11-25 05:47:27 +11:00
Ch3LL
9ea4db4224
mock socket.getaddrinfo
2017-11-14 14:39:15 -05:00
Ch3LL
78a07e30f4
add more fqdn tests and remove some of the mocking
2017-11-14 11:39:35 -05:00
Ch3LL
5dbf4144ce
add ipv6 in opts
2017-11-14 11:39:35 -05:00
Ch3LL
eabc1b4f9c
Add fqdn and dns core grain tests
2017-11-14 11:39:31 -05:00
Gareth J. Greenaway
df937bf2fa
Merge branch 'develop' into 43647_fix_InitiatorName_in_comments
2017-11-08 10:58:22 -07:00
Jorge Schrauwen
3af235250d
Remove _zpool_data from the bsd_memdata test for grains
2017-11-07 08:17:50 +01:00
Gareth J. Greenaway
06080612bc
Merge branch 'develop' into 43647_fix_InitiatorName_in_comments
2017-10-30 17:54:57 -04:00
Gareth J. Greenaway
8bbb1088e8
Fixing lint.
2017-10-18 14:57:33 -07:00
Gareth J. Greenaway
1e312d1b59
Adding tests for _memdata, Linux & *BSD
2017-10-18 14:57:33 -07:00
Erik Johnson
877abb89d0
Complete the salt.utils refactor
...
This moves the remaining 30 functions from salt.utils to new locations.
2017-10-15 09:43:31 -05:00
Gareth J. Greenaway
f06bb04348
Adding the right mocked data to the Windows test. Updating the grains/core.py to check if the entire line is alpha_numeric characters to determine if it should be skipped.
2017-10-13 10:01:58 -07:00
Gareth J. Greenaway
4b1d5f3005
Adding additional tests for grains/isci_iqn
2017-10-13 10:01:58 -07: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
Ignat Korchagin
0d6da33391
Update grains unit test to support reading firmware grains from sysfs in Linux
2017-05-03 13:10:29 +00:00
Erik Johnson
20f856f038
Update unit tests for numeric osmajorrelease
2017-04-11 12:36:36 -05:00
Pedro Algarvio
d397763553
Adjust to the new LoaderModuleMockMixin usage
2017-03-28 19:03:59 +01:00
Pedro Algarvio
1f7a0aa65b
Proper mocking
2017-03-28 19:00:51 +01:00
Nicole Thomas
350edbe7e6
Remove unused import in test_core.py
2017-03-14 10:28:42 -06: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
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
3a85996d2a
Code cleanup
2017-02-24 00:49:32 +00:00
Pedro Algarvio
15af4c9728
Test filenames conformity. Adjust for pytest.
2017-02-23 23:19:42 +00:00
rallytime
80acd51d6f
Update __builtin__ mock for PY3: module was moved to "builtins"
2017-01-05 14:11:28 -05:00
Jorge Schrauwen
374d4038d3
[develop] grains should have some information about zpools if available ( #36839 )
...
* grains should have some information about zpools if available
* Add __opts__ as a global variable so test do not fail.
* fix lint error
2016-10-13 11:04:38 -06:00
Mike Place
d72f13d9c0
Merge pull request #35415 from meaksh/fix-suse-os-grains-in-develop
...
Fixed 'os' and 'os_family' grains for SUSE systems in develop
2016-08-13 08:50:52 +09:00
Pablo Suárez Hernández
7c1a5f8bc6
Fixed 'os' and 'os_family' grains for SUSE systems
2016-08-12 13:33:27 +01:00
rallytime
69b9342d67
Update grains unit tests: osmajorrelease grain is a str, not an int.
...
Refs #35227
These tests will need to be changed back to integers once Nitrogen
is released.
2016-08-11 10:38:58 -06:00
rallytime
0b1e9e9a78
Merge branch '2016.3' into 'develop'
...
Conflicts:
- salt/client/mixins.py
- salt/grains/core.py
- salt/modules/saltutil.py
- salt/runner.py
- salt/states/saltmod.py
- salt/wheel/__init__.py
- tests/unit/states/saltmod_test.py
2016-08-10 10:25:32 -06:00
Bo Maryniuk
fe5da97283
Lintfix: E8303
2016-08-06 00:27:34 +02:00
Bo Maryniuk
4dc45f2509
Add grains unit test for Ubuntu systems
2016-08-05 11:55:02 +02:00
Bo Maryniuk
110a422d5a
Keep osmajorrelease as a string type for 2016.3 release
2016-07-19 17:52:08 +02:00
Bo Maryniuk
2040c7caa5
Add unit test for osmajorrelease grain
2016-07-14 18:08:15 +02:00
Bo Maryniuk
208fd33b48
Add unit test for osmajorrelease grain
2016-07-14 18:05:12 +02:00
rallytime
7c216c3a1d
Fix the unit.grains.core_test tests to run with Python3
2016-07-07 16:41:21 -06:00
rallytime
07f5ebdf38
Pylint fix
2016-06-24 08:28:25 -06:00
rallytime
ea048fd9b6
Merge branch '2016.3' into 'develop'
...
Conflicts:
- salt/grains/core.py
- tests/unit/grains/core_test.py
2016-06-23 17:13:20 -06:00
Pablo Suárez Hernández
23ce0b431b
some cleanup and renaming
2016-06-20 15:39:19 +01:00
Pablo Suárez Hernández
44eda2ad9f
Fix for openSUSE Tumbleweed
2016-06-20 12:04:10 +01:00
Pablo Suárez Hernández
0d4a710d86
fixes for fopen mock and some os_release_map for SLES11SP3
2016-06-20 11:56:06 +01:00
Pablo Suárez Hernández
d6410a03b8
unit tests for SUSE os grains detection
2016-06-20 11:22:01 +01:00
Pablo Suárez Hernández
d78d57b717
Test fixed: get OS grain from /etc/os-release if possible
2016-06-17 13:32:57 +01:00
Pablo Suarez Hernandez
d80e0532ff
fix: osarch_mock
2016-06-17 13:32:57 +01:00
Pablo Suarez Hernandez
db00ec756d
osarch mock for unit test
2016-06-17 13:32:57 +01:00
Pablo Suarez Hernandez
dabc5cab7e
lint fix
2016-06-17 13:32:56 +01:00
Pablo Suarez Hernandez
9ac514724b
testing if SUSE os grain is set from /etc/os-release
2016-06-17 13:32:56 +01:00
Pablo Suárez Hernández
1afc12f6d1
Test fixed: get OS grain from /etc/os-release if possible
2016-06-13 10:19:17 +01:00
Pablo Suarez Hernandez
a0693aafcb
fix: osarch_mock
2016-06-10 09:48:37 +01:00
Pablo Suarez Hernandez
1680f18556
osarch mock for unit test
2016-06-10 08:51:33 +01:00
Pablo Suarez Hernandez
63e2f27fa6
lint fix
2016-06-09 21:33:06 +01:00
Pablo Suarez Hernandez
7f7800ffc9
testing if SUSE os grain is set from /etc/os-release
2016-06-09 15:09:00 +01:00
Erik Johnson
9da467aec7
Rename core.py to core_test.py
2016-02-24 10:15:01 -07:00
Erik Johnson
468c637032
Add unit test for core grains
2016-02-24 10:15:01 -07:00