collectd: improve test

Even if collectd had broken linkage, the old test would pass.

Closes #15610.

Signed-off-by: ilovezfs <ilovezfs@icloud.com>
This commit is contained in:
ilovezfs 2017-07-14 00:46:46 -07:00
parent f9a1d33d21
commit acf65a844c

View file

@ -88,9 +88,19 @@ class Collectd < Formula
end
test do
log = testpath/"collectd.log"
(testpath/"collectd.conf").write <<-EOS.undent
LoadPlugin logfile
<Plugin logfile>
File "#{log}"
</Plugin>
LoadPlugin memory
EOS
begin
pid = fork { exec sbin/"collectd", "-f" }
assert shell_output("nc -u -w 2 127.0.0.1 25826", 0)
pid = fork { exec sbin/"collectd", "-f", "-C", "collectd.conf" }
sleep 1
assert_predicate log, :exist?, "Failed to create log file"
assert_match "plugin \"memory\" successfully loaded.", log.read
ensure
Process.kill("SIGINT", pid)
Process.wait(pid)