simmer 2.0.0.pre.alpha.1 → 4.0.0
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +7 -1
- data/.ruby-version +1 -1
- data/.travis.yml +3 -3
- data/CHANGELOG.md +44 -1
- data/README.md +40 -0
- data/lib/simmer.rb +17 -99
- data/lib/simmer/bootstrap.rb +133 -0
- data/lib/simmer/configuration.rb +16 -2
- data/lib/simmer/configuration/callback_dsl.rb +79 -0
- data/lib/simmer/database/fixture_set.rb +3 -1
- data/lib/simmer/externals/mysql_database.rb +11 -3
- data/lib/simmer/externals/spoon_client.rb +5 -4
- data/lib/simmer/judge/result.rb +1 -1
- data/lib/simmer/re_runner.rb +46 -0
- data/lib/simmer/runner.rb +52 -52
- data/lib/simmer/runner/result.rb +25 -6
- data/lib/simmer/runner/timeout_error.rb +23 -0
- data/lib/simmer/suite.rb +20 -11
- data/lib/simmer/suite/output_router.rb +73 -0
- data/lib/simmer/suite/pdi_output_writer.rb +56 -0
- data/lib/simmer/suite/result.rb +1 -0
- data/lib/simmer/suite/results_writer.rb +44 -0
- data/lib/simmer/util.rb +1 -0
- data/lib/simmer/util/file_system.rb +25 -0
- data/lib/simmer/version.rb +1 -1
- data/simmer.gemspec +4 -2
- metadata +43 -7
- data/lib/simmer/suite/reporter.rb +0 -83
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#
|
4
|
+
# Copyright (c) 2020-present, Blue Marble Payroll, LLC
|
5
|
+
#
|
6
|
+
# This source code is licensed under the MIT license found in the
|
7
|
+
# LICENSE file in the root directory of this source tree.
|
8
|
+
#
|
9
|
+
|
10
|
+
module Simmer
|
11
|
+
class Runner
|
12
|
+
# This error used when a specification times out. It is stored in
|
13
|
+
# <tt>Simmer::Runner::Results#errors</tt> when a specification times out.
|
14
|
+
class TimeoutError < RuntimeError
|
15
|
+
def message
|
16
|
+
cause ? cause.message : DEFAULT_MESSAGE
|
17
|
+
end
|
18
|
+
|
19
|
+
DEFAULT_MESSAGE = 'a timeout occurred'
|
20
|
+
private_constant :DEFAULT_MESSAGE
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/simmer/suite.rb
CHANGED
@@ -7,7 +7,9 @@
|
|
7
7
|
# LICENSE file in the root directory of this source tree.
|
8
8
|
#
|
9
9
|
|
10
|
-
require_relative 'suite/
|
10
|
+
require_relative 'suite/output_router'
|
11
|
+
require_relative 'suite/pdi_output_writer'
|
12
|
+
require_relative 'suite/results_writer'
|
11
13
|
require_relative 'suite/result'
|
12
14
|
|
13
15
|
module Simmer
|
@@ -22,7 +24,7 @@ module Simmer
|
|
22
24
|
results_dir:,
|
23
25
|
runner:
|
24
26
|
)
|
25
|
-
@config = config
|
27
|
+
@config = config
|
26
28
|
@out = out
|
27
29
|
@resolver = resolver
|
28
30
|
@results_dir = results_dir
|
@@ -32,18 +34,17 @@ module Simmer
|
|
32
34
|
end
|
33
35
|
|
34
36
|
def run(specifications)
|
35
|
-
|
37
|
+
config.run_suite_with_callbacks do
|
38
|
+
runner_results = run_all_specs(specifications)
|
39
|
+
runner.complete
|
36
40
|
|
37
|
-
|
38
|
-
|
39
|
-
out.puts('Suite ended successfully')
|
40
|
-
else
|
41
|
-
out.puts('Suite ended but was not successful')
|
42
|
-
end
|
41
|
+
Result.new(runner_results).tap do |result|
|
42
|
+
output_summary(result.pass?)
|
43
43
|
|
44
|
-
|
44
|
+
ResulstWriter.new(result, results_dir).write!
|
45
45
|
|
46
|
-
|
46
|
+
out.puts("Results can be viewed at #{results_dir}")
|
47
|
+
end
|
47
48
|
end
|
48
49
|
end
|
49
50
|
|
@@ -77,5 +78,13 @@ module Simmer
|
|
77
78
|
def print_line
|
78
79
|
out.puts('-' * LINE_LENGTH)
|
79
80
|
end
|
81
|
+
|
82
|
+
def output_summary(passed)
|
83
|
+
if passed
|
84
|
+
out.puts('Suite ended successfully')
|
85
|
+
else
|
86
|
+
out.puts('Suite ended but was not successful')
|
87
|
+
end
|
88
|
+
end
|
80
89
|
end
|
81
90
|
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Simmer
|
4
|
+
class Suite
|
5
|
+
# Routes output either to the console or the <tt>PdiOutputWriter</tt>. It
|
6
|
+
# also provides some methods to help format output.
|
7
|
+
class OutputRouter
|
8
|
+
extend Forwardable
|
9
|
+
|
10
|
+
attr_reader :console, :pdi_out
|
11
|
+
|
12
|
+
def_delegator :console, :puts, :console_puts
|
13
|
+
def_delegators :pdi_out, :close, :finish_spec
|
14
|
+
def_delegator :pdi_out, :write, :capture_spoon_output
|
15
|
+
|
16
|
+
def initialize(console, pdi_out)
|
17
|
+
@console = console || raise(ArgumentError, 'console is required')
|
18
|
+
@pdi_out = pdi_out || raise(ArgumentError, 'pdi_out is required')
|
19
|
+
|
20
|
+
freeze
|
21
|
+
end
|
22
|
+
|
23
|
+
def announce_start(id, specification)
|
24
|
+
console_puts("Name: #{specification.name}")
|
25
|
+
console_puts("Path: #{specification.path}")
|
26
|
+
pdi_out.demarcate_spec(id, specification.name)
|
27
|
+
end
|
28
|
+
|
29
|
+
def result(result)
|
30
|
+
console_puts(pass_message(result))
|
31
|
+
end
|
32
|
+
|
33
|
+
def final_verdict(result)
|
34
|
+
msg = pass_message(result)
|
35
|
+
waiting('Done', 'Final verdict')
|
36
|
+
console_puts(msg)
|
37
|
+
end
|
38
|
+
|
39
|
+
def waiting(stage, msg)
|
40
|
+
# This is not for debugging.
|
41
|
+
# rubocop:disable Lint/Debugger
|
42
|
+
console.print(
|
43
|
+
" > #{pad_right(stage, 6)} - #{pad_right(msg, WAITING_MAX_WIDTH, WAITING_PADDING_CHAR)}"
|
44
|
+
)
|
45
|
+
# rubocop:enable Lint/Debugger
|
46
|
+
end
|
47
|
+
|
48
|
+
def spoon_execution_detail_message(spoon_client_result)
|
49
|
+
code = spoon_client_result.execution_result.status.code
|
50
|
+
detail = "(Exited with code #{code} after #{spoon_client_result.time_in_seconds} seconds)"
|
51
|
+
|
52
|
+
console_puts("#{pass_message(spoon_client_result)} #{detail}")
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
WAITING_MAX_WIDTH = 25
|
58
|
+
WAITING_PADDING_CHAR = '.'
|
59
|
+
|
60
|
+
private_constant :WAITING_MAX_WIDTH, :WAITING_PADDING_CHAR
|
61
|
+
|
62
|
+
def pad_right(msg, len, char = ' ')
|
63
|
+
missing = len - msg.length
|
64
|
+
|
65
|
+
"#{msg}#{char * missing}"
|
66
|
+
end
|
67
|
+
|
68
|
+
def pass_message(obj)
|
69
|
+
obj.pass? ? 'Pass' : 'Fail'
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#
|
4
|
+
# Copyright (c) 2020-present, Blue Marble Payroll, LLC
|
5
|
+
#
|
6
|
+
# This source code is licensed under the MIT license found in the
|
7
|
+
# LICENSE file in the root directory of this source tree.
|
8
|
+
#
|
9
|
+
|
10
|
+
module Simmer
|
11
|
+
class Suite
|
12
|
+
# Captures PDI output from multiple specifications to a single file.
|
13
|
+
class PdiOutputWriter # :nodoc:
|
14
|
+
PDI_OUT_FILE = 'pdi_out.txt'
|
15
|
+
|
16
|
+
attr_reader :results_dir
|
17
|
+
|
18
|
+
def initialize(results_dir)
|
19
|
+
raise ArgumentError, 'results_dir is required' unless results_dir
|
20
|
+
|
21
|
+
results_dir = Util::FileSystem.setup_directory(results_dir)
|
22
|
+
@out = File.new(File.join(results_dir, PDI_OUT_FILE), 'w')
|
23
|
+
|
24
|
+
freeze
|
25
|
+
end
|
26
|
+
|
27
|
+
def demarcate_spec(runner_id, spec_name)
|
28
|
+
out.puts(LINE_OF_HYPHENS)
|
29
|
+
out.puts("Name: #{spec_name}")
|
30
|
+
out.puts("Runner ID: #{runner_id}")
|
31
|
+
out.puts(LINE_OF_HYPHENS)
|
32
|
+
end
|
33
|
+
|
34
|
+
def write(contents)
|
35
|
+
bytes_written = out.write(contents)
|
36
|
+
out.flush
|
37
|
+
bytes_written
|
38
|
+
end
|
39
|
+
|
40
|
+
def finish_spec
|
41
|
+
out.puts
|
42
|
+
end
|
43
|
+
|
44
|
+
def close
|
45
|
+
out.close
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
attr_reader :out
|
51
|
+
|
52
|
+
LINE_OF_HYPHENS = ('-' * 80).freeze
|
53
|
+
private_constant :LINE_OF_HYPHENS
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
data/lib/simmer/suite/result.rb
CHANGED
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#
|
4
|
+
# Copyright (c) 2020-present, Blue Marble Payroll, LLC
|
5
|
+
#
|
6
|
+
# This source code is licensed under the MIT license found in the
|
7
|
+
# LICENSE file in the root directory of this source tree.
|
8
|
+
#
|
9
|
+
|
10
|
+
module Simmer
|
11
|
+
class Suite
|
12
|
+
# Understands how to write a SessionResult instance to disk.
|
13
|
+
class ResulstWriter
|
14
|
+
DATA_FILE = 'data.yaml'
|
15
|
+
|
16
|
+
# Pass in dir here:
|
17
|
+
def initialize(session_result, results_dir)
|
18
|
+
raise ArgumentError, 'session_result is required' unless session_result
|
19
|
+
raise ArgumentError, 'results_directory is required' unless results_dir
|
20
|
+
|
21
|
+
@session_result = session_result
|
22
|
+
@results_directory = Util::FileSystem.setup_directory(results_dir)
|
23
|
+
|
24
|
+
freeze
|
25
|
+
end
|
26
|
+
|
27
|
+
def write!
|
28
|
+
dir = Util::FileSystem.setup_directory(results_directory)
|
29
|
+
|
30
|
+
IO.write(data_path(dir), session_result.to_h.to_yaml)
|
31
|
+
|
32
|
+
self
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
attr_reader :results_directory, :session_result
|
38
|
+
|
39
|
+
def data_path(dir)
|
40
|
+
File.join(dir, DATA_FILE)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/lib/simmer/util.rb
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#
|
4
|
+
# Copyright (c) 2020-present, Blue Marble Payroll, LLC
|
5
|
+
#
|
6
|
+
# This source code is licensed under the MIT license found in the
|
7
|
+
# LICENSE file in the root directory of this source tree.
|
8
|
+
#
|
9
|
+
|
10
|
+
require_relative 'resolver'
|
11
|
+
|
12
|
+
module Simmer
|
13
|
+
module Util
|
14
|
+
# Provides convenience methods for working with the file system.
|
15
|
+
class FileSystem # :nodoc:
|
16
|
+
class << self
|
17
|
+
def setup_directory(dir_path)
|
18
|
+
File.expand_path(dir_path).tap do |expanded_dir|
|
19
|
+
FileUtils.mkdir_p(expanded_dir)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/simmer/version.rb
CHANGED
data/simmer.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
Provides a harness for testing Pentaho Data Integration jobs and transformations.
|
12
12
|
DESCRIPTION
|
13
13
|
|
14
|
-
s.authors = ['Matthew Ruggio']
|
14
|
+
s.authors = ['Matthew Ruggio', 'Ryan Gerry']
|
15
15
|
s.email = ['mruggio@bluemarblepayroll.com']
|
16
16
|
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
17
|
s.bindir = 'exe'
|
@@ -32,14 +32,16 @@ Gem::Specification.new do |s|
|
|
32
32
|
s.add_dependency('aws-sdk-s3', '~>1.6')
|
33
33
|
s.add_dependency('mysql2', '~>0.5')
|
34
34
|
s.add_dependency('objectable', '~>1')
|
35
|
-
s.add_dependency('pdi', '~>2')
|
35
|
+
s.add_dependency('pdi', '~>2.1')
|
36
36
|
s.add_dependency('stringento', '~>2')
|
37
37
|
|
38
38
|
s.add_development_dependency('guard-rspec', '~>4.7')
|
39
39
|
s.add_development_dependency('pry', '~>0')
|
40
|
+
s.add_development_dependency 'pry-byebug'
|
40
41
|
s.add_development_dependency('rake', '~> 13')
|
41
42
|
s.add_development_dependency('rspec')
|
42
43
|
s.add_development_dependency('rubocop', '~>0.79.0')
|
43
44
|
s.add_development_dependency('simplecov', '~>0.17.0')
|
44
45
|
s.add_development_dependency('simplecov-console', '~>0.6.0')
|
46
|
+
s.add_development_dependency('terminal-notifier-guard')
|
45
47
|
end
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simmer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Ruggio
|
8
|
+
- Ryan Gerry
|
8
9
|
autorequire:
|
9
10
|
bindir: exe
|
10
11
|
cert_chain: []
|
11
|
-
date: 2020-
|
12
|
+
date: 2020-06-24 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: acts_as_hashable
|
@@ -72,14 +73,14 @@ dependencies:
|
|
72
73
|
requirements:
|
73
74
|
- - "~>"
|
74
75
|
- !ruby/object:Gem::Version
|
75
|
-
version: '2'
|
76
|
+
version: '2.1'
|
76
77
|
type: :runtime
|
77
78
|
prerelease: false
|
78
79
|
version_requirements: !ruby/object:Gem::Requirement
|
79
80
|
requirements:
|
80
81
|
- - "~>"
|
81
82
|
- !ruby/object:Gem::Version
|
82
|
-
version: '2'
|
83
|
+
version: '2.1'
|
83
84
|
- !ruby/object:Gem::Dependency
|
84
85
|
name: stringento
|
85
86
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,6 +123,20 @@ dependencies:
|
|
122
123
|
- - "~>"
|
123
124
|
- !ruby/object:Gem::Version
|
124
125
|
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: pry-byebug
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
type: :development
|
134
|
+
prerelease: false
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
125
140
|
- !ruby/object:Gem::Dependency
|
126
141
|
name: rake
|
127
142
|
requirement: !ruby/object:Gem::Requirement
|
@@ -192,6 +207,20 @@ dependencies:
|
|
192
207
|
- - "~>"
|
193
208
|
- !ruby/object:Gem::Version
|
194
209
|
version: 0.6.0
|
210
|
+
- !ruby/object:Gem::Dependency
|
211
|
+
name: terminal-notifier-guard
|
212
|
+
requirement: !ruby/object:Gem::Requirement
|
213
|
+
requirements:
|
214
|
+
- - ">="
|
215
|
+
- !ruby/object:Gem::Version
|
216
|
+
version: '0'
|
217
|
+
type: :development
|
218
|
+
prerelease: false
|
219
|
+
version_requirements: !ruby/object:Gem::Requirement
|
220
|
+
requirements:
|
221
|
+
- - ">="
|
222
|
+
- !ruby/object:Gem::Version
|
223
|
+
version: '0'
|
195
224
|
description: " Provides a harness for testing Pentaho Data Integration jobs and
|
196
225
|
transformations.\n"
|
197
226
|
email:
|
@@ -216,7 +245,9 @@ files:
|
|
216
245
|
- bin/console
|
217
246
|
- exe/simmer
|
218
247
|
- lib/simmer.rb
|
248
|
+
- lib/simmer/bootstrap.rb
|
219
249
|
- lib/simmer/configuration.rb
|
250
|
+
- lib/simmer/configuration/callback_dsl.rb
|
220
251
|
- lib/simmer/core_ext/hash.rb
|
221
252
|
- lib/simmer/database.rb
|
222
253
|
- lib/simmer/database/fixture.rb
|
@@ -231,8 +262,10 @@ files:
|
|
231
262
|
- lib/simmer/externals/sql_writers/sql_fixture.rb
|
232
263
|
- lib/simmer/judge.rb
|
233
264
|
- lib/simmer/judge/result.rb
|
265
|
+
- lib/simmer/re_runner.rb
|
234
266
|
- lib/simmer/runner.rb
|
235
267
|
- lib/simmer/runner/result.rb
|
268
|
+
- lib/simmer/runner/timeout_error.rb
|
236
269
|
- lib/simmer/specification.rb
|
237
270
|
- lib/simmer/specification/act.rb
|
238
271
|
- lib/simmer/specification/act/params.rb
|
@@ -245,10 +278,13 @@ files:
|
|
245
278
|
- lib/simmer/specification/stage.rb
|
246
279
|
- lib/simmer/specification/stage/input_file.rb
|
247
280
|
- lib/simmer/suite.rb
|
248
|
-
- lib/simmer/suite/
|
281
|
+
- lib/simmer/suite/output_router.rb
|
282
|
+
- lib/simmer/suite/pdi_output_writer.rb
|
249
283
|
- lib/simmer/suite/result.rb
|
284
|
+
- lib/simmer/suite/results_writer.rb
|
250
285
|
- lib/simmer/util.rb
|
251
286
|
- lib/simmer/util/evaluator.rb
|
287
|
+
- lib/simmer/util/file_system.rb
|
252
288
|
- lib/simmer/util/record.rb
|
253
289
|
- lib/simmer/util/record_set.rb
|
254
290
|
- lib/simmer/util/resolver.rb
|
@@ -275,9 +311,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
275
311
|
version: '2.5'
|
276
312
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
277
313
|
requirements:
|
278
|
-
- - "
|
314
|
+
- - ">="
|
279
315
|
- !ruby/object:Gem::Version
|
280
|
-
version:
|
316
|
+
version: '0'
|
281
317
|
requirements: []
|
282
318
|
rubygems_version: 3.0.3
|
283
319
|
signing_key:
|