specjour 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.markdown +15 -5
- data/VERSION +1 -1
- data/lib/specjour/dispatcher.rb +1 -0
- data/lib/specjour/manager.rb +8 -4
- data/lib/specjour.rb +1 -1
- metadata +3 -3
data/README.markdown
CHANGED
@@ -1,13 +1,11 @@
|
|
1
1
|
# Specjour
|
2
|
-
|
3
2
|
_Distribute your spec suite amongst your LAN via Bonjour._
|
4
3
|
|
5
4
|
1. Start a dispatcher in your project directory.
|
6
5
|
2. Spin up a manager on each remote machine.
|
7
|
-
3. Say
|
6
|
+
3. Say farewell to your long coffee breaks.
|
8
7
|
|
9
8
|
## Requirements
|
10
|
-
|
11
9
|
* Bonjour or DNSSD (the capability and the gem)
|
12
10
|
* Rsync (system command used)
|
13
11
|
* Rspec (officially v1.3.0)
|
@@ -21,15 +19,27 @@ Running `specjour` on the command-line will start a manager which advertises tha
|
|
21
19
|
$ specjour
|
22
20
|
|
23
21
|
## Setup the dispatcher
|
24
|
-
|
22
|
+
Require specjour's rake tasks in your project's `Rakefile`.
|
25
23
|
|
26
24
|
require 'specjour/tasks/specjour'
|
27
25
|
|
28
26
|
## Distribute the tests
|
29
|
-
Run the rake task
|
27
|
+
Run the rake task to distribute the tests among the managers you started.
|
30
28
|
|
31
29
|
$ rake specjour
|
32
30
|
|
31
|
+
## Rails
|
32
|
+
Edit your config/environment.rb
|
33
|
+
|
34
|
+
config.gem 'specjour'
|
35
|
+
|
36
|
+
Each worker should run their specs in an isolated database. Modify the test database name in your `config/database.yml` to include the following environment variable (Influenced by [parallel_tests](http://github.com/grosser/parallel_tests)):
|
37
|
+
|
38
|
+
test:
|
39
|
+
database: blog_test<%=ENV['TEST_ENV_NUMBER']%>
|
40
|
+
|
41
|
+
Each worker will attempt to clear its database tables before running any specs via `DELETE FROM <table_name>;`. Additionally, test databases will be created if they don't exist (i.e. blog_test8 for the 8th worker) and will be migrated when necessary.
|
42
|
+
|
33
43
|
## Note on Patches/Pull Requests
|
34
44
|
|
35
45
|
* Fork the project.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.7
|
data/lib/specjour/dispatcher.rb
CHANGED
@@ -113,6 +113,7 @@ module Specjour
|
|
113
113
|
def set_up_manager(manager, uri)
|
114
114
|
manager.project_name = project_name
|
115
115
|
manager.dispatcher_uri = URI::Generic.build :scheme => "specjour", :host => hostname, :port => printer.port
|
116
|
+
at_exit { manager.kill_worker_processes }
|
116
117
|
end
|
117
118
|
|
118
119
|
def sync_managers
|
data/lib/specjour/manager.rb
CHANGED
@@ -4,12 +4,13 @@ module Specjour
|
|
4
4
|
include DRbUndumped
|
5
5
|
|
6
6
|
attr_accessor :project_name, :specs_to_run, :dispatcher_uri
|
7
|
-
attr_reader :worker_size, :batch_size, :registered_dispatcher, :bonjour_service
|
7
|
+
attr_reader :worker_size, :batch_size, :registered_dispatcher, :bonjour_service, :worker_pids
|
8
8
|
|
9
9
|
def initialize(options = {})
|
10
10
|
@worker_size = options[:worker_size]
|
11
11
|
@batch_size = options[:batch_size]
|
12
12
|
@registered_dispatcher = options[:registered_dispatcher]
|
13
|
+
@worker_pids = []
|
13
14
|
end
|
14
15
|
|
15
16
|
def available_for?(hostname)
|
@@ -24,20 +25,23 @@ module Specjour
|
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
28
|
+
def kill_worker_processes
|
29
|
+
Process.kill('TERM', *worker_pids) rescue nil
|
30
|
+
end
|
31
|
+
|
27
32
|
def project_path
|
28
33
|
File.join("/tmp", project_name)
|
29
34
|
end
|
30
35
|
|
31
36
|
def dispatch
|
32
37
|
bonjour_service.stop
|
33
|
-
pids = []
|
34
38
|
(1..worker_size).each do |index|
|
35
|
-
|
39
|
+
worker_pids << fork do
|
36
40
|
exec("specjour --batch-size #{batch_size} --do-work #{project_path},#{dispatcher_uri},#{index},#{specs_to_run[index - 1].join(',')}")
|
37
41
|
Kernel.exit!
|
38
42
|
end
|
39
43
|
end
|
40
|
-
at_exit {
|
44
|
+
at_exit { kill_worker_processes }
|
41
45
|
Process.waitall
|
42
46
|
bonjour_announce
|
43
47
|
end
|
data/lib/specjour.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 7
|
9
|
+
version: 0.1.7
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Sandro Turriate
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-03-
|
17
|
+
date: 2010-03-23 00:00:00 -04:00
|
18
18
|
default_executable: specjour
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|