Skip to content

Commit

Permalink
Adds new testinfra test for ossec
Browse files Browse the repository at this point in the history
We verify that Xenial uses sysv script, and Focal is using
the ossec.service file to start the service in the mon server.
  • Loading branch information
kushaldas committed Dec 3, 2020
1 parent 5ff15ac commit a2aa941
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions molecule/testinfra/mon/test_ossec_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

securedrop_test_vars = testutils.securedrop_test_vars
testinfra_hosts = [securedrop_test_vars.monitor_hostname]
python_version = securedrop_test_vars.python_version


def test_ossec_connectivity(host):
Expand All @@ -21,6 +22,20 @@ def test_ossec_connectivity(host):
assert c == desired_output


def test_service_start_style(host):
"""
Ensures to check that the service starts via sysv scrip in Xenial, and
uses the systemd service in Focal.
"""
if python_version == "3.8":
value = "/etc/systemd/system/ossec.service"
else:
value = "/etc/init.d/ossec"
with host.sudo():
c = host.check_output("systemctl status ossec")
assert value in c


# Permissions don't match between Ansible and OSSEC deb packages postinst.
@pytest.mark.xfail
@pytest.mark.parametrize('keyfile', [
Expand Down

0 comments on commit a2aa941

Please sign in to comment.