simmer 1.0.0.pre.alpha.7 → 1.0.0.pre.alpha.8

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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/lib/simmer/version.rb +1 -1
  3. data/simmer.gemspec +9 -2
  4. metadata +11 -80
  5. data/spec/config/simmer.yaml.ci +0 -22
  6. data/spec/db/database.sql +0 -1
  7. data/spec/db/tables.sql +0 -20
  8. data/spec/db_helper.rb +0 -26
  9. data/spec/fixtures/agent_fixtures.yaml +0 -14
  10. data/spec/fixtures/configuration.yaml +0 -11
  11. data/spec/fixtures/noc_list.csv +0 -3
  12. data/spec/fixtures/specifications/load_noc_list.yaml +0 -37
  13. data/spec/fixtures/yaml_reader/bar.yaml +0 -2
  14. data/spec/fixtures/yaml_reader/baz/baz.yaml +0 -2
  15. data/spec/fixtures/yaml_reader/foo.yaml +0 -2
  16. data/spec/mocks/aws_s3_client.rb +0 -56
  17. data/spec/mocks/load_noc_list/pan.sh +0 -10
  18. data/spec/mocks/load_noc_list_bad_output/pan.sh +0 -10
  19. data/spec/mocks/out.rb +0 -14
  20. data/spec/mocks/spoon/kitchen.sh +0 -14
  21. data/spec/mocks/spoon/pan.sh +0 -14
  22. data/spec/simmer/configuration_spec.rb +0 -46
  23. data/spec/simmer/core_ext/hash_spec.rb +0 -16
  24. data/spec/simmer/database/fixture_set_spec.rb +0 -75
  25. data/spec/simmer/database/fixture_spec.rb +0 -57
  26. data/spec/simmer/externals/aws_file_system_spec.rb +0 -58
  27. data/spec/simmer/externals/mysql_database_spec.rb +0 -89
  28. data/spec/simmer/externals/spoon_client_spec.rb +0 -47
  29. data/spec/simmer/specification/act/params_spec.rb +0 -38
  30. data/spec/simmer/specification/act_spec.rb +0 -37
  31. data/spec/simmer/specification/assert_spec.rb +0 -29
  32. data/spec/simmer/specification/stage_spec.rb +0 -32
  33. data/spec/simmer/specification_spec.rb +0 -28
  34. data/spec/simmer/util/evaluator_spec.rb +0 -82
  35. data/spec/simmer/util/record_set_spec.rb +0 -84
  36. data/spec/simmer/util/record_spec.rb +0 -218
  37. data/spec/simmer/util/yaml_reader_spec.rb +0 -49
  38. data/spec/simmer_spec/files/noc_list.csv +0 -3
  39. data/spec/simmer_spec/fixtures/agent_fixtures.yaml +0 -14
  40. data/spec/simmer_spec.rb +0 -104
  41. data/spec/spec_helper.rb +0 -43
  42. /data/{bin → exe}/simmer +0 -0
