simmer 2.0.0 → 2.1.0.pre.alpha

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0142cad4a1bfe9a53ed19c0b6c1738c94cd51dffd468edf0b2d64213bd4b465
4
- data.tar.gz: f02d545ead4a4333dd70880e08c77290f72f25e0b8a6b13b4ed1a3b88f5b2394
3
+ metadata.gz: f8469413b339324e3aaf45eea56f7245bed4624bd9979e238d1c8538eb1137df
4
+ data.tar.gz: cb99f6ececbf91facf3383487455c2beda0739d71c3869755f38ac2f9cbc5fd4
5
5
  SHA512:
6
- metadata.gz: 27c03c2af5cfb9049d8e6f11792ae025df4063e6424329519199118a915a96194cfc78910b87d1d9e5cb6bd5a520404f66d1702124e54b9427eed70b7b144e55
7
- data.tar.gz: 82101f95eaa70f35818b255c0794e3884fb3d1b8bf768b6f5b222f72422b4f2184b4959afeffa44f195467de46ae86379288abfe05a100d0365602c8e2abb514
6
+ metadata.gz: b77ab5434f1f1ba2ec7ad7871f988cc5b637fe7488599f445aa5c41a685053542656aeaab68188c700aa576b7dd2539bf53c9842574dee6592b5762949767988
7
+ data.tar.gz: bb69b280fa06cb96c3e7582596191fff239250cae05fb76d36c6156ee4f65b7995a5eb4f7632f70e4d115626f60b48c9222ed82dc21de2569c92564ad9cb24bd
data/.rubocop.yml CHANGED
@@ -13,7 +13,7 @@ Metrics/BlockLength:
13
13
  - define
14
14
 
15
15
  Metrics/MethodLength:
16
- Max: 25
16
+ Max: 30
17
17
 
18
18
  AllCops:
19
19
  TargetRubyVersion: 2.5
@@ -23,3 +23,9 @@ Metrics/AbcSize:
23
23
 
24
24
  Metrics/ClassLength:
25
25
  Max: 125
26
+
27
+ Style/TrailingCommaInHashLiteral:
28
+ Enabled: false
29
+
30
+ Style/TrailingCommaInArrayLiteral:
31
+ Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # 2.1.0 (May 12th, 2020)
2
+
3
+ Additions:
4
+
5
+ * Do not make missing fixtures short-circuit the rest of the test suite.
6
+ * Do not make PDI timeouts short-circuit the rest of the test suite.
7
+ * Report PDI's exit code and execution time to the console.
8
+
1
9
  # 2.0.0 (May 11th, 2020)
2
10
 
3
11
  Breaking Changes:
@@ -13,6 +13,8 @@ module Simmer
13
13
  module Database
14
14
  # Hydrate a collection of Fixture instances from configuration.
15
15
  class FixtureSet
16
+ class FixtureMissingError < StandardError; end
17
+
16
18
  def initialize(config = {})
17
19
  @fixtures_by_name = config_to_fixures_by_name(config)
18
20
 
@@ -22,7 +24,7 @@ module Simmer
22
24
  def get!(name)
23
25
  key = name.to_s
24
26
 
25
- raise ArgumentError, "fixture not found: #{name}" unless fixtures_by_name.key?(key)
27
+ raise FixtureMissingError, "fixture missing: #{name}" unless fixtures_by_name.key?(key)
26
28
 
27
29
  fixtures_by_name[key]
28
30
  end
@@ -13,7 +13,7 @@ module Simmer
13
13
  class Result
14
14
  attr_reader :bad_assertions
15
15
 
16
- def initialize(bad_assertions)
16
+ def initialize(bad_assertions = [])
17
17
  @bad_assertions = bad_assertions
18
18
 
19
19
  freeze
@@ -13,23 +13,36 @@ module Simmer
13
13
  class Result
14
14
  extend Forwardable
15
15
 
16
- attr_reader :id, :judge_result, :specification, :spoon_client_result
17
-
18
- def_delegators :spoon_client_result, :time_in_seconds
16
+ attr_reader :errors, :id, :judge_result, :specification, :spoon_client_result
19
17
 
20
18
  def_delegators :specification, :name
21
19
 
22
- def initialize(id, judge_result, specification, spoon_client_result)
20
+ def initialize(
21
+ id:,
22
+ specification:,
23
+ judge_result: nil,
24
+ spoon_client_result: nil,
25
+ errors: []
26
+ )
23
27
  @id = id.to_s
24
28
  @judge_result = judge_result
25
29
  @specification = specification
26
30
  @spoon_client_result = spoon_client_result
31
+ @errors = Array(errors)
27
32
 
28
33
  freeze
29
34
  end
30
35
 
36
+ def time_in_seconds
37
+ spoon_client_result&.time_in_seconds || 0
38
+ end
39
+
31
40
  def pass?
32
- judge_result&.pass? && spoon_client_result&.pass?
41
+ [
42
+ judge_result&.pass?,
43
+ spoon_client_result&.pass?,
44
+ errors.empty?,
45
+ ].all?
33
46
  end
34
47
 
35
48
  def fail?
