memcached: improve test

This commit is contained in:
Zhiming Wang 2017-07-26 19:09:27 -04:00 committed by FX Coudert
parent b24cbb3ebe
commit d84a4468c8

View file

@ -57,6 +57,12 @@ class Memcached < Formula
end
test do
system "#{bin}/memcached", "-h"
pidfile = testpath/"memcached.pid"
# Assumes port 11211 is not already taken
system bin/"memcached", "--listen=localhost:11211", "--daemon", "--pidfile=#{pidfile}"
sleep 1
assert_predicate pidfile, :exist?, "Failed to start memcached daemon"
pid = (testpath/"memcached.pid").read.chomp.to_i
Process.kill "TERM", pid
end
end