class DeepTest::Distributed::TestServer
Constants
- DEFAULT_CONFIG
Public Class Methods
connect(options)
click to toggle source
# File lib/deep_test/distributed/test_server.rb, line 72 def self.connect(options) servers = DRbObject.new_with_uri(options.distributed_server).servers MultiTestServerProxy.new(options, servers) end
new(config)
click to toggle source
# File lib/deep_test/distributed/test_server.rb, line 10 def initialize(config) @config = config end
parse_args(args)
click to toggle source
# File lib/deep_test/distributed/test_server.rb, line 47 def self.parse_args(args) options = DeepTest::Distributed::TestServer::DEFAULT_CONFIG.dup OptionParser.new do |opts| opts.banner = "Usage: deep_test test_server [options]" opts.on("--work_dir PATH", "Absolute path to keep mirror working copies at") do |v| options[:work_dir] = v end opts.on("--uri URI", "DRb URI to bind server to") do |v| options[:uri] = v end opts.on("--number_of_workers NUM", "Number of workers to start when running tests") do |v| options[:number_of_workers] = v.to_i end opts.on_tail("-h", "--help", "Show this message") do puts opts exit end end.parse(args) options end
start(config)
click to toggle source
# File lib/deep_test/distributed/test_server.rb, line 40 def self.start(config) server = DeepTest::Distributed::TestServer.new(config) DRb.start_service(config[:uri], server) DeepTest.logger.info "TestServer listening at #{DRb.uri}" DRb.thread.join end
Public Instance Methods
servers()
click to toggle source
# File lib/deep_test/distributed/test_server.rb, line 36 def servers [DRbObject.new_with_uri(DRb.uri)] end
spawn_worker_server(options)
click to toggle source
# File lib/deep_test/distributed/test_server.rb, line 14 def spawn_worker_server(options) DeepTest.logger.debug("mirror spawn_worker_server for #{options.origin_hostname}") RemoteWorkerServer.start(URI.parse(@config[:uri]).host, options.mirror_path(@config[:work_dir]), TestServerWorkers.new(options, @config, DRbClientConnectionInfo.new)) end
status()
click to toggle source
# File lib/deep_test/distributed/test_server.rb, line 21 def status TestServerStatus.new( DRb.uri, @config[:number_of_workers], RemoteWorkerServer.running_server_count ) end
sync(options)
click to toggle source
# File lib/deep_test/distributed/test_server.rb, line 29 def sync(options) DeepTest.logger.debug "mirror sync for #{options.origin_hostname}" path = options.mirror_path(@config[:work_dir]) DeepTest.logger.debug "Syncing #{options.sync_options[:source]} to #{path}" RSync.sync(DRbClientConnectionInfo.new, options, path) end