mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Update linux_sysctl tests to reflect new context key (#35584)
* Update docstring to reflect optional context argument
It used to not be optional.
* Update linux_sysctl tests to reflect new context key
This key was changed in 5b12f03
, this updates the tests to reflect the
change.
This commit is contained in:
parent
fd08d33597
commit
beb6ca8ef9
2 changed files with 6 additions and 5 deletions
|
@ -17,9 +17,10 @@ log = logging.getLogger(__name__)
|
|||
|
||||
def booted(context=None):
|
||||
'''
|
||||
Return True if the system was booted with systemd, False otherwise.
|
||||
Pass in the loader context "__context__", this function will set the
|
||||
systemd.sd_booted key to represent if systemd is running
|
||||
Return True if the system was booted with systemd, False otherwise. If the
|
||||
loader context dict ``__context__`` is passed, this function will set the
|
||||
``salt.utils.systemd.booted`` key to represent if systemd is running and
|
||||
keep the logic below from needing to be run again during the same salt run.
|
||||
'''
|
||||
contextkey = 'salt.utils.systemd.booted'
|
||||
if isinstance(context, dict):
|
||||
|
|
|
@ -113,7 +113,7 @@ class LinuxSysctlTestCase(TestCase):
|
|||
{'cmd.run_stdout': mock_sys_cmd,
|
||||
'cmd.run_all': mock_asn_cmd}):
|
||||
with patch.dict(systemd.__context__,
|
||||
{'systemd.sd_booted': True}):
|
||||
{'salt.utils.systemd.booted': True}):
|
||||
linux_sysctl.persist('net.ipv4.ip_forward', 1)
|
||||
helper_open = m_open()
|
||||
helper_open.write.assert_called_once_with(
|
||||
|
@ -136,7 +136,7 @@ class LinuxSysctlTestCase(TestCase):
|
|||
{'cmd.run_stdout': mock_sys_cmd,
|
||||
'cmd.run_all': mock_asn_cmd}):
|
||||
with patch.dict(systemd.__context__,
|
||||
{'systemd.sd_booted': True}):
|
||||
{'salt.utils.systemd.booted': True}):
|
||||
self.assertEqual(linux_sysctl.persist(
|
||||
'net.ipv4.ip_forward', 1), 'Updated')
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue