Skip to content

Commit ff3fcd9

Browse files
emkllkushaldas
authored andcommitted
Update listing port test
Now uses testinfra primitives instead of lsof workaround
1 parent 645e85a commit ff3fcd9

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

molecule/testinfra/mon/test_mon_network.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,5 @@ def test_listening_ports(host, ossec_service):
6666
"""
6767
socket = "{proto}://{host}:{port}".format(**ossec_service)
6868
with host.sudo():
69-
# Really hacky work-around for bug found in testinfra 1.12.0
70-
# https://github.com/philpep/testinfra/issues/311
71-
if "udp" in socket:
72-
lsof_socket = "{proto}@{host}:{port}".format(**ossec_service)
73-
udp_check = host.run("lsof -n -i"+lsof_socket)
74-
75-
if ossec_service['listening']:
76-
assert udp_check.rc == 0
77-
else:
78-
assert udp_check.rc == 1
79-
else:
80-
assert (host.socket(socket).is_listening ==
81-
ossec_service['listening'])
69+
assert (host.socket(socket).is_listening ==
70+
ossec_service['listening'])

0 commit comments

Comments
 (0)