jason-o-matic-deep_test 1.2.2.2 → 1.2.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,7 @@ module DeepTest
4
4
  def initialize(options, slaves)
5
5
  DeepTest.logger.debug "MultiTestServerProxy#initialize #{slaves.length} slaves"
6
6
  @slave_controller = DispatchController.new(options, slaves)
7
+ @slaves = slaves
7
8
  end
8
9
 
9
10
  def spawn_worker_server(options)
@@ -14,8 +15,15 @@ module DeepTest
14
15
  end
15
16
 
16
17
  def sync(options)
17
- DeepTest.logger.debug "dispatch sync for #{options.origin_hostname}"
18
- @slave_controller.dispatch(:sync, options)
18
+ if options.sync_options[:push_code]
19
+ @slaves.each do |slave|
20
+ DeepTest.logger.debug "sync to: #{slave.inspect}"
21
+ RSync.sync(slave.connection_info, options, options.mirror_path(slave.config[:work_dir]))
22
+ end
23
+ else
24
+ DeepTest.logger.debug "dispatch sync for #{options.origin_hostname}"
25
+ @slave_controller.dispatch(:sync, options)
26
+ end
19
27
  end
20
28
 
21
29
  class WorkerServerProxy
@@ -13,23 +13,33 @@ module DeepTest
13
13
  @connection_info = connection_info
14
14
  @options = options
15
15
  @sync_options = options.sync_options
16
+ raise "Pushing code to a daemon isn't supported at the moment" if @sync_options[:daemon] && @sync_options[:push_code]
16
17
  end
17
18
 
18
19
  def command(destination)
19
20
  # The '/' after source tells rsync to copy the contents
20
21
  # of source to destination, rather than the source directory
21
22
  # itself
22
- "rsync -az --delete #{@sync_options[:rsync_options]} #{source_location}/ #{destination}".strip.squeeze(" ")
23
+ "rsync -az --delete #{@sync_options[:rsync_options]} #{source_location}/ #{destination_location(destination)}".strip.squeeze(" ")
23
24
  end
24
25
 
25
26
  def source_location
26
- source = ""
27
- unless @sync_options[:local]
28
- source << @sync_options[:username] << '@' if @sync_options[:username]
29
- source << @connection_info.address
30
- source << (@sync_options[:daemon] ? '::' : ':')
31
- end
32
- source << @sync_options[:source]
27
+ loc = ""
28
+ loc << common_location_options unless @sync_options[:local] || @sync_options[:push_code]
29
+ loc << @sync_options[:source]
30
+ end
31
+
32
+ def destination_location(destination)
33
+ loc = ""
34
+ loc << common_location_options unless @sync_options[:local] || !@sync_options[:push_code]
35
+ loc << destination
36
+ end
37
+
38
+ def common_location_options
39
+ loc = ""
40
+ loc << @sync_options[:username] << '@' if @sync_options[:username]
41
+ loc << @connection_info.address
42
+ loc << (@sync_options[:daemon] ? '::' : ':')
33
43
  end
34
44
  end
35
45
  end
@@ -33,6 +33,14 @@ module DeepTest
33
33
  DeepTest.logger.debug "Syncing #{options.sync_options[:source]} to #{path}"
34
34
  RSync.sync(DRbClientConnectionInfo.new, options, path)
35
35
  end
36
+
37
+ def connection_info
38
+ DRbClientConnectionInfo.new
39
+ end
40
+
41
+ def config
42
+ @config
43
+ end
36
44
 
37
45
  def servers
38
46
  [DRbObject.new_with_uri(DRb.uri)]
@@ -54,7 +54,7 @@ module DeepTest
54
54
  end
55
55
 
56
56
  def origin_hostname
57
- (Socket.gethostname == @origin_hostname) ? 'localhost' : @origin_hostname
57
+ @origin_hostname
58
58
  end
59
59
 
60
60
  # Don't store UI instances in the options instance, which will
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jason-o-matic-deep_test
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2.2
4
+ version: 1.2.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - anonymous z, Dan Manges, David Vollbracht