Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:FrontRunner
salt.21872
fix-failing-unit-tests-for-systemd.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File fix-failing-unit-tests-for-systemd.patch of Package salt.21872
From 74d8f5f2d896e5e8bbf7d3fb614ae32f2cf489a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?= <psuarezhernandez@suse.com> Date: Wed, 11 Aug 2021 11:44:54 +0100 Subject: [PATCH] Fix failing unit tests for systemd --- tests/unit/modules/test_systemd_service.py | 24 ++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/tests/unit/modules/test_systemd_service.py b/tests/unit/modules/test_systemd_service.py index bbd89bb3d0..51be130d29 100644 --- a/tests/unit/modules/test_systemd_service.py +++ b/tests/unit/modules/test_systemd_service.py @@ -165,21 +165,27 @@ class SystemdTestCase(TestCase, LoaderModuleMockMixin): # systemd < 231 with patch.dict(systemd.__context__, {"salt.utils.systemd.version": 230}): - with patch.object(systemd, "_systemctl_status", mock): + with patch.object(systemd, "_systemctl_status", mock), patch.object( + systemd, "offline", MagicMock(return_value=False) + ): self.assertTrue(systemd.available("sshd.service")) self.assertFalse(systemd.available("foo.service")) # systemd >= 231 with patch.dict(systemd.__context__, {"salt.utils.systemd.version": 231}): with patch.dict(_SYSTEMCTL_STATUS, _SYSTEMCTL_STATUS_GTE_231): - with patch.object(systemd, "_systemctl_status", mock): + with patch.object(systemd, "_systemctl_status", mock), patch.object( + systemd, "offline", MagicMock(return_value=False) + ): self.assertTrue(systemd.available("sshd.service")) self.assertFalse(systemd.available("bar.service")) # systemd < 231 with retcode/output changes backported (e.g. RHEL 7.3) with patch.dict(systemd.__context__, {"salt.utils.systemd.version": 219}): with patch.dict(_SYSTEMCTL_STATUS, _SYSTEMCTL_STATUS_GTE_231): - with patch.object(systemd, "_systemctl_status", mock): + with patch.object(systemd, "_systemctl_status", mock), patch.object( + systemd, "offline", MagicMock(return_value=False) + ): self.assertTrue(systemd.available("sshd.service")) self.assertFalse(systemd.available("bar.service")) @@ -191,21 +197,27 @@ class SystemdTestCase(TestCase, LoaderModuleMockMixin): # systemd < 231 with patch.dict(systemd.__context__, {"salt.utils.systemd.version": 230}): - with patch.object(systemd, "_systemctl_status", mock): + with patch.object(systemd, "_systemctl_status", mock), patch.object( + systemd, "offline", MagicMock(return_value=False) + ): self.assertFalse(systemd.missing("sshd.service")) self.assertTrue(systemd.missing("foo.service")) # systemd >= 231 with patch.dict(systemd.__context__, {"salt.utils.systemd.version": 231}): with patch.dict(_SYSTEMCTL_STATUS, _SYSTEMCTL_STATUS_GTE_231): - with patch.object(systemd, "_systemctl_status", mock): + with patch.object(systemd, "_systemctl_status", mock), patch.object( + systemd, "offline", MagicMock(return_value=False) + ): self.assertFalse(systemd.missing("sshd.service")) self.assertTrue(systemd.missing("bar.service")) # systemd < 231 with retcode/output changes backported (e.g. RHEL 7.3) with patch.dict(systemd.__context__, {"salt.utils.systemd.version": 219}): with patch.dict(_SYSTEMCTL_STATUS, _SYSTEMCTL_STATUS_GTE_231): - with patch.object(systemd, "_systemctl_status", mock): + with patch.object(systemd, "_systemctl_status", mock), patch.object( + systemd, "offline", MagicMock(return_value=False) + ): self.assertFalse(systemd.missing("sshd.service")) self.assertTrue(systemd.missing("bar.service")) -- 2.32.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor