Sha256: e920e647eca2948438202bc95f943750b17ede9476da40cc25e666f066d4ef48
Contents?: true
Size: 783 Bytes
Versions: 9
Compression:
Stored size: 783 Bytes
Contents
# For Gem.ruby, and almost certainly already loaded require 'rubygems' module TestNode PORT = 21264 def self.start @pid = Process.spawn Gem.ruby, File.expand_path("../../test_node.rb", __FILE__) end def self.wait_until_ready STDERR.print "Waiting for test node to start up..." socket = nil 30.times do begin socket = TCPSocket.open("127.0.0.1", PORT) break if socket rescue Errno::ECONNREFUSED STDERR.print "." sleep 1 end end if socket STDERR.puts " done!" socket.close else STDERR.puts " FAILED!" raise "couldn't connect to test node!" end end def self.stop Process.kill 9, @pid rescue Errno::ESRCH ensure Process.wait @pid rescue nil end end
Version data entries
9 entries across 9 versions & 1 rubygems