SHA256
1
0
forked from pool/salt

osc copypac from project:systemsmanagement:saltstack:testing package:salt revision:301

OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:saltstack/salt?expand=0&rev=154
This commit is contained in:
Pablo Suárez Hernández 2019-10-25 15:02:59 +00:00 committed by Git OBS Bridge
parent 61b8fa3223
commit cb07a130b1
5 changed files with 179 additions and 1 deletions

View File

@ -1 +1 @@
b6cbd715dc69b13db8d3fec05840366a1202a62a
b5b0d996824665d5e87b375b74a2bd22ff73cbb0

View File

@ -0,0 +1,105 @@
From 329f90fcde205237545cd623f55f0f6c228bf893 Mon Sep 17 00:00:00 2001
From: Alberto Planas <aplanas@gmail.com>
Date: Fri, 25 Oct 2019 15:43:16 +0200
Subject: [PATCH] Fix a wrong rebase in test_core.py (#180)
* core: ignore wrong product_name files
Some firmwares (like some NUC machines), do not provide valid
/sys/class/dmi/id/product_name strings. In those cases an
UnicodeDecodeError exception happens.
This patch ignore this kind of issue during the grains creation.
(cherry picked from commit 27b001bd5408359aa5dd219bfd900095ed592fe8)
* core: remove duplicate dead code
(cherry picked from commit bd0213bae00b737b24795bec3c030ebfe476e0d8)
---
salt/grains/core.py | 4 +--
tests/unit/grains/test_core.py | 45 ----------------------------------
2 files changed, 2 insertions(+), 47 deletions(-)
diff --git a/salt/grains/core.py b/salt/grains/core.py
index fdabe484a8..bf54c54553 100644
--- a/salt/grains/core.py
+++ b/salt/grains/core.py
@@ -989,7 +989,7 @@ def _virtual(osdata):
except UnicodeDecodeError:
# Some firmwares provide non-valid 'product_name'
# files, ignore them
- pass
+ log.debug('The content in /sys/devices/virtual/dmi/id/product_name is not valid')
except IOError:
pass
elif osdata['kernel'] == 'FreeBSD':
@@ -2490,7 +2490,7 @@ def _hw_data(osdata):
except UnicodeDecodeError:
# Some firmwares provide non-valid 'product_name'
# files, ignore them
- pass
+ log.debug('The content in /sys/devices/virtual/dmi/id/product_name is not valid')
except (IOError, OSError) as err:
# PermissionError is new to Python 3, but corresponds to the EACESS and
# EPERM error numbers. Use those instead here for PY2 compatibility.
diff --git a/tests/unit/grains/test_core.py b/tests/unit/grains/test_core.py
index aa04a7a7ac..889fb90074 100644
--- a/tests/unit/grains/test_core.py
+++ b/tests/unit/grains/test_core.py
@@ -1117,51 +1117,6 @@ class CoreGrainsTestCase(TestCase, LoaderModuleMockMixin):
'uuid': ''
})
- @skipIf(not salt.utils.platform.is_linux(), 'System is not Linux')
- def test_kernelparams_return(self):
- expectations = [
- ('BOOT_IMAGE=/vmlinuz-3.10.0-693.2.2.el7.x86_64',
- {'kernelparams': [('BOOT_IMAGE', '/vmlinuz-3.10.0-693.2.2.el7.x86_64')]}),
- ('root=/dev/mapper/centos_daemon-root',
- {'kernelparams': [('root', '/dev/mapper/centos_daemon-root')]}),
- ('rhgb quiet ro',
- {'kernelparams': [('rhgb', None), ('quiet', None), ('ro', None)]}),
- ('param="value1"',
- {'kernelparams': [('param', 'value1')]}),
- ('param="value1 value2 value3"',
- {'kernelparams': [('param', 'value1 value2 value3')]}),
- ('param="value1 value2 value3" LANG="pl" ro',
- {'kernelparams': [('param', 'value1 value2 value3'), ('LANG', 'pl'), ('ro', None)]}),
- ('ipv6.disable=1',
- {'kernelparams': [('ipv6.disable', '1')]}),
- ('param="value1:value2:value3"',
- {'kernelparams': [('param', 'value1:value2:value3')]}),
- ('param="value1,value2,value3"',
- {'kernelparams': [('param', 'value1,value2,value3')]}),
- ('param="value1" param="value2" param="value3"',
- {'kernelparams': [('param', 'value1'), ('param', 'value2'), ('param', 'value3')]}),
- ]
-
- for cmdline, expectation in expectations:
- with patch('salt.utils.files.fopen', mock_open(read_data=cmdline)):
- self.assertEqual(core.kernelparams(), expectation)
-
- @skipIf(not salt.utils.platform.is_linux(), 'System is not Linux')
- @patch('os.path.exists')
- @patch('salt.utils.platform.is_proxy')
- def test__hw_data_linux_empty(self, is_proxy, exists):
- is_proxy.return_value = False
- exists.return_value = True
- with patch('salt.utils.files.fopen', mock_open(read_data='')):
- self.assertEqual(core._hw_data({'kernel': 'Linux'}), {
- 'biosreleasedate': '',
- 'biosversion': '',
- 'manufacturer': '',
- 'productname': '',
- 'serialnumber': '',
- 'uuid': ''
- })
-
@skipIf(not salt.utils.platform.is_linux(), 'System is not Linux')
@skipIf(six.PY2, 'UnicodeDecodeError is throw in Python 3')
@patch('os.path.exists')
--
2.23.0

