~cjwatson/charms/trusty/logstash-forwarder/fix-logrotate-perms

« back to all changes in this revision

Viewing changes to tests/10-install-tests

  • Committer: laurent.sesques at canonical
  • Date: 2018-04-26 13:57:27 UTC
  • mfrom: (22.1.3 tunable-spool-size)
  • Revision ID: laurent.sesques@canonical.com-20180426135727-stnbxuvd1gqfuf72
Make spool-size a tunable parameter

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
d.configure("logstash-forwarder", {
13
13
    "files": '{"apache":["/var/log/apache2/*log"]}',
 
14
    "spool_size": 4242,
14
15
    })
15
16
 
16
17
d.relate('apache2:juju-info', 'logstash-forwarder:juju-info')
26
27
unit = d.sentry['apache2/0']
27
28
 
28
29
# Did the package install ok?
29
 
# We overwrite the init script, so ignore that one
 
30
# We overwrite the init script and may modify /etc/default file so ignore those.
30
31
ret = unit.run("dpkg --verify logstash-forwarder")
31
32
for line in ret[0].split("\n"):
32
 
    if "init.d" not in line:
 
33
    if "init.d" not in line and "/etc/default/logstash-forwarder" not in line:
33
34
        amulet.raise_status(amulet.FAIL, msg="logstash-forwarder package failed verification")
34
35
 
35
36
# Do we have an /etc/default file?
36
37
if "logstash-forwarder" not in unit.directory_contents("/etc/default")["files"]:
37
38
    amulet.raise_status(amulet.FAIL, msg="/etc/default file was not created")
38
39
 
 
40
# Does /etc/default have our custom spool size?
 
41
if "-spool-size 4242" not in unit.file_contents("/etc/default/logstash-forwarder"):
 
42
    amulet.raise_status(amulet.FAIL, msg="spool_size config option not honored")
 
43
 
39
44
# Check the config file
40
45
cfg = json.loads(unit.file_contents("/etc/logstash-forwarder/logstash-forwarder.conf"))
41
46
if cfg["files"][0]["paths"][0] != "/var/log/apache2/*log":