Skip to content

Commit f90f132

Browse files
author
Kevin Paulisse
committed
Commit WIP
1 parent aa4d306 commit f90f132

1 file changed

Lines changed: 55 additions & 4 deletions

File tree

spec/octocatalog-diff/integration/enc_override_spec.rb

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
'--no-parallel',
5757
'--enc',
5858
OctocatalogDiff::Spec.fixture_path('repos/enc-overrides/enc.sh'),
59-
'--enc-override', 'role=two'
59+
'--enc-override', 'parameters::role=two'
6060
]
6161
)
6262
end
@@ -97,7 +97,7 @@
9797
'--no-parallel',
9898
'--enc',
9999
OctocatalogDiff::Spec.fixture_path('repos/enc-overrides/enc.sh'),
100-
'--to-enc-override', 'role=two'
100+
'--to-enc-override', 'parameters::role=two'
101101
]
102102
)
103103
end
@@ -143,7 +143,7 @@
143143
'--no-parallel',
144144
'--enc',
145145
OctocatalogDiff::Spec.fixture_path('repos/enc-overrides/enc.sh'),
146-
'--from-enc-override', 'role=two'
146+
'--from-enc-override', 'parameters::role=two'
147147
]
148148
)
149149
end
@@ -189,7 +189,7 @@
189189
'--no-parallel',
190190
'--enc',
191191
OctocatalogDiff::Spec.fixture_path('repos/enc-overrides/enc.sh'),
192-
'--enc-override', 'role=two',
192+
'--enc-override', 'parameters::role=two',
193193
'--catalog-only'
194194
]
195195
)
@@ -208,3 +208,54 @@
208208
expect(@result.log_messages).to include('DEBUG - ENC override: role = "two"')
209209
end
210210
end
211+
212+
describe 'ENC override via CLI' do
213+
before(:all) do
214+
@result = OctocatalogDiff::Integration.integration_cli(
215+
[
216+
'-n', 'rspec-node.github.net',
217+
'--bootstrapped-to-dir', OctocatalogDiff::Spec.fixture_path('repos/enc-overrides'),
218+
'--bootstrapped-from-dir', OctocatalogDiff::Spec.fixture_path('repos/enc-overrides'),
219+
'--to-enc-override', 'parameters::role=two',
220+
'--output-format', 'json',
221+
'--fact-file', OctocatalogDiff::Spec.fixture_path('facts/valid-facts.yaml'),
222+
'--hiera-config', 'hiera.yaml',
223+
'--hiera-path', 'hieradata',
224+
'--puppet-binary', OctocatalogDiff::Spec::PUPPET_BINARY,
225+
'-d'
226+
]
227+
)
228+
end
229+
230+
it 'should exit with status 2' do
231+
expect(@result.exitcode).to eq(2), @result.stderr
232+
end
233+
234+
it 'should contain the correct diffs' do
235+
parse_result = JSON.parse(@result.stdout)['diff'].map { |x| OctocatalogDiff::Spec.remove_file_and_line(x) }
236+
expect(parse_result.size).to eq(2)
237+
expect(parse_result).to include(
238+
diff_type: '~',
239+
type: 'File',
240+
title: '/tmp/one',
241+
structure: %w(parameters content),
242+
old_value: 'two',
243+
new_value: 'one'
244+
)
245+
expect(parse_result).to include(
246+
diff_type: '~',
247+
type: 'File',
248+
title: '/tmp/two',
249+
structure: %w(parameters content),
250+
old_value: 'two',
251+
new_value: 'one'
252+
)
253+
end
254+
255+
it 'should log the correct messages' do
256+
expect(@result.stderr).to match(/Catalog for . will be built with OctocatalogDiff::Catalog::Computed/)
257+
expect(@result.stderr).to match(/Override ipaddress from "10.20.30.40" to "10.30.50.70"/)
258+
expect(@result.stderr).to match(/Override foofoo from nil to "barbar"/)
259+
expect(@result.stderr).to match(/Diffs computed for rspec-node.github.net/)
260+
end
261+
end

0 commit comments

Comments
 (0)