cukeforker 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +2 -2
- data/LICENSE +1 -1
- data/README.mdown +3 -2
- data/lib/cukeforker/runner.rb +5 -2
- data/lib/cukeforker/version.rb +1 -1
- data/lib/cukeforker/worker.rb +4 -0
- data/lib/cukeforker/worker_queue.rb +8 -1
- data/spec/cukeforker/runner_spec.rb +4 -2
- data/spec/cukeforker/worker_queue_spec.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c97c06d29ce5a9948bf8cd30b8a7a8685aee2596
|
4
|
+
data.tar.gz: 8b9f43ba7f53e6501a896fd924d39812e1392440
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 192e850138726137effab9b5cc07e8149dd0b1730b9eb19a27aa9ed9ee3fc04a253938c2e1e9ffe776d3ce153a1892b3805dd96d932303ad85731c98ae84d2e2
|
7
|
+
data.tar.gz: 26639c5e02f9dc75e28748880897d928be38a9501351dbfaa7fd2763cfe7d030f95983c01177df49e35f08b04a97d73a1f659b73f327765b3485014b60fa2cad
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/LICENSE
CHANGED
data/README.mdown
CHANGED
@@ -7,6 +7,7 @@ Forking cukes and VNC displays.
|
|
7
7
|
|
8
8
|
Usage
|
9
9
|
=============
|
10
|
+
|
10
11
|
```ruby
|
11
12
|
# parallelize per feature
|
12
13
|
CukeForker::Runner.run Dir['features/**/*.feature'],
|
@@ -15,7 +16,7 @@ Usage
|
|
15
16
|
:format => :html # passed to `cucumber --format`,
|
16
17
|
:extra_args => %w[--extra arguments] # passed to cucumber,
|
17
18
|
:vnc => true # manage a pool of VNC displays, assign one per worker.
|
18
|
-
|
19
|
+
|
19
20
|
# parallelize per scenario, with one JUnit XML file per scenario.
|
20
21
|
CukeForker::Runner.run CukeForker::Scenarios.tagged(%W[@edition ~@wip])
|
21
22
|
:extra_args => %W[-f CukeForker::Formatters::JunitScenarioFormatter --out results/junit]
|
@@ -35,5 +36,5 @@ Note on Patches/Pull Requests
|
|
35
36
|
Copyright
|
36
37
|
=========
|
37
38
|
|
38
|
-
Copyright (c) 2011-
|
39
|
+
Copyright (c) 2011-2014 Jari Bakken. See LICENSE for details.
|
39
40
|
|
data/lib/cukeforker/runner.rb
CHANGED
@@ -18,6 +18,7 @@ module CukeForker
|
|
18
18
|
# :log => true/false wether or not to log to stdout (default: true)
|
19
19
|
# :format => Symbol format passed to `cucumber --format` (default: html)
|
20
20
|
# :extra_args => Array extra arguments passed to cucumber
|
21
|
+
# :delay => Numeric seconds to sleep between each worker is started (default: 0)
|
21
22
|
#
|
22
23
|
|
23
24
|
class Runner
|
@@ -30,7 +31,8 @@ module CukeForker
|
|
30
31
|
:notify => nil,
|
31
32
|
:out => Dir.pwd,
|
32
33
|
:log => true,
|
33
|
-
:format => :html
|
34
|
+
:format => :html,
|
35
|
+
:delay => 0
|
34
36
|
}
|
35
37
|
|
36
38
|
def self.run(features, opts = {})
|
@@ -45,6 +47,7 @@ module CukeForker
|
|
45
47
|
out = File.join opts[:out]
|
46
48
|
listeners = Array(opts[:notify])
|
47
49
|
extra_args = Array(opts[:extra_args])
|
50
|
+
delay = opts[:delay]
|
48
51
|
|
49
52
|
if opts[:log]
|
50
53
|
listeners << LoggingListener.new
|
@@ -70,7 +73,7 @@ module CukeForker
|
|
70
73
|
end
|
71
74
|
end
|
72
75
|
|
73
|
-
queue = WorkerQueue.new max
|
76
|
+
queue = WorkerQueue.new max, delay
|
74
77
|
features.each do |feature|
|
75
78
|
queue.add Worker.new(feature, format, out, extra_args)
|
76
79
|
end
|
data/lib/cukeforker/version.rb
CHANGED
data/lib/cukeforker/worker.rb
CHANGED
@@ -2,13 +2,18 @@ module CukeForker
|
|
2
2
|
class WorkerQueue
|
3
3
|
include Observable
|
4
4
|
|
5
|
-
def initialize(max)
|
5
|
+
def initialize(max, delay)
|
6
6
|
@max = max
|
7
|
+
@delay = delay
|
7
8
|
|
8
9
|
if @max < 0
|
9
10
|
raise ArgumentError, "max workers cannot be negative, got #{@max.inspect}"
|
10
11
|
end
|
11
12
|
|
13
|
+
unless @delay.kind_of?(Numeric)
|
14
|
+
raise ArgumentError, "delay must be Numeric, got #{@delay.inspect}:#{@delay.class}"
|
15
|
+
end
|
16
|
+
|
12
17
|
@pending = []
|
13
18
|
@running = []
|
14
19
|
@finished = []
|
@@ -108,6 +113,8 @@ module CukeForker
|
|
108
113
|
|
109
114
|
worker.start
|
110
115
|
@running << worker
|
116
|
+
|
117
|
+
sleep @delay
|
111
118
|
end
|
112
119
|
|
113
120
|
def finish(worker)
|
@@ -13,13 +13,14 @@ module CukeForker
|
|
13
13
|
listeners = [double(AbstractListener, :update => nil)]
|
14
14
|
log = false
|
15
15
|
features = %w[a b]
|
16
|
+
delay = 1
|
16
17
|
|
17
18
|
mock_queue = double(WorkerQueue)
|
18
19
|
mock_workers = Array.new(2) { |n| double("Worker-#{n}") }
|
19
20
|
|
20
21
|
Process.stub(:pid => 1234)
|
21
22
|
|
22
|
-
WorkerQueue.should_receive(:new).with(max).and_return mock_queue
|
23
|
+
WorkerQueue.should_receive(:new).with(max, 1).and_return mock_queue
|
23
24
|
Worker.should_receive(:new).with("a", :json, "/tmp", []).and_return mock_workers[0]
|
24
25
|
Worker.should_receive(:new).with("b", :json, "/tmp", []).and_return mock_workers[1]
|
25
26
|
|
@@ -32,7 +33,8 @@ module CukeForker
|
|
32
33
|
:notify => listeners,
|
33
34
|
:format => format,
|
34
35
|
:log => false,
|
35
|
-
:out => out
|
36
|
+
:out => out,
|
37
|
+
:delay => 1
|
36
38
|
).should be_kind_of(Runner)
|
37
39
|
end
|
38
40
|
|
@@ -3,7 +3,7 @@ require File.expand_path("../../spec_helper", __FILE__)
|
|
3
3
|
module CukeForker
|
4
4
|
describe WorkerQueue do
|
5
5
|
let(:workers) { Array.new(5) { |n| double("Worker-#{n}") } }
|
6
|
-
let(:queue) { WorkerQueue.new(3) }
|
6
|
+
let(:queue) { WorkerQueue.new(3, 0) }
|
7
7
|
|
8
8
|
it "adds an item to the queue" do
|
9
9
|
queue.should_not be_backed_up
|
@@ -29,7 +29,7 @@ module CukeForker
|
|
29
29
|
end
|
30
30
|
|
31
31
|
it "is unlimited if max workers = 0" do
|
32
|
-
unlimited_queue = WorkerQueue.new(0)
|
32
|
+
unlimited_queue = WorkerQueue.new(0, 0)
|
33
33
|
|
34
34
|
workers.each { |w| queue.add double.as_null_object }
|
35
35
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cukeforker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jari Bakken
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|
@@ -138,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
138
|
version: '0'
|
139
139
|
requirements: []
|
140
140
|
rubyforge_project: cukeforker
|
141
|
-
rubygems_version: 2.
|
141
|
+
rubygems_version: 2.1.10
|
142
142
|
signing_key:
|
143
143
|
specification_version: 4
|
144
144
|
summary: Library to maintain a forking queue of Cucumber processes
|