specjour 0.5.0 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.markdown +16 -1
- data/lib/specjour/cli.rb +1 -0
- data/lib/specjour/connection.rb +17 -13
- data/lib/specjour/cucumber/preloader.rb +1 -0
- data/lib/specjour/dispatcher.rb +7 -8
- data/lib/specjour/loader.rb +8 -17
- data/lib/specjour/manager.rb +6 -8
- data/lib/specjour/printer.rb +5 -3
- data/lib/specjour/rspec/preloader.rb +1 -0
- data/lib/specjour/worker.rb +1 -1
- data/lib/specjour.rb +7 -10
- metadata +14 -14
data/History.markdown
CHANGED
@@ -1,6 +1,21 @@
|
|
1
1
|
History
|
2
2
|
=======
|
3
3
|
|
4
|
+
0.5.2 / 2012-02-21
|
5
|
+
---------------------------
|
6
|
+
* [fixed] Binary path used by Loader
|
7
|
+
* [fixed] Specjour prepare wouldn't wait for managers to complete
|
8
|
+
* [fixed] Slower machines adding completed tests back to suite
|
9
|
+
|
10
|
+
[Full Changelog](https://github.com/sandro/specjour/compare/v0.5.1...v0.5.2)
|
11
|
+
|
12
|
+
0.5.1 / 2012-02-21 - yanked
|
13
|
+
---------------------------
|
14
|
+
* [fixed] Dispatcher hanging after printing the report
|
15
|
+
* [added] More verbosity during startup
|
16
|
+
|
17
|
+
[Full Changelog](https://github.com/sandro/specjour/compare/v0.5.0...v0.5.1)
|
18
|
+
|
4
19
|
0.5.0 / 2012-02-20
|
5
20
|
----------------------
|
6
21
|
|
@@ -26,7 +41,7 @@ History
|
|
26
41
|
the regular test environment can be loaded, a worker without a database
|
27
42
|
shouldn't raise an exception, instead the db should be created.
|
28
43
|
|
29
|
-
[Full Changelog](https://github.com/sandro/specjour/compare/v0.4.1...
|
44
|
+
[Full Changelog](https://github.com/sandro/specjour/compare/v0.4.1...v0.5.0)
|
30
45
|
|
31
46
|
0.4.1 / 2011-06-17
|
32
47
|
------------------
|
data/lib/specjour/cli.rb
CHANGED
@@ -16,6 +16,7 @@ module Specjour
|
|
16
16
|
|
17
17
|
# allow specjour to be called with path arguments
|
18
18
|
def self.start(original_args=ARGV, config={})
|
19
|
+
Specjour.trap_interrupt
|
19
20
|
real_tasks = all_tasks.keys | @map.keys
|
20
21
|
unless real_tasks.include? original_args.first
|
21
22
|
original_args.unshift default_task
|
data/lib/specjour/connection.rb
CHANGED
@@ -3,7 +3,7 @@ module Specjour
|
|
3
3
|
include Protocol
|
4
4
|
extend Forwardable
|
5
5
|
|
6
|
-
attr_reader :uri
|
6
|
+
attr_reader :uri, :retries
|
7
7
|
attr_writer :socket
|
8
8
|
|
9
9
|
def_delegators :socket, :flush, :close, :closed?, :gets, :each
|
@@ -17,6 +17,7 @@ module Specjour
|
|
17
17
|
|
18
18
|
def initialize(uri)
|
19
19
|
@uri = uri
|
20
|
+
@retries = 0
|
20
21
|
end
|
21
22
|
|
22
23
|
alias to_str to_s
|
@@ -26,18 +27,13 @@ module Specjour
|
|
26
27
|
end
|
27
28
|
|
28
29
|
def disconnect
|
29
|
-
socket.close
|
30
|
+
socket.close if socket && !socket.closed?
|
30
31
|
end
|
31
32
|
|
32
33
|
def socket
|
33
34
|
@socket ||= connect
|
34
35
|
end
|
35
36
|
|
36
|
-
def timeout(&block)
|
37
|
-
Timeout.timeout(0.5, &block)
|
38
|
-
rescue Timeout::Error
|
39
|
-
end
|
40
|
-
|
41
37
|
def next_test
|
42
38
|
will_reconnect do
|
43
39
|
send_message(:ready)
|
@@ -52,12 +48,16 @@ module Specjour
|
|
52
48
|
end
|
53
49
|
|
54
50
|
def puts(arg='')
|
55
|
-
|
51
|
+
will_reconnect do
|
52
|
+
print(arg << "\n")
|
53
|
+
end
|
56
54
|
end
|
57
55
|
|
58
56
|
def send_message(method_name, *args)
|
59
|
-
|
60
|
-
|
57
|
+
will_reconnect do
|
58
|
+
print([method_name, *args])
|
59
|
+
flush
|
60
|
+
end
|
61
61
|
end
|
62
62
|
|
63
63
|
protected
|
@@ -65,8 +65,6 @@ module Specjour
|
|
65
65
|
def connect_socket
|
66
66
|
@socket = TCPSocket.open(uri.host, uri.port)
|
67
67
|
rescue Errno::ECONNREFUSED => error
|
68
|
-
Specjour.logger.debug "Could not connect to #{uri.to_s}\n#{error.inspect}"
|
69
|
-
sleep 0.1
|
70
68
|
retry
|
71
69
|
end
|
72
70
|
|
@@ -75,12 +73,18 @@ module Specjour
|
|
75
73
|
connect
|
76
74
|
end
|
77
75
|
|
76
|
+
def timeout(&block)
|
77
|
+
Timeout.timeout(0.1, &block)
|
78
|
+
rescue Timeout::Error
|
79
|
+
end
|
80
|
+
|
78
81
|
def will_reconnect(&block)
|
79
82
|
block.call
|
80
83
|
rescue SystemCallError, IOError => error
|
81
84
|
unless Specjour.interrupted?
|
85
|
+
@retries += 1
|
82
86
|
reconnect
|
83
|
-
retry
|
87
|
+
retry if retries <= 5
|
84
88
|
end
|
85
89
|
end
|
86
90
|
end
|
data/lib/specjour/dispatcher.rb
CHANGED
@@ -16,7 +16,7 @@ module Specjour
|
|
16
16
|
@managers = []
|
17
17
|
@drb_connection_errors = Hash.new(0)
|
18
18
|
@rsync_port = options[:rsync_port]
|
19
|
-
|
19
|
+
@manager_threads = []
|
20
20
|
end
|
21
21
|
|
22
22
|
def start
|
@@ -24,8 +24,11 @@ module Specjour
|
|
24
24
|
gather_managers
|
25
25
|
rsync_daemon.start
|
26
26
|
dispatch_work
|
27
|
-
|
28
|
-
|
27
|
+
if dispatching_tests?
|
28
|
+
printer.start
|
29
|
+
else
|
30
|
+
wait_on_managers
|
31
|
+
end
|
29
32
|
exit printer.exit_status
|
30
33
|
end
|
31
34
|
|
@@ -74,6 +77,7 @@ module Specjour
|
|
74
77
|
puts "No listeners found on this machine, starting one..."
|
75
78
|
manager_options = {:worker_size => options[:worker_size], :registered_projects => [project_alias], :rsync_port => rsync_port}
|
76
79
|
manager = Manager.start_quietly manager_options
|
80
|
+
Process.detach manager.pid
|
77
81
|
fetch_manager(manager.drb_uri)
|
78
82
|
at_exit do
|
79
83
|
unless Specjour.interrupted?
|
@@ -122,10 +126,6 @@ module Specjour
|
|
122
126
|
@project_name ||= File.basename(project_path)
|
123
127
|
end
|
124
128
|
|
125
|
-
def reset_manager_threads
|
126
|
-
@manager_threads = []
|
127
|
-
end
|
128
|
-
|
129
129
|
def resolve_reply(reply)
|
130
130
|
DNSSD.resolve!(reply.name, reply.type, reply.domain, flags=0, reply.interface) do |resolved|
|
131
131
|
Specjour.logger.debug "Bonjour discovered #{resolved.target}"
|
@@ -159,7 +159,6 @@ module Specjour
|
|
159
159
|
|
160
160
|
def wait_on_managers
|
161
161
|
manager_threads.each {|t| t.join; t.exit}
|
162
|
-
reset_manager_threads
|
163
162
|
end
|
164
163
|
|
165
164
|
def worker_task
|
data/lib/specjour/loader.rb
CHANGED
@@ -23,7 +23,7 @@ module Specjour
|
|
23
23
|
Configuration.after_load.call
|
24
24
|
(1..worker_size).each do |index|
|
25
25
|
worker_pids << fork do
|
26
|
-
|
26
|
+
Worker.new(
|
27
27
|
:number => index,
|
28
28
|
:printer_uri => printer_uri,
|
29
29
|
:quiet => quiet
|
@@ -81,20 +81,14 @@ module Specjour
|
|
81
81
|
end
|
82
82
|
|
83
83
|
def load_app
|
84
|
-
|
85
|
-
|
84
|
+
RSpec::Preloader.load spec_files if spec_files.any?
|
85
|
+
Cucumber::Preloader.load if feature_files.any?
|
86
|
+
register_tests_with_printer
|
86
87
|
end
|
87
88
|
|
88
|
-
def
|
89
|
-
|
90
|
-
connection.send_message :tests=,
|
91
|
-
ensure
|
92
|
-
::RSpec.reset
|
93
|
-
end
|
94
|
-
|
95
|
-
def share_features
|
96
|
-
Cucumber::Preloader.load
|
97
|
-
connection.send_message :tests=, feature_files
|
89
|
+
def register_tests_with_printer
|
90
|
+
tests = filtered_examples | feature_files
|
91
|
+
connection.send_message :tests=, tests
|
98
92
|
end
|
99
93
|
|
100
94
|
def filtered_examples
|
@@ -118,12 +112,9 @@ module Specjour
|
|
118
112
|
def connection
|
119
113
|
@connection ||= begin
|
120
114
|
at_exit { connection.disconnect }
|
121
|
-
|
115
|
+
Connection.new URI.parse(printer_uri)
|
122
116
|
end
|
123
117
|
end
|
124
118
|
|
125
|
-
def printer_connection
|
126
|
-
Connection.new URI.parse(printer_uri)
|
127
|
-
end
|
128
119
|
end
|
129
120
|
end
|
data/lib/specjour/manager.rb
CHANGED
@@ -22,7 +22,6 @@ module Specjour
|
|
22
22
|
@worker_task = options[:worker_task]
|
23
23
|
@registered_projects = options[:registered_projects]
|
24
24
|
@rsync_port = options[:rsync_port]
|
25
|
-
at_exit { kill_loader_process }
|
26
25
|
end
|
27
26
|
|
28
27
|
def available_for?(project_name)
|
@@ -63,15 +62,13 @@ module Specjour
|
|
63
62
|
exec_cmd << " --test-paths #{test_paths.join(" ")}" if test_paths.any?
|
64
63
|
exec_cmd << " --log" if Specjour.log?
|
65
64
|
exec_cmd << " --quiet" if quiet?
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
exec_cmd = "ruby #{load_path} -rspecjour -e '#{exec_ruby}'"
|
70
|
-
exec exec_cmd
|
65
|
+
load_path = $LOAD_PATH.detect {|l| l =~ %r(specjour.*/lib$)}
|
66
|
+
bin_path = File.expand_path(File.join(load_path, "../bin"))
|
67
|
+
Kernel.exec({"RUBYLIB" => load_path}, "#{bin_path}/specjour #{exec_cmd}")
|
71
68
|
end
|
72
69
|
Process.waitall
|
73
70
|
ensure
|
74
|
-
kill_loader_process
|
71
|
+
kill_loader_process if loader_pid
|
75
72
|
end
|
76
73
|
|
77
74
|
def in_project(&block)
|
@@ -80,7 +77,7 @@ module Specjour
|
|
80
77
|
|
81
78
|
def interrupted=(bool)
|
82
79
|
Specjour.interrupted = bool
|
83
|
-
kill_loader_process
|
80
|
+
kill_loader_process if loader_pid
|
84
81
|
end
|
85
82
|
|
86
83
|
def kill_loader_process
|
@@ -89,6 +86,7 @@ module Specjour
|
|
89
86
|
else
|
90
87
|
Process.kill('TERM', loader_pid) rescue Errno::ESRCH
|
91
88
|
end
|
89
|
+
@loader_pid = nil
|
92
90
|
end
|
93
91
|
|
94
92
|
def pid
|
data/lib/specjour/printer.rb
CHANGED
@@ -71,8 +71,10 @@ module Specjour
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def tests=(client, tests)
|
74
|
-
|
75
|
-
|
74
|
+
if tests_to_run.empty?
|
75
|
+
self.tests_to_run = run_order(tests)
|
76
|
+
self.example_size = tests_to_run.size
|
77
|
+
end
|
76
78
|
end
|
77
79
|
|
78
80
|
def rspec_summary=(client, summary)
|
@@ -89,7 +91,7 @@ module Specjour
|
|
89
91
|
end
|
90
92
|
|
91
93
|
def disconnecting
|
92
|
-
if (examples_complete == example_size || clients.empty?
|
94
|
+
if (examples_complete == example_size) || clients.empty?
|
93
95
|
throw(:stop)
|
94
96
|
end
|
95
97
|
end
|
data/lib/specjour/worker.rb
CHANGED
data/lib/specjour.rb
CHANGED
@@ -29,8 +29,13 @@ module Specjour
|
|
29
29
|
autoload :Cucumber, 'specjour/cucumber'
|
30
30
|
autoload :RSpec, 'specjour/rspec'
|
31
31
|
|
32
|
-
VERSION
|
33
|
-
HOOKS_PATH
|
32
|
+
VERSION ||= "0.5.2"
|
33
|
+
HOOKS_PATH ||= "./.specjour/hooks.rb"
|
34
|
+
PROGRAM_NAME ||= $PROGRAM_NAME # keep a reference of the original program name
|
35
|
+
|
36
|
+
GC.copy_on_write_friendly = true if GC.respond_to?(:copy_on_write_friendly=)
|
37
|
+
|
38
|
+
class Error < StandardError; end
|
34
39
|
|
35
40
|
def self.interrupted?
|
36
41
|
@interrupted
|
@@ -75,12 +80,4 @@ module Specjour
|
|
75
80
|
abort("\n")
|
76
81
|
end
|
77
82
|
end
|
78
|
-
|
79
|
-
Error = Class.new(StandardError)
|
80
|
-
PROGRAM_NAME = $PROGRAM_NAME # keep a reference of the original program name
|
81
|
-
|
82
|
-
GC.copy_on_write_friendly = true if GC.respond_to?(:copy_on_write_friendly=)
|
83
|
-
|
84
|
-
trap_interrupt
|
85
|
-
|
86
83
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: specjour
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-02-
|
12
|
+
date: 2012-02-22 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: dnssd
|
16
|
-
requirement: &
|
16
|
+
requirement: &2156640700 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - =
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 2.0.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2156640700
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: thor
|
27
|
-
requirement: &
|
27
|
+
requirement: &2156640200 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.14.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2156640200
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &2156639660 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 2.8.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2156639660
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rr
|
49
|
-
requirement: &
|
49
|
+
requirement: &2156639180 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.0.4
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2156639180
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: cucumber
|
60
|
-
requirement: &
|
60
|
+
requirement: &2156638680 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 1.1.4
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2156638680
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: yard
|
71
|
-
requirement: &
|
71
|
+
requirement: &2156638160 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: 0.7.2
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *2156638160
|
80
80
|
description: ! " Specjour splits your RSpec suite across multiple machines, and
|
81
81
|
multiple\n cores per machine, to run super-parallel-fast! Also works with Cucumber.\n"
|
82
82
|
email: sandro.turriate@gmail.com
|