mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 01:30:20 +00:00
adding changelog. updating tests to reflect changes.
This commit is contained in:
parent
5c77b2beaa
commit
5961eb9435
2 changed files with 9 additions and 6 deletions
1
changelog/60467.fixed
Normal file
1
changelog/60467.fixed
Normal file
|
@ -0,0 +1 @@
|
|||
Use return code in iptables --check to verify rule exists.
|
|
@ -473,9 +473,10 @@ def test_check():
|
|||
|
||||
with patch.object(iptables, "_has_option", mock_has):
|
||||
with patch.dict(iptables.__salt__, {"cmd.run_stderr": mock_cmd}):
|
||||
assert iptables.check(
|
||||
table="filter", chain="INPUT", rule=mock_rule, family="ipv4"
|
||||
)
|
||||
with patch.dict(iptables.__context__, {"retcode": 1}):
|
||||
assert not iptables.check(
|
||||
table="filter", chain="INPUT", rule=mock_rule, family="ipv4"
|
||||
)
|
||||
|
||||
mock_cmd = MagicMock(return_value="-A 0x4d2")
|
||||
mock_uuid = MagicMock(return_value=1234)
|
||||
|
@ -483,9 +484,10 @@ def test_check():
|
|||
with patch.object(iptables, "_has_option", mock_has):
|
||||
with patch.object(uuid, "getnode", mock_uuid):
|
||||
with patch.dict(iptables.__salt__, {"cmd.run_stderr": mock_cmd}):
|
||||
assert iptables.check(
|
||||
table="filter", chain="0x4d2", rule=mock_rule, family="ipv4"
|
||||
)
|
||||
with patch.dict(iptables.__context__, {"retcode": 0}):
|
||||
assert iptables.check(
|
||||
table="filter", chain="0x4d2", rule=mock_rule, family="ipv4"
|
||||
)
|
||||
|
||||
|
||||
# 'check_chain' function tests: 1
|
||||
|
|
Loading…
Add table
Reference in a new issue