mysql: replace existing test

Closes #9359.

Signed-off-by: Tomasz Pajor <tomek@polishgeeks.com>
This commit is contained in:
Dominyk Tiller 2017-01-28 02:58:19 +00:00 committed by Tomasz Pajor
parent 7d3211bf98
commit ed4165cdb4

View file

@ -179,6 +179,23 @@ class Mysql < Formula
end
test do
system "/bin/sh", "-n", "#{bin}/mysqld_safe"
begin
# Expects datadir to be a completely clean dir, which testpath isn't.
dir = Dir.mktmpdir
system bin/"mysqld", "--initialize-insecure", "--user=#{ENV["USER"]}",
"--basedir=#{prefix}", "--datadir=#{dir}", "--tmpdir=#{dir}"
pid = fork do
exec bin/"mysqld", "--bind-address=127.0.0.1", "--datadir=#{dir}"
end
sleep 2
output = shell_output("curl 127.0.0.1:3306")
output.force_encoding("ASCII-8BIT") if output.respond_to?(:force_encoding)
assert_match version.to_s, output
ensure
Process.kill(9, pid)
Process.wait(pid)
end
end
end