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
|
-
|
18
|
-
|
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
|
-
|
27
|
-
unless @sync_options[:local]
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
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)]
|
data/lib/deep_test/options.rb
CHANGED