Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

...
  • 6 commits
  • 8 files changed
  • 0 commit comments
  • 1 contributor
Commits on Feb 22, 2012
Sandro Turriate Revert "Fix hang, don't wait on managers, they just chill"
This reverts commit 5e2a0cd.
It was the right idea, but not quite there yet.
bd7477e
Sandro Turriate Fix specjour prepare task, fix test hangs
If running prepare, wait for the managers to finish. If running tests,
let the printer block until all tests are complete.
Reproduce the hanging printer by initializing more workers than tests.
88d2558
Sandro Turriate Fix specjour binary path
Bundler has specjour/lib in its load path, rubygems has
specjour-version/lib.
bb4a2e4
Sandro Turriate Fix duplicate tests dispatched by printer
A slow worker would call tests= after some tests had already been run.
334cb9a
Sandro Turriate History afed101
Sandro Turriate Bump 864c6f1
12 History.markdown
View
@@ -1,8 +1,16 @@
History
=======
-0.5.1 / 2012-02-21
-------------------
+0.5.2 / 2012-02-21
+---------------------------
+* [fixed] Binary path used by Loader
+* [fixed] Specjour prepare wouldn't wait for managers to complete
+* [fixed] Slower machines adding completed tests back to suite
+
+[Full Changelog](https://github.com/sandro/specjour/compare/v0.5.1...v0.5.2)
+
+0.5.1 / 2012-02-21 - yanked
+---------------------------
* [fixed] Dispatcher hanging after printing the report
* [added] More verbosity during startup
2  lib/specjour.rb
View
@@ -29,7 +29,7 @@ module Specjour
autoload :Cucumber, 'specjour/cucumber'
autoload :RSpec, 'specjour/rspec'
- VERSION ||= "0.5.1"
+ VERSION ||= "0.5.2"
HOOKS_PATH ||= "./.specjour/hooks.rb"
PROGRAM_NAME ||= $PROGRAM_NAME # keep a reference of the original program name
28 lib/specjour/connection.rb
View
@@ -3,7 +3,7 @@ class Connection
include Protocol
extend Forwardable
- attr_reader :uri
+ attr_reader :uri, :retries
attr_writer :socket
def_delegators :socket, :flush, :close, :closed?, :gets, :each
@@ -17,6 +17,7 @@ def self.wrap(established_connection)
def initialize(uri)
@uri = uri
+ @retries = 0
end
alias to_str to_s
@@ -33,11 +34,6 @@ def socket
@socket ||= connect
end
- def timeout(&block)
- Timeout.timeout(0.5, &block)
- rescue Timeout::Error
- end
-
def next_test
will_reconnect do
send_message(:ready)
@@ -52,12 +48,16 @@ def print(arg)
end
def puts(arg='')
- print(arg << "\n")
+ will_reconnect do
+ print(arg << "\n")
+ end
end
def send_message(method_name, *args)
- print([method_name, *args])
- flush
+ will_reconnect do
+ print([method_name, *args])
+ flush
+ end
end
protected
@@ -65,8 +65,6 @@ def send_message(method_name, *args)
def connect_socket
@socket = TCPSocket.open(uri.host, uri.port)
rescue Errno::ECONNREFUSED => error
- Specjour.logger.debug "Could not connect to #{uri.to_s}\n#{error.inspect}"
- sleep 0.1
retry
end
@@ -75,12 +73,18 @@ def reconnect
connect
end
+ def timeout(&block)
+ Timeout.timeout(0.1, &block)
+ rescue Timeout::Error
+ end
+
def will_reconnect(&block)
block.call
rescue SystemCallError, IOError => error
unless Specjour.interrupted?
+ @retries += 1
reconnect
- retry
+ retry if retries <= 5
end
end
end
10 lib/specjour/dispatcher.rb
View
@@ -24,7 +24,11 @@ def start
gather_managers
rsync_daemon.start
dispatch_work
- printer.start if dispatching_tests?
+ if dispatching_tests?
+ printer.start
+ else
+ wait_on_managers
+ end
exit printer.exit_status
end
@@ -153,6 +157,10 @@ def set_up_manager(manager)
end
end
+ def wait_on_managers
+ manager_threads.each {|t| t.join; t.exit}
+ end
+
def worker_task
options[:worker_task] || 'run_tests'
end
23 lib/specjour/loader.rb
View
@@ -81,20 +81,14 @@ def file_collector(paths, &globber)
end
def load_app
- share_examples if spec_files.any?
- share_features if feature_files.any?
+ RSpec::Preloader.load spec_files if spec_files.any?
+ Cucumber::Preloader.load if feature_files.any?
+ register_tests_with_printer
end
- def share_examples
- RSpec::Preloader.load spec_files
- connection.send_message :tests=, filtered_examples
- ensure
- ::RSpec.reset
- end
-
- def share_features
- Cucumber::Preloader.load
- connection.send_message :tests=, feature_files
+ def register_tests_with_printer
+ tests = filtered_examples | feature_files
+ connection.send_message :tests=, tests
end
def filtered_examples
@@ -118,12 +112,9 @@ def kill_worker_processes
def connection
@connection ||= begin
at_exit { connection.disconnect }
- printer_connection
+ Connection.new URI.parse(printer_uri)
end
end
- def printer_connection
- Connection.new URI.parse(printer_uri)
- end
end
end
2  lib/specjour/manager.rb
View
@@ -62,7 +62,7 @@ def dispatch_loader
exec_cmd << " --test-paths #{test_paths.join(" ")}" if test_paths.any?
exec_cmd << " --log" if Specjour.log?
exec_cmd << " --quiet" if quiet?
- load_path = $LOAD_PATH.detect {|l| l =~ %r(specjour/lib$)}
+ load_path = $LOAD_PATH.detect {|l| l =~ %r(specjour.*/lib$)}
bin_path = File.expand_path(File.join(load_path, "../bin"))
Kernel.exec({"RUBYLIB" => load_path}, "#{bin_path}/specjour #{exec_cmd}")
end
6 lib/specjour/printer.rb
View
@@ -71,8 +71,10 @@ def done(client)
end
def tests=(client, tests)
- self.tests_to_run = run_order(tests_to_run | tests)
- self.example_size = tests_to_run.size
+ if tests_to_run.empty?
+ self.tests_to_run = run_order(tests)
+ self.example_size = tests_to_run.size
+ end
end
def rspec_summary=(client, summary)
7 spec/specjour/printer_spec.rb
View
@@ -21,17 +21,10 @@
subject.tests_to_run.should =~ ["one_spec.rb", "two_spec.rb"]
end
- it "accumulates both features and specs" do
- subject.send(:tests=, nil, ["one.feature", "two.feature"])
- subject.send(:tests=, nil, ["one_spec.rb", "two_spec.rb"])
- subject.tests_to_run.should =~ ["one.feature", "two.feature", "one_spec.rb", "two_spec.rb"]
- end
-
it "disregards duplicates" do
subject.send(:tests=, nil, ["one_spec.rb", "two_spec.rb"])
subject.send(:tests=, nil, ["one_spec.rb", "two_spec.rb"])
subject.tests_to_run.should =~ ["one_spec.rb", "two_spec.rb"]
- p subject.tests_to_run
end
it "doesn't increment example_size with duplicates" do

No commit comments for this range

Something went wrong with that request. Please try again.