@@ -1,218 +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 'spec_helper'
11
-
12
- describe Simmer::Util::Record do
13
- describe 'initialization' do
14
- let(:data) do
15
- {
16
- 'a' => 'a'
17
- }
18
- end
19
-
20
- it 'accepts hash' do
21
- subject = described_class.new(data)
22
-
23
- expect(subject.to_h).to eq(data)
24
- end
25
-
26
- it 'accepts Record' do
27
- record = Simmer::Util::Record.new(data)
28
- subject = described_class.new(record)
29
-
30
- expect(subject.to_h).to eq(data)
31
- end
32
-
33
- it 'accepts OpenStruct' do
34
- record = OpenStruct.new(data)
35
- subject = described_class.new(record)
36
-
37
- expect(subject.to_h).to eq(data)
38
- end
39
- end
40
-
41
- describe 'equality' do
42
- context 'when key types do not equal' do
43
- let(:symbol_hash) do
44
- {
45
- '1': 1
46
- }
47
- end
48
-
49
- let(:string_hash) do
50
- {
51
- '1' => 1
52
- }
53
- end
54
-
55
- let(:numeric_hash) do
56
- {}.tap do |hash|
57
- hash[1] = 1
58
- end
59
- end
60
-
61
- it 'compares symbol to string keys' do
62
- record1 = described_class.new(symbol_hash)
63
- record2 = described_class.new(string_hash)
64
-
65
- expect(record1).to eq(record2)
66
- expect(record1).to eql(record2)
67
- end
68
-
69
- it 'compares symbol to number keys' do
70
- record1 = described_class.new(symbol_hash)
71
- record2 = described_class.new(numeric_hash)
72
-
73
- expect(record1).to eq(record2)
74
- expect(record1).to eql(record2)
75
- end
76
-
77
- it 'compares string to number keys' do
78
- record1 = described_class.new(string_hash)
79
- record2 = described_class.new(numeric_hash)
80
-
81
- expect(record1).to eq(record2)
82
- expect(record1).to eql(record2)
83
- end
84
- end
85
-
86
- context 'when value types do not equal' do
87
- let(:symbol_hash) do
88
- {
89
- a: :'1'
90
- }
91
- end
92
-
93
- let(:string_hash) do
94
- {
95
- a: '1'
96
- }
97
- end
98
-
99
- let(:numeric_hash) do
100
- {
101
- a: 1
102
- }
103
- end
104
-
105
- it 'compares symbol to string keys' do
106
- record1 = described_class.new(symbol_hash)
107
- record2 = described_class.new(string_hash)
108
-
109
- expect(record1).to eq(record2)
110
- expect(record1).to eql(record2)
111
- end
112
-
113
- it 'compares symbol to number keys' do
114
- record1 = described_class.new(symbol_hash)
115
- record2 = described_class.new(numeric_hash)
116
-
117
- expect(record1).to eq(record2)
118
- expect(record1).to eql(record2)
119
- end
120
-
121
- it 'compares string to number keys' do
122
- record1 = described_class.new(string_hash)
123
- record2 = described_class.new(numeric_hash)
124
-
125
- expect(record1).to eq(record2)
126
- expect(record1).to eql(record2)
127
- end
128
- end
129
-
130
- context 'when keys and values are not in same order and mixed type' do
131
- let(:alphabetical_hash) do
132
- {
133
- a: 'a',
134
- b: :b,
135
- 'c': 'c'
136
- }
137
- end
138
-
139
- let(:reverse_alphabetical_hash) do
140
- {
141
- b: 'b',
142
- c: 'c',
143
- 'a': :a
144
- }
145
- end
146
-
147
- it 'should ignore key ordering' do
148
- record1 = described_class.new(alphabetical_hash)
149
- record2 = described_class.new(reverse_alphabetical_hash)
150
-
151
- expect(record1).to eq(record2)
152
- expect(record1).to eql(record2)
153
- end
154
- end
155
-
156
- context 'when value(s) are of type BigDecimal' do
157
- let(:string_value) { '12.005' }
158
-
159
- let(:float_hash) do
160
- {
161
- a: string_value.to_f
162
- }
163
- end
164
-
165
- let(:big_decimal_hash) do
166
- {
167
- a: BigDecimal(string_value)
168
- }
169
- end
170
-
171
- let(:string_hash) do
172
- {
173
- a: string_value
174
- }
175
- end
176
-
177
- it 'compares floats with big decimals' do
178
- record1 = described_class.new(float_hash)
179
- record2 = described_class.new(big_decimal_hash)
180
-
181
- expect(record1).to eq(record2)
182
- expect(record1).to eql(record2)
183
- end
184
-
185
- it 'compares floats with strings' do
186
- record1 = described_class.new(float_hash)
187
- record2 = described_class.new(string_hash)
188
-
189
- expect(record1).to eq(record2)
190
- expect(record1).to eql(record2)
191
- end
192
-
193
- it 'compares big decimals with strings' do
194
- record1 = described_class.new(big_decimal_hash)
195
- record2 = described_class.new(string_hash)
196
-
197
- expect(record1).to eq(record2)
198
- expect(record1).to eql(record2)
199
- end
200
- end
201
-
202
- it 'should not equal if values are not equal' do
203
- record1 = described_class.new(a: 'a')
204
- record2 = described_class.new(a: 'b')
205
-
206
- expect(record1).not_to eq(record2)
207
- expect(record1).not_to eql(record2)
208
- end
209
-
210
- it 'should not equal if keys are not equal' do
211
- record1 = described_class.new(a: 'a')
212
- record2 = described_class.new(b: 'a')
213
-
214
- expect(record1).not_to eq(record2)
215
- expect(record1).not_to eql(record2)
216
- end
217
- end
218
- end
@@ -1,49 +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 '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
@@ -1,3 +0,0 @@
1
- call_sign,first,last
2
- iron_man,Tony,Stark
3
- hulk,Bruce,Banner
@@ -1,14 +0,0 @@
1
- hulk:
2
- table: agents
3
- fields:
4
- call_sign: hulk
5
- first: CLASSIFIED
6
- last: CLASSIFIED
7
-
8
- iron_man:
9
- table: agents
10
- fields:
11
- call_sign: iron_man
12
- first: CLASSIFIED
13
- last: CLASSIFIED
14
-
data/spec/simmer_spec.rb DELETED
@@ -1,104 +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 'spec_helper'
11
- require './spec/mocks/out'
12
-
13
- describe Simmer do
14
- def stage_simmer_config(spoon_dir, args)
15
- src_config_path = File.join('spec', 'config', 'simmer.yaml')
16
- dest_config_dir = File.join('tmp')
17
- dest_config_path = File.join(dest_config_dir, 'simmer.yaml')
18
-
19
- FileUtils.rm(dest_config_path) if File.exist?(dest_config_path)
20
- FileUtils.mkdir_p(dest_config_dir)
21
-
22
- config = yaml_read(src_config_path)
23
-
24
- new_config = config.merge('spoon_client' => {
25
- 'dir' => spoon_dir,
26
- 'args' => args
27
- })
28
-
29
- IO.write(dest_config_path, new_config.to_yaml)
30
-
31
- dest_config_path
32
- end
33
-
34
- context 'when externally mocking pdi and using local file system' do
35
- let(:spec_path) { File.join('spec', 'fixtures', 'specifications', 'load_noc_list.yaml') }
36
- let(:simmer_dir) { File.join('spec', 'simmer_spec') }
37
- let(:out) { Out.new }
38
- let(:config_path) { stage_simmer_config(spoon_path, args) }
39
-
40
- context 'when pdi does not do anything but does not fail' do
41
- let(:spoon_path) { File.join('spec', 'mocks', 'spoon') }
42
- let(:args) { 0 }
43
-
44
- specify 'judge determines it does not pass' do
45
- results = described_class.run(
46
- spec_path,
47
- config_path: config_path,
48
- out: out,
49
- simmer_dir: simmer_dir
50
- )
51
-
52
- expect(results.pass?).to be false
53
- end
54
- end
55
-
56
- context 'when pdi fails' do
57
- let(:spoon_path) { File.join('spec', 'mocks', 'spoon') }
58
- let(:args) { 1 }
59
-
60
- specify 'judge determines it does not pass' do
61
- results = described_class.run(
62
- spec_path,
63
- config_path: config_path,
64
- out: out,
65
- simmer_dir: simmer_dir
66
- )
67
-
68
- expect(results.pass?).to be false
69
- end
70
- end
71
-
72
- context 'when pdi acts correctly' do
73
- let(:spoon_path) { File.join('spec', 'mocks', 'load_noc_list') }
74
- let(:args) { '' }
75
-
76
- specify 'judge determines it to pass' do
77
- results = described_class.run(
78
- spec_path,
79
- config_path: config_path,
80
- out: out,
81
- simmer_dir: simmer_dir
82
- )
83
-
84
- expect(results.pass?).to be true
85
- end
86
- end
87
-
88
- context 'when pdi accts correctly but judge fails on output assert' do
89
- let(:spoon_path) { File.join('spec', 'mocks', 'load_noc_list_bad_output') }
90
- let(:args) { '' }
91
-
92
- specify 'judge determines it to pass' do
93
- results = described_class.run(
94
- spec_path,
95
- config_path: config_path,
96
- out: out,
97
- simmer_dir: simmer_dir
98
- )
99
-
100
- expect(results.pass?).to be false
101
- end
102
- end
103
- end
104
- end
data/spec/spec_helper.rb DELETED
@@ -1,43 +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 'ostruct'
11
- require 'pry'
12
-
13
- unless ENV['DISABLE_SIMPLECOV'] == 'true'
14
- require 'simplecov'
15
- require 'simplecov-console'
16
-
17
- SimpleCov.formatter = SimpleCov::Formatter::Console
18
- SimpleCov.start do
19
- add_filter %r{\A/spec/}
20
- end
21
- end
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
File without changes