View File

@ -0,0 +1,37 @@
From 7e4c53ab89927b6b700603a74131da318c93b957 Mon Sep 17 00:00:00 2001
From: Jochen Breuer <jbreuer@suse.de>
Date: Fri, 25 Oct 2019 16:18:58 +0200
Subject: [PATCH] Fix for older mock module
Seems like args is not working with older mock modules.
---
tests/unit/modules/test_aptpkg.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/unit/modules/test_aptpkg.py b/tests/unit/modules/test_aptpkg.py
index d3fac5902a..bc6b610d86 100644
--- a/tests/unit/modules/test_aptpkg.py
+++ b/tests/unit/modules/test_aptpkg.py
@@ -412,15 +412,15 @@ class AptPkgTestCase(TestCase, LoaderModuleMockMixin):
}
with patch.multiple(aptpkg, **patch_kwargs):
aptpkg.upgrade()
- args_matching = [True for args in patch_kwargs['__salt__']['cmd.run_all'].call_args.args if "--download-only" in args]
+ args_matching = [True for args in patch_kwargs['__salt__']['cmd.run_all'].call_args[0] if "--download-only" in args]
self.assertFalse(any(args_matching))
aptpkg.upgrade(downloadonly=True)
- args_matching = [True for args in patch_kwargs['__salt__']['cmd.run_all'].call_args.args if "--download-only" in args]
+ args_matching = [True for args in patch_kwargs['__salt__']['cmd.run_all'].call_args[0] if "--download-only" in args]
self.assertTrue(any(args_matching))
aptpkg.upgrade(download_only=True)
- args_matching = [True for args in patch_kwargs['__salt__']['cmd.run_all'].call_args.args if "--download-only" in args]
+ args_matching = [True for args in patch_kwargs['__salt__']['cmd.run_all'].call_args[0] if "--download-only" in args]
self.assertTrue(any(args_matching))
def test_show(self):
--
2.16.4

View File

@ -1,3 +1,21 @@
-------------------------------------------------------------------
Fri Oct 25 14:39:23 UTC 2019 - Jochen Breuer <jbreuer@suse.de>
- Fix for aptpkg test with older mock modules
- Added:
* fix-for-older-mock-module.patch
-------------------------------------------------------------------
Fri Oct 25 13:52:01 UTC 2019 - Pablo Suárez Hernández <pablo.suarezhernandez@suse.com>
- Remove wrong tests for core grain and improve debug logging
- Use rich RPM deps to get a compatible version of tornado into the
buildroot.
- Added:
* fix-a-wrong-rebase-in-test_core.py-180.patch
-------------------------------------------------------------------
Tue Oct 22 09:29:19 UTC 2019 - Pablo Suárez Hernández <pablo.suarezhernandez@suse.com>

View File

@ -260,6 +260,10 @@ Patch90: adds-the-possibility-to-also-use-downloadonly-in-kwa.patch
# PATCH_FIX_UPSTREAM: https://github.com/saltstack/salt/pull/53326
# PATCH_FIX_UPSTREAM: https://github.com/saltstack/salt/pull/54954
Patch91: accumulated-changes-from-yomi-167.patch
# PATCH_FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/180
Patch92: fix-a-wrong-rebase-in-test_core.py-180.patch
# PATCH_FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/181
Patch93: fix-for-older-mock-module.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: logrotate
@ -356,9 +360,15 @@ BuildRequires: python-futures >= 2.0
BuildRequires: python-msgpack-python > 0.3
BuildRequires: python-psutil
BuildRequires: python-requests >= 1.0.0
%if 0%{?suse_version} >= 1500 || 0%{?rhel} >= 8
# We can't cope with tornado 5.x and newer (boo#1101780); this is only relevant for SLE >= 15 and TW
# where tornado exists in multiple versions
BuildRequires: (python-tornado >= 4.2.1 with python-tornado < 5)
%else
BuildRequires: python-tornado >= 4.2.1
# We can't cope with tornado 5.x and newer (boo#1101780)
BuildConflicts: python3-tornado >= 5
%endif
# requirements/zeromq.txt
BuildRequires: python-pycrypto >= 2.6.1
@ -454,9 +464,15 @@ BuildRequires: python3-pycrypto >= 2.6.1
BuildRequires: python3-PyYAML
BuildRequires: python3-psutil
BuildRequires: python3-requests >= 1.0.0
%if 0%{?suse_version} >= 1500 || 0%{?rhel} >= 8
# We can't cope with tornado 5.x and newer (boo#1101780); this is only relevant for SLE >= 15 and TW,
# where tornado exists in multiple versions
BuildRequires: (python3-tornado >= 4.2.1 with python3-tornado < 5)
%else
BuildRequires: python3-tornado >= 4.2.1
# We can't cope with tornado 5.x and newer (boo#1101780)
BuildConflicts: python3-tornado >= 5
%endif
# requirements/zeromq.txt
%if %{with test}
@ -839,6 +855,8 @@ cp %{S:5} ./.travis.yml
%patch89 -p1
%patch90 -p1
%patch91 -p1
%patch92 -p1
%patch93 -p1
%build
%if 0%{?build_py2}