flatware 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +83 -39
- data/lib/flatware-cucumber.rb +1 -0
- data/lib/flatware-rspec.rb +1 -0
- data/lib/flatware.rb +2 -10
- data/lib/flatware/broadcaster.rb +15 -0
- data/lib/flatware/cli.rb +10 -34
- data/lib/flatware/cucumber.rb +37 -12
- data/lib/flatware/cucumber/checkpoint.rb +28 -0
- data/lib/flatware/cucumber/cli.rb +22 -0
- data/lib/flatware/cucumber/formatter.rb +36 -84
- data/lib/flatware/{formatters/cucumber → cucumber/formatters}/console.rb +5 -3
- data/lib/flatware/{formatters/cucumber → cucumber/formatters}/console/summary.rb +3 -3
- data/lib/flatware/cucumber/result.rb +27 -0
- data/lib/flatware/cucumber/scenario_result.rb +38 -0
- data/lib/flatware/cucumber/step_result.rb +30 -0
- data/lib/flatware/poller.rb +2 -2
- data/lib/flatware/rspec.rb +28 -0
- data/lib/flatware/rspec/checkpoint.rb +29 -0
- data/lib/flatware/rspec/cli.rb +16 -0
- data/lib/flatware/rspec/example_notification.rb +21 -0
- data/lib/flatware/rspec/examples_notification.rb +24 -0
- data/lib/flatware/rspec/formatter.rb +50 -0
- data/lib/flatware/rspec/formatters/console.rb +33 -0
- data/lib/flatware/rspec/summary.rb +40 -0
- data/lib/flatware/serialized_exception.rb +12 -8
- data/lib/flatware/sink.rb +43 -33
- data/lib/flatware/socket.rb +89 -25
- data/lib/flatware/version.rb +1 -1
- data/lib/flatware/worker.rb +16 -9
- metadata +27 -55
- data/lib/flatware/checkpoint.rb +0 -28
- data/lib/flatware/checkpoint_handler.rb +0 -45
- data/lib/flatware/dispatcher.rb +0 -31
- data/lib/flatware/fireable.rb +0 -34
- data/lib/flatware/formatters.rb +0 -27
- data/lib/flatware/formatters/cucumber/http.rb +0 -83
- data/lib/flatware/result.rb +0 -25
- data/lib/flatware/scenario_decorator.rb +0 -22
- data/lib/flatware/scenario_result.rb +0 -36
- data/lib/flatware/step_result.rb +0 -27
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flatware
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Dunn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi-rzmq
|
@@ -38,40 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0.13'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: cucumber
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 1.3.0
|
48
|
-
- - "<"
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
version: '2.0'
|
51
|
-
type: :runtime
|
52
|
-
prerelease: false
|
53
|
-
version_requirements: !ruby/object:Gem::Requirement
|
54
|
-
requirements:
|
55
|
-
- - ">="
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version: 1.3.0
|
58
|
-
- - "<"
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: '2.0'
|
61
41
|
- !ruby/object:Gem::Dependency
|
62
42
|
name: aruba
|
63
43
|
requirement: !ruby/object:Gem::Requirement
|
64
44
|
requirements:
|
65
45
|
- - "~>"
|
66
46
|
- !ruby/object:Gem::Version
|
67
|
-
version: 0.
|
47
|
+
version: '0.14'
|
68
48
|
type: :development
|
69
49
|
prerelease: false
|
70
50
|
version_requirements: !ruby/object:Gem::Requirement
|
71
51
|
requirements:
|
72
52
|
- - "~>"
|
73
53
|
- !ruby/object:Gem::Version
|
74
|
-
version: 0.
|
54
|
+
version: '0.14'
|
75
55
|
- !ruby/object:Gem::Dependency
|
76
56
|
name: rake
|
77
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,21 +66,7 @@ dependencies:
|
|
86
66
|
- - "~>"
|
87
67
|
- !ruby/object:Gem::Version
|
88
68
|
version: 10.1.0
|
89
|
-
|
90
|
-
name: rspec
|
91
|
-
requirement: !ruby/object:Gem::Requirement
|
92
|
-
requirements:
|
93
|
-
- - "~>"
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
version: 2.14.0
|
96
|
-
type: :development
|
97
|
-
prerelease: false
|
98
|
-
version_requirements: !ruby/object:Gem::Requirement
|
99
|
-
requirements:
|
100
|
-
- - "~>"
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: 2.14.0
|
103
|
-
description: A distributed cucumber runner
|
69
|
+
description: A distributed cucumber and rspec runner
|
104
70
|
email: brian@hashrocket.com
|
105
71
|
executables:
|
106
72
|
- flatware
|
@@ -112,30 +78,36 @@ files:
|
|
112
78
|
- LICENSE.txt
|
113
79
|
- README.md
|
114
80
|
- bin/flatware
|
81
|
+
- lib/flatware-cucumber.rb
|
82
|
+
- lib/flatware-rspec.rb
|
115
83
|
- lib/flatware.rb
|
116
|
-
- lib/flatware/
|
117
|
-
- lib/flatware/checkpoint_handler.rb
|
84
|
+
- lib/flatware/broadcaster.rb
|
118
85
|
- lib/flatware/cli.rb
|
119
86
|
- lib/flatware/cucumber.rb
|
87
|
+
- lib/flatware/cucumber/checkpoint.rb
|
88
|
+
- lib/flatware/cucumber/cli.rb
|
120
89
|
- lib/flatware/cucumber/formatter.rb
|
90
|
+
- lib/flatware/cucumber/formatters/console.rb
|
91
|
+
- lib/flatware/cucumber/formatters/console/summary.rb
|
92
|
+
- lib/flatware/cucumber/result.rb
|
121
93
|
- lib/flatware/cucumber/runtime.rb
|
122
|
-
- lib/flatware/
|
123
|
-
- lib/flatware/
|
124
|
-
- lib/flatware/formatters.rb
|
125
|
-
- lib/flatware/formatters/cucumber/console.rb
|
126
|
-
- lib/flatware/formatters/cucumber/console/summary.rb
|
127
|
-
- lib/flatware/formatters/cucumber/http.rb
|
94
|
+
- lib/flatware/cucumber/scenario_result.rb
|
95
|
+
- lib/flatware/cucumber/step_result.rb
|
128
96
|
- lib/flatware/pids.rb
|
129
97
|
- lib/flatware/poller.rb
|
130
98
|
- lib/flatware/processor_info.rb
|
131
|
-
- lib/flatware/
|
132
|
-
- lib/flatware/
|
133
|
-
- lib/flatware/
|
99
|
+
- lib/flatware/rspec.rb
|
100
|
+
- lib/flatware/rspec/checkpoint.rb
|
101
|
+
- lib/flatware/rspec/cli.rb
|
102
|
+
- lib/flatware/rspec/example_notification.rb
|
103
|
+
- lib/flatware/rspec/examples_notification.rb
|
104
|
+
- lib/flatware/rspec/formatter.rb
|
105
|
+
- lib/flatware/rspec/formatters/console.rb
|
106
|
+
- lib/flatware/rspec/summary.rb
|
134
107
|
- lib/flatware/serialized_exception.rb
|
135
108
|
- lib/flatware/sink.rb
|
136
109
|
- lib/flatware/sink/client.rb
|
137
110
|
- lib/flatware/socket.rb
|
138
|
-
- lib/flatware/step_result.rb
|
139
111
|
- lib/flatware/version.rb
|
140
112
|
- lib/flatware/worker.rb
|
141
113
|
homepage: http://github.com/briandunn/flatware
|
@@ -148,9 +120,9 @@ require_paths:
|
|
148
120
|
- lib
|
149
121
|
required_ruby_version: !ruby/object:Gem::Requirement
|
150
122
|
requirements:
|
151
|
-
- - "
|
123
|
+
- - "~>"
|
152
124
|
- !ruby/object:Gem::Version
|
153
|
-
version: '
|
125
|
+
version: '2.1'
|
154
126
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
127
|
requirements:
|
156
128
|
- - ">="
|
@@ -158,8 +130,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
158
130
|
version: '0'
|
159
131
|
requirements: []
|
160
132
|
rubyforge_project:
|
161
|
-
rubygems_version: 2.
|
133
|
+
rubygems_version: 2.6.8
|
162
134
|
signing_key:
|
163
135
|
specification_version: 4
|
164
|
-
summary: A distributed cucumber runner
|
136
|
+
summary: A distributed cucumber and rspec runner
|
165
137
|
test_files: []
|
data/lib/flatware/checkpoint.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'flatware/scenario_result'
|
2
|
-
module Flatware
|
3
|
-
class Checkpoint
|
4
|
-
attr_reader :steps, :scenarios
|
5
|
-
def initialize(steps, scenarios)
|
6
|
-
@steps, @scenarios = serialize_steps(steps), serialize_scenarios(scenarios)
|
7
|
-
end
|
8
|
-
|
9
|
-
def failures?
|
10
|
-
scenarios.any? &:failed?
|
11
|
-
end
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
def serialize_steps(steps)
|
16
|
-
steps.map do |step|
|
17
|
-
StepResult.new step.status, step.exception
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def serialize_scenarios(scenarios)
|
22
|
-
scenarios.map do |scenario|
|
23
|
-
ScenarioResult.new scenario.status, scenario.file_colon_line, scenario.name, scenario.exception
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
module Flatware
|
2
|
-
class CheckpointHandler
|
3
|
-
attr_reader :formatter, :checkpoints
|
4
|
-
|
5
|
-
def initialize(formatter, fails_fast)
|
6
|
-
@fail_fast = fails_fast
|
7
|
-
@formatter = formatter
|
8
|
-
@checkpoints = []
|
9
|
-
end
|
10
|
-
|
11
|
-
def handle!(checkpoint)
|
12
|
-
checkpoints << checkpoint
|
13
|
-
if checkpoint.failures? && fail_fast?
|
14
|
-
Fireable::kill # Killing everybody
|
15
|
-
@done = true
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def done?
|
20
|
-
@done
|
21
|
-
end
|
22
|
-
|
23
|
-
def fail_fast?
|
24
|
-
@fail_fast
|
25
|
-
end
|
26
|
-
|
27
|
-
def summarize
|
28
|
-
formatter.summarize(steps, scenarios)
|
29
|
-
end
|
30
|
-
|
31
|
-
def had_failures?
|
32
|
-
checkpoints.any? &:failures?
|
33
|
-
end
|
34
|
-
|
35
|
-
private
|
36
|
-
|
37
|
-
def steps
|
38
|
-
checkpoints.map(&:steps).flatten
|
39
|
-
end
|
40
|
-
|
41
|
-
def scenarios
|
42
|
-
checkpoints.map(&:scenarios).flatten
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
data/lib/flatware/dispatcher.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
module Flatware
|
2
|
-
class Dispatcher
|
3
|
-
def self.spawn(jobs, endpoint)
|
4
|
-
fork do
|
5
|
-
$0 = 'flatware dispatcher'
|
6
|
-
trap('INT') { exit 1 }
|
7
|
-
new(jobs, endpoint).dispatch!
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
def initialize(jobs, endpoint)
|
12
|
-
@jobs = jobs
|
13
|
-
@fireable = Fireable.new
|
14
|
-
@dispatch = Flatware.socket ZMQ::REP, bind: endpoint
|
15
|
-
end
|
16
|
-
|
17
|
-
def dispatch!
|
18
|
-
fireable.until_fired dispatch do |request|
|
19
|
-
if job = jobs.shift
|
20
|
-
dispatch.send job
|
21
|
-
else
|
22
|
-
dispatch.send 'seppuku'
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
attr_reader :jobs, :fireable, :dispatch
|
30
|
-
end
|
31
|
-
end
|
data/lib/flatware/fireable.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'flatware/poller'
|
2
|
-
|
3
|
-
module Flatware
|
4
|
-
class Fireable
|
5
|
-
PORT = 'ipc://die'
|
6
|
-
|
7
|
-
def self.bind
|
8
|
-
@kill = Flatware.socket(ZMQ::PUB, bind: PORT)
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.kill
|
12
|
-
@kill.send 'seppuku'
|
13
|
-
end
|
14
|
-
|
15
|
-
def initialize
|
16
|
-
@die = Flatware.socket(ZMQ::SUB, connect: PORT).tap do |die|
|
17
|
-
die.setsockopt ZMQ::SUBSCRIBE, ''
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
attr_reader :die
|
22
|
-
|
23
|
-
def until_fired(socket, &block)
|
24
|
-
poller = Poller.new socket, die
|
25
|
-
poller.each do |s|
|
26
|
-
message = s.recv
|
27
|
-
break if message == 'seppuku'
|
28
|
-
block.call message
|
29
|
-
end
|
30
|
-
ensure
|
31
|
-
Flatware.close
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
data/lib/flatware/formatters.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
module Flatware
|
2
|
-
module Formatters
|
3
|
-
def self.load_by_name(runner, names)
|
4
|
-
formatters = names.map do |name|
|
5
|
-
require "flatware/formatters/#{runner}/#{name}"
|
6
|
-
namespace = const_get({cucumber: 'Cucumber'}.fetch(runner))
|
7
|
-
klass = namespace.const_get name.capitalize
|
8
|
-
klass.new $stdout, $stderr
|
9
|
-
end
|
10
|
-
Broadcaster.new formatters
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
class Broadcaster
|
15
|
-
attr_reader :formatters
|
16
|
-
|
17
|
-
def initialize(formatters)
|
18
|
-
@formatters = formatters
|
19
|
-
end
|
20
|
-
|
21
|
-
def method_missing(name, *args)
|
22
|
-
formatters.each do |formatter|
|
23
|
-
formatter.send name, *args if formatter.respond_to? name
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,83 +0,0 @@
|
|
1
|
-
require 'net/http'
|
2
|
-
require 'pathname'
|
3
|
-
|
4
|
-
module Flatware
|
5
|
-
module Formatters
|
6
|
-
class Http
|
7
|
-
attr_reader :out, :client, :server_pid
|
8
|
-
def initialize(out, err)
|
9
|
-
@out = out
|
10
|
-
@client = Client.new
|
11
|
-
end
|
12
|
-
|
13
|
-
def jobs(jobs)
|
14
|
-
client.send_message [:jobs, jobs.map {|job| {id: job.id}}]
|
15
|
-
end
|
16
|
-
|
17
|
-
def started(job)
|
18
|
-
client.send_message [:started, job: job.id, worker: job.worker]
|
19
|
-
end
|
20
|
-
|
21
|
-
def finished(job)
|
22
|
-
client.send_message [:finished, job: job.id, worker: job.worker]
|
23
|
-
end
|
24
|
-
|
25
|
-
def progress(result)
|
26
|
-
client.send_message [:progress, status: result.progress, worker: result.worker]
|
27
|
-
end
|
28
|
-
|
29
|
-
def summarize(steps, scenarios)
|
30
|
-
client.send_message [
|
31
|
-
:summarize, {
|
32
|
-
steps: steps.map(&method(:step_as_json)),
|
33
|
-
scenarios: scenarios.map(&method(:scenario_as_json))
|
34
|
-
}
|
35
|
-
]
|
36
|
-
end
|
37
|
-
|
38
|
-
private
|
39
|
-
|
40
|
-
def step_as_json(step)
|
41
|
-
{ status: step.status }.tap do |h|
|
42
|
-
h.merge(exception: {
|
43
|
-
class: step.exception.class,
|
44
|
-
message: step.exception.message,
|
45
|
-
backtrace: step.exception.backtrace
|
46
|
-
}) if step.exception
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def scenario_as_json(scenario)
|
51
|
-
{
|
52
|
-
status: scenario.status,
|
53
|
-
file_colon_line: scenario.file_colon_line,
|
54
|
-
name: scenario.name
|
55
|
-
}
|
56
|
-
end
|
57
|
-
|
58
|
-
class Client
|
59
|
-
attr_reader :uri
|
60
|
-
include Net
|
61
|
-
|
62
|
-
def initialize
|
63
|
-
@uri = URI ENV['FLATWARE_URL']
|
64
|
-
end
|
65
|
-
|
66
|
-
def send_message(message)
|
67
|
-
send_request uri.path, JSON.dump(message)
|
68
|
-
end
|
69
|
-
|
70
|
-
private
|
71
|
-
|
72
|
-
def send_request(path, body=nil)
|
73
|
-
req = HTTP::Post.new path
|
74
|
-
req.body = body
|
75
|
-
res = HTTP.start uri.hostname, uri.port do |http|
|
76
|
-
http.request req
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
data/lib/flatware/result.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
module Flatware
|
2
|
-
class Result
|
3
|
-
attr_reader :progress, :worker
|
4
|
-
|
5
|
-
def initialize(progress)
|
6
|
-
@progress = progress
|
7
|
-
@worker = ENV['TEST_ENV_NUMBER'].to_i
|
8
|
-
end
|
9
|
-
|
10
|
-
class << self
|
11
|
-
def step(*args)
|
12
|
-
step = StepResult.new *args
|
13
|
-
new step.progress, [step]
|
14
|
-
end
|
15
|
-
|
16
|
-
def status(status)
|
17
|
-
new status
|
18
|
-
end
|
19
|
-
|
20
|
-
def background(status, exception)
|
21
|
-
new '', [StepResult.new(status, exception)]
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'forwardable'
|
2
|
-
module Flatware
|
3
|
-
class ScenarioDecorator
|
4
|
-
extend Forwardable
|
5
|
-
def_delegators :scenario, :name, :file_colon_line
|
6
|
-
|
7
|
-
attr_reader :status, :exception
|
8
|
-
|
9
|
-
def initialize(scenario)
|
10
|
-
@scenario, @status, @exception = scenario, scenario.status, scenario.exception
|
11
|
-
@scenario, @exception = scenario.scenario_outline, scenario.exception if example_row?
|
12
|
-
end
|
13
|
-
|
14
|
-
private
|
15
|
-
|
16
|
-
attr_reader :scenario
|
17
|
-
|
18
|
-
def example_row?
|
19
|
-
scenario.respond_to? :scenario_outline
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|