null+****@clear*****
null+****@clear*****
2012年 6月 12日 (火) 11:05:10 JST
Haruka Yoshihara 2012-06-12 11:05:10 +0900 (Tue, 12 Jun 2012) New Revision: b79f4b43c9d16270f1f2decdd57cdc15968f9411 Log: Create an empty database before HTTP tests with groonga-httpd Modified files: lib/groonga/tester.rb Modified: lib/groonga/tester.rb (+14 -0) =================================================================== --- lib/groonga/tester.rb 2012-06-11 17:20:49 +0900 (3e6a0ae) +++ lib/groonga/tester.rb 2012-06-12 11:05:10 +0900 (ffa7fea) @@ -367,6 +367,7 @@ module Groonga end def create_config_file(host, port, db_path, pid_file) + create_empty_database(db_path) config_file = Tempfile.new("test-httpd.conf") config_file.puts <<EOF worker_processes 1; @@ -390,6 +391,19 @@ EOF config_file end + def create_empty_database(db_path) + groonga_command = ENV["GROONGA"] || "groonga" + output_fd = Tempfile.new("create-empty-database") + create_database_command = [ + groonga_command, + "--output-fd", output_fd.to_i.to_s, + "-n", db_path, + "shutdown" + ] + system(*create_database_command) + output_fd.close(true) + end + def normalize_result(result) normalized_result = "" result.each do |tag, content, options|