diff options
Diffstat (limited to 'test/fresh.rb')
-rw-r--r-- | test/fresh.rb | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/test/fresh.rb b/test/fresh.rb index 6afacde..8d452c7 100644 --- a/test/fresh.rb +++ b/test/fresh.rb @@ -7,24 +7,22 @@ require "net/http" module TestFreshSetup include TestExec - def setup - setup_mogilefs - end - def setup_mogilefs(plugins = nil) + @teardown_pid = $$ @test_host = "127.0.0.1" setup_mogstored @tracker = TCPServer.new(@test_host, 0) @tracker_port = @tracker.addr[1] - @dbname = Tempfile.new(["mogfresh", ".sqlite3"]) - @mogilefsd_conf = Tempfile.new(["mogilefsd", "conf"]) - @mogilefsd_pid = Tempfile.new(["mogilefsd", "pid"]) + @dbname = Tempfile.new(["mogfresh", ".sqlite3"], @docroot) + @mogilefsd_conf = Tempfile.new(["mogilefsd", "conf"], @docroot) + @mogilefsd_pid = Tempfile.new(["mogilefsd", "pid"], @docroot) + @dbpath = @dbname.path - cmd = %w(mogdbsetup --yes --type=SQLite --dbname) << @dbname.path + cmd = %w(mogdbsetup --yes --type=SQLite --dbname) << @dbpath x!(*cmd) - @mogilefsd_conf.puts "db_dsn DBI:SQLite:#{@dbname.path}" + @mogilefsd_conf.puts "db_dsn DBI:SQLite:#@dbpath" @mogilefsd_conf.write <<EOF conf_port #@tracker_port listen #@test_host @@ -109,6 +107,7 @@ EOF end def teardown_mogilefs + return if $$ != @teardown_pid if @mogstored_pid pid = File.read(@mogstored_pid.path).to_i Process.kill(:TERM, pid) if pid > 0 @@ -144,8 +143,8 @@ EOF @mogstored_http = TCPServer.new(@test_host, 0) @mogstored_mgmt_port = @mogstored_mgmt.addr[1] @mogstored_http_port = @mogstored_http.addr[1] - @mogstored_conf = Tempfile.new(["mogstored", "conf"]) - @mogstored_pid = Tempfile.new(["mogstored", "pid"]) + @mogstored_conf = Tempfile.new(["mogstored", "conf"], @docroot) + @mogstored_pid = Tempfile.new(["mogstored", "pid"], @docroot) @mogstored_conf.write <<EOF pidfile = #{@mogstored_pid.path} maxconns = 1000 |