@@ -44,9 +57,18 @@ module Simmer
44
57
  'time_in_seconds' => time_in_seconds,
45
58
  'pass' => pass?,
46
59
  'spoon_client_result' => spoon_client_result.to_h,
47
- 'judge_result' => judge_result.to_h
60
+ 'judge_result' => judge_result.to_h,
61
+ 'errors' => errors,
48
62
  }
49
63
  end
64
+
65
+ def execution_output
66
+ execution_result&.out
67
+ end
68
+
69
+ def execution_result
70
+ spoon_client_result&.execution_result
71
+ end
50
72
  end
51
73
  end
52
74
  end
data/lib/simmer/runner.rb CHANGED
@@ -30,18 +30,26 @@ module Simmer
30
30
  print("Name: #{specification.name}")
31
31
  print("Path: #{specification.path}")
32
32
 
33
- clean_db
34
- seed_db(specification)
35
- clean_file_system
36
- seed_file_system(specification)
33
+ clean_and_seed(specification)
37
34
 
38
35
  spoon_client_result = execute_spoon(specification, config)
39
36
  judge_result = assert(specification, spoon_client_result)
40
37
 
41
- Result.new(id, judge_result, specification, spoon_client_result).tap do |result|
42
- msg = pass_message(result)
43
- print_waiting('Done', 'Final verdict')
44
- print(msg)
38
+ Result.new(
39
+ id: id,
40
+ judge_result: judge_result,
41
+ specification: specification,
42
+ spoon_client_result: spoon_client_result
43
+ ).tap do |result|
44
+ print_result(result)
45
+ end
46
+ rescue Database::FixtureSet::FixtureMissingError, Timeout::Error => e
47
+ Result.new(
48
+ id: id,
49
+ specification: specification,
50
+ errors: e.message
51
+ ).tap do |result|
52
+ print_result(result)
45
53
  end
46
54
  end
47
55
 
@@ -49,6 +57,19 @@ module Simmer
49
57
 
50
58
  attr_reader :database, :file_system, :fixture_set, :judge, :out
51
59
 
60
+ def print_result(result)
61
+ msg = pass_message(result)
62
+ print_waiting('Done', 'Final verdict')
63
+ print(msg)
64
+ end
65
+
66
+ def clean_and_seed(specification)
67
+ clean_db
68
+ seed_db(specification)
69
+ clean_file_system
70
+ seed_file_system(specification)
71
+ end
72
+
52
73
  def clean_db
53
74
  print_waiting('Stage', 'Cleaning database')
54
75
  count = database.clean!
@@ -66,6 +87,9 @@ module Simmer
66
87
  print("#{count} record(s) inserted")
67
88
 
68
89
  count
90
+ rescue Database::FixtureSet::FixtureMissingError => e
91
+ print('Missing Fixture(s)')
92
+ raise e
69
93
  end
70
94
 
71
95
  def clean_file_system
@@ -86,11 +110,22 @@ module Simmer
86
110
 
87
111
  def execute_spoon(specification, config)
88
112
  print_waiting('Act', 'Executing Spoon')
113
+
89
114
  spoon_client_result = spoon_client.run(specification, config)
90
- msg = pass_message(spoon_client_result)
115
+ time_in_seconds = spoon_client_result.time_in_seconds
116
+ code = spoon_client_result.execution_result.status.code
117
+
118
+ msg = [
119
+ pass_message(spoon_client_result),
120
+ "(Exited with code #{code} after #{time_in_seconds} seconds)"
121
+ ].join(' ')
122
+
91
123
  print(msg)
92
124
 
93
125
  spoon_client_result
126
+ rescue Timeout::Error => e
127
+ print('Timed out')
128
+ raise e
94
129
  end
95
130
 
96
131
  def assert(specification, spoon_client_result)
@@ -58,7 +58,7 @@ module Simmer
58
58
  runner_results.each do |runner_result|
59
59
  name = runner_result.name
60
60
  runner_id = runner_result.id
61
- out_contents = runner_result.spoon_client_result.execution_result.out
61
+ out_contents = runner_result.execution_output
62
62
 
63
63
  write_block(pdi_out_file, name, runner_id, out_contents)
64
64
  end
@@ -22,6 +22,7 @@ module Simmer
22
22
  def pass?
23
23
  !fail?
24
24
  end
25
+ alias passing? pass?
25
26
 
26
27
  def fail?
27
28
  runner_results.any?(&:fail?)
@@ -8,5 +8,5 @@
8
8
  #
9
9
 
10
10
  module Simmer
11
- VERSION = '2.0.0'
11
+ VERSION = '2.1.0-alpha'
12
12
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simmer
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0.pre.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Ruggio
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-11 00:00:00.000000000 Z
11
+ date: 2020-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: acts_as_hashable
@@ -275,9 +275,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
275
275
  version: '2.5'
276
276
  required_rubygems_version: !ruby/object:Gem::Requirement
277
277
  requirements:
278
- - - ">="
278
+ - - ">"
279
279
  - !ruby/object:Gem::Version
280
- version: '0'
280
+ version: 1.3.1
281
281
  requirements: []
282
282
  rubygems_version: 3.0.3
283
283
  signing_key: