simmer 1.0.0.pre.alpha.3 → 1.0.0.pre.alpha.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +5 -0
  4. data/lib/simmer.rb +103 -9
  5. data/lib/simmer/configuration.rb +7 -17
  6. data/lib/simmer/database.rb +10 -0
  7. data/lib/simmer/{util → database}/fixture.rb +7 -3
  8. data/lib/simmer/{util → database}/fixture_set.rb +10 -4
  9. data/lib/simmer/externals/aws_file_system.rb +30 -23
  10. data/lib/simmer/externals/mysql_database.rb +17 -10
  11. data/lib/simmer/externals/spoon_client.rb +5 -19
  12. data/lib/simmer/runner.rb +2 -2
  13. data/lib/simmer/specification/act.rb +1 -6
  14. data/lib/simmer/specification/assert/assertions/table.rb +1 -6
  15. data/lib/simmer/spoon_mock.rb +35 -0
  16. data/lib/simmer/suite.rb +49 -43
  17. data/lib/simmer/{session → suite}/reporter.rb +1 -1
  18. data/lib/simmer/{session → suite}/result.rb +1 -1
  19. data/lib/simmer/util.rb +0 -1
  20. data/lib/simmer/util/evaluator.rb +4 -5
  21. data/lib/simmer/util/record.rb +2 -0
  22. data/lib/simmer/util/record_set.rb +5 -1
  23. data/lib/simmer/util/resolver.rb +2 -2
  24. data/lib/simmer/util/yaml_reader.rb +9 -12
  25. data/lib/simmer/version.rb +1 -1
  26. data/spec/config/simmer.yaml.ci +7 -0
  27. data/spec/db/database.sql +1 -0
  28. data/spec/db/tables.sql +20 -0
  29. data/spec/db_helper.rb +26 -0
  30. data/spec/fixtures/agent_fixtures.yaml +14 -0
  31. data/spec/fixtures/configuration.yaml +11 -0
  32. data/spec/fixtures/noc_list.csv +3 -0
  33. data/spec/fixtures/specifications/load_noc_list.yaml +30 -0
  34. data/spec/fixtures/yaml_reader/bar.yaml +2 -0
  35. data/spec/fixtures/yaml_reader/baz/baz.yaml +2 -0
  36. data/spec/fixtures/yaml_reader/foo.yaml +2 -0
  37. data/spec/simmer/configuration_spec.rb +46 -0
  38. data/spec/simmer/database/fixture_set_spec.rb +75 -0
  39. data/spec/simmer/database/fixture_spec.rb +57 -0
  40. data/spec/simmer/externals/aws_file_system_spec.rb +75 -0
  41. data/spec/simmer/externals/mysql_database_spec.rb +79 -0
  42. data/spec/simmer/externals/spoon_client_spec.rb +67 -0
  43. data/spec/simmer/specification/act/params_spec.rb +38 -0
  44. data/spec/simmer/specification/act_spec.rb +37 -0
  45. data/spec/simmer/specification/assert_spec.rb +27 -0
  46. data/spec/simmer/specification/stage_spec.rb +32 -0
  47. data/spec/simmer/specification_spec.rb +28 -0
  48. data/spec/simmer/util/evaluator_spec.rb +82 -0
  49. data/spec/simmer/util/record_set_spec.rb +41 -0
  50. data/spec/simmer/util/record_spec.rb +218 -0
  51. data/spec/simmer/util/yaml_reader_spec.rb +49 -0
  52. data/spec/spec_helper.rb +21 -0
  53. metadata +60 -8
  54. data/lib/simmer/externals/spoon_client/mock.rb +0 -39
  55. data/lib/simmer/session.rb +0 -79
@@ -0,0 +1,49 @@
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 'spec_helper'
11
+
12
+ describe Simmer::Util::YamlReader do
13
+ specify '#read reads file and returns parsed YAML' do
14
+ path = File.join('spec', 'fixtures', 'yaml_reader', 'foo.yaml')
15
+ actual = subject.read(path)
16
+
17
+ expected = [
18
+ OpenStruct.new(
19
+ path: File.expand_path(path),
20
+ data: {
21
+ 'foo' => {
22
+ 'type' => 'foofy'
23
+ }
24
+ }
25
+ )
26
+ ]
27
+
28
+ expect(actual).to eq(expected)
29
+ end
30
+
31
+ specify '#smash recursively combines all YAML in a directory' do
32
+ path = File.join('spec', 'fixtures', 'yaml_reader')
33
+ actual = subject.smash(path)
34
+
35
+ expected = {
36
+ 'bar' => {
37
+ 'type' => 'barby'
38
+ },
39
+ 'baz' => {
40
+ 'type' => 'bazzy'
41
+ },
42
+ 'foo' => {
43
+ 'type' => 'foofy'
44
+ }
45
+ }
46
+
47
+ expect(actual).to eq(expected)
48
+ end
49
+ end
@@ -7,6 +7,7 @@
7
7
  # LICENSE file in the root directory of this source tree.
8
8
  #
9
9
 
10
+ require 'ostruct'
10
11
  require 'pry'
11
12
 
12
13
  unless ENV['DISABLE_SIMPLECOV'] == 'true'
@@ -20,3 +21,23 @@ unless ENV['DISABLE_SIMPLECOV'] == 'true'
20
21
  end
21
22
 
22
23
  require './lib/simmer'
24
+
25
+ def fixture_path(*filename)
26
+ File.join('spec', 'fixtures', filename)
27
+ end
28
+
29
+ def fixture(*filename)
30
+ File.read(fixture_path(*filename))
31
+ end
32
+
33
+ def yaml_fixture(*filename)
34
+ YAML.safe_load(fixture(*filename))
35
+ end
36
+
37
+ def yaml_read(*filename)
38
+ YAML.safe_load(File.read(File.join(*filename)))
39
+ end
40
+
41
+ def simmer_config
42
+ yaml_read('spec', 'config', 'simmer.yaml')
43
+ 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: 1.0.0.pre.alpha.3
4
+ version: 1.0.0.pre.alpha.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Ruggio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-01 00:00:00.000000000 Z
11
+ date: 2020-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: acts_as_hashable
@@ -218,20 +218,19 @@ files:
218
218
  - lib/simmer.rb
219
219
  - lib/simmer/configuration.rb
220
220
  - lib/simmer/core_ext/hash.rb
221
+ - lib/simmer/database.rb
222
+ - lib/simmer/database/fixture.rb
223
+ - lib/simmer/database/fixture_set.rb
221
224
  - lib/simmer/externals.rb
222
225
  - lib/simmer/externals/aws_file_system.rb
223
226
  - lib/simmer/externals/mysql_database.rb
224
227
  - lib/simmer/externals/mysql_database/sql_fixture.rb
225
228
  - lib/simmer/externals/spoon_client.rb
226
- - lib/simmer/externals/spoon_client/mock.rb
227
229
  - lib/simmer/externals/spoon_client/result.rb
228
230
  - lib/simmer/judge.rb
229
231
  - lib/simmer/judge/result.rb
230
232
  - lib/simmer/runner.rb
231
233
  - lib/simmer/runner/result.rb
232
- - lib/simmer/session.rb
233
- - lib/simmer/session/reporter.rb
234
- - lib/simmer/session/result.rb
235
234
  - lib/simmer/specification.rb
236
235
  - lib/simmer/specification/act.rb
237
236
  - lib/simmer/specification/act/params.rb
@@ -243,18 +242,45 @@ files:
243
242
  - lib/simmer/specification/assert/assertions/table.rb
244
243
  - lib/simmer/specification/stage.rb
245
244
  - lib/simmer/specification/stage/input_file.rb
245
+ - lib/simmer/spoon_mock.rb
246
246
  - lib/simmer/suite.rb
247
+ - lib/simmer/suite/reporter.rb
248
+ - lib/simmer/suite/result.rb
247
249
  - lib/simmer/util.rb
248
250
  - lib/simmer/util/evaluator.rb
249
- - lib/simmer/util/fixture.rb
250
- - lib/simmer/util/fixture_set.rb
251
251
  - lib/simmer/util/record.rb
252
252
  - lib/simmer/util/record_set.rb
253
253
  - lib/simmer/util/resolver.rb
254
254
  - lib/simmer/util/yaml_reader.rb
255
255
  - lib/simmer/version.rb
256
256
  - simmer.gemspec
257
+ - spec/config/simmer.yaml.ci
258
+ - spec/db/database.sql
259
+ - spec/db/tables.sql
260
+ - spec/db_helper.rb
261
+ - spec/fixtures/agent_fixtures.yaml
262
+ - spec/fixtures/configuration.yaml
263
+ - spec/fixtures/noc_list.csv
264
+ - spec/fixtures/specifications/load_noc_list.yaml
265
+ - spec/fixtures/yaml_reader/bar.yaml
266
+ - spec/fixtures/yaml_reader/baz/baz.yaml
267
+ - spec/fixtures/yaml_reader/foo.yaml
268
+ - spec/simmer/configuration_spec.rb
257
269
  - spec/simmer/core_ext/hash_spec.rb
270
+ - spec/simmer/database/fixture_set_spec.rb
271
+ - spec/simmer/database/fixture_spec.rb
272
+ - spec/simmer/externals/aws_file_system_spec.rb
273
+ - spec/simmer/externals/mysql_database_spec.rb
274
+ - spec/simmer/externals/spoon_client_spec.rb
275
+ - spec/simmer/specification/act/params_spec.rb
276
+ - spec/simmer/specification/act_spec.rb
277
+ - spec/simmer/specification/assert_spec.rb
278
+ - spec/simmer/specification/stage_spec.rb
279
+ - spec/simmer/specification_spec.rb
280
+ - spec/simmer/util/evaluator_spec.rb
281
+ - spec/simmer/util/record_set_spec.rb
282
+ - spec/simmer/util/record_spec.rb
283
+ - spec/simmer/util/yaml_reader_spec.rb
258
284
  - spec/spec_helper.rb
259
285
  homepage: https://github.com/bluemarblepayroll/simmer
260
286
  licenses:
@@ -280,5 +306,31 @@ signing_key:
280
306
  specification_version: 4
281
307
  summary: Pentaho Data Integration Automated Test Suite
282
308
  test_files:
309
+ - spec/config/simmer.yaml.ci
310
+ - spec/db/database.sql
311
+ - spec/db/tables.sql
312
+ - spec/db_helper.rb
313
+ - spec/fixtures/agent_fixtures.yaml
314
+ - spec/fixtures/configuration.yaml
315
+ - spec/fixtures/noc_list.csv
316
+ - spec/fixtures/specifications/load_noc_list.yaml
317
+ - spec/fixtures/yaml_reader/bar.yaml
318
+ - spec/fixtures/yaml_reader/baz/baz.yaml
319
+ - spec/fixtures/yaml_reader/foo.yaml
320
+ - spec/simmer/configuration_spec.rb
283
321
  - spec/simmer/core_ext/hash_spec.rb
322
+ - spec/simmer/database/fixture_set_spec.rb
323
+ - spec/simmer/database/fixture_spec.rb
324
+ - spec/simmer/externals/aws_file_system_spec.rb
325
+ - spec/simmer/externals/mysql_database_spec.rb
326
+ - spec/simmer/externals/spoon_client_spec.rb
327
+ - spec/simmer/specification/act/params_spec.rb
328
+ - spec/simmer/specification/act_spec.rb
329
+ - spec/simmer/specification/assert_spec.rb
330
+ - spec/simmer/specification/stage_spec.rb
331
+ - spec/simmer/specification_spec.rb
332
+ - spec/simmer/util/evaluator_spec.rb
333
+ - spec/simmer/util/record_set_spec.rb
334
+ - spec/simmer/util/record_spec.rb
335
+ - spec/simmer/util/yaml_reader_spec.rb
284
336
  - spec/spec_helper.rb
@@ -1,39 +0,0 @@
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
- module Externals
12
- class SpoonClient
13
- # Provides a simple mock for the underlying Pdi::Spoon class.
14
- class Mock
15
- attr_reader :pass
16
-
17
- def initialize(pass = true)
18
- @pass = pass
19
-
20
- freeze
21
- end
22
-
23
- def run(*)
24
- raise Pdi::Spoon::KitchenError, 'mocked' unless pass
25
-
26
- Pdi::Executor::Result.new(
27
- args: [],
28
- status: {
29
- code: 0,
30
- err: 'Some error output from PDI',
31
- out: 'Some output from PDI',
32
- pid: 123
33
- }
34
- )
35
- end
36
- end
37
- end
38
- end
39
- end
@@ -1,79 +0,0 @@
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 'session/reporter'
11
- require_relative 'session/result'
12
-
13
- module Simmer
14
- # Runs a collection of specifications and then writes down the results to disk.
15
- class Session
16
- def initialize(
17
- config:,
18
- out:,
19
- resolver: Objectable.resolver,
20
- results_dir:,
21
- runner:
22
- )
23
- @config = config || {}
24
- @out = out
25
- @resolver = resolver
26
- @results_dir = results_dir
27
- @runner = runner
28
-
29
- freeze
30
- end
31
-
32
- def run(specifications)
33
- runner_results = run_all_specs(specifications)
34
-
35
- Result.new(runner_results).tap do |result|
36
- if result.pass?
37
- out.puts('Suite ended successfully')
38
- else
39
- out.puts('Suite ended but was not successful')
40
- end
41
-
42
- Reporter.new(result).write!(results_dir)
43
-
44
- out.puts("Results can be viewed at #{results_dir}")
45
- end
46
- end
47
-
48
- private
49
-
50
- attr_reader :config, :out, :results_dir, :resolver, :runner
51
-
52
- def run_all_specs(specifications)
53
- out.puts('Simmer suite started')
54
-
55
- count = specifications.length
56
-
57
- out.puts("Running #{count} specification(s)")
58
- print_line
59
-
60
- specifications.map.with_index(1) do |specification, index|
61
- run_single_spec(specification, index, count)
62
- end
63
- end
64
-
65
- def run_single_spec(specification, index, count)
66
- id = SecureRandom.uuid
67
-
68
- out.puts("Test #{index} of #{count}: #{id}")
69
-
70
- runner.run(specification, id: id, config: config).tap do
71
- print_line
72
- end
73
- end
74
-
75
- def print_line
76
- out.puts('-' * 60)
77
- end
78
- end
79
- end