Kouhei Sutou 2019-05-11 17:13:58 +0900 (Sat, 11 May 2019) Revision: f22026a76e43fc78189cc85768047ea658834479 https://github.com/ranguba/rroonga/commit/f22026a76e43fc78189cc85768047ea658834479 Message: test: use groonga-client for portability Modified files: test/groonga-test-utils.rb test/test-remote.rb Modified: test/groonga-test-utils.rb (+6 -3) =================================================================== --- test/groonga-test-utils.rb 2019-05-11 07:21:05 +0900 (75ff862a) +++ test/groonga-test-utils.rb 2019-05-11 17:13:58 +0900 (aeb3df48) @@ -14,13 +14,16 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +require "erb" require "fileutils" +require "json" require "pathname" +require "stringio" require "tempfile" require "time" -require "erb" -require "stringio" -require "json" +require "timeout" + +require "groonga/client" require "pkg-config" require "groonga" Modified: test/test-remote.rb (+27 -3) =================================================================== --- test/test-remote.rb 2019-05-11 07:21:05 +0900 (de094685) +++ test/test-remote.rb 2019-05-11 17:13:58 +0900 (c25b768c) @@ -34,18 +34,42 @@ class RemoteTest < Test::Unit::TestCase @process_id = spawn(groonga, "-i", @host, "-p", @port.to_s, - "-s", "-n", @remote_database_path.to_s) - sleep(1) + "-s", + "-n", @remote_database_path.to_s) + Timeout.timeout(5) do + loop do + begin + open_client do |client| + client.status + end + rescue Groonga::Client::Error + else + break + end + end + end end teardown def teardown_remote_connection if @process_id - Process.kill(:INT, @process_id) + begin + open_client do |client| + client.shutdown + end + rescue Groonga::Client::Error + end Process.waitpid(@process_id) end end + def open_client(&block) + Groonga::Client.open(host: @host, + port: @port, + protocol: :gqtp, + &block) + end + def test_send _context = Groonga::Context.new _context.connect(:host => @host, :port => @port) -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20190511/565330b4/attachment-0001.html>