Skip to content

Commit ffad401

Browse files
author
Kevin Paulisse
committed
Allow tests to pass in puppet 3.8 and 4.5
1 parent 0e0b380 commit ffad401

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

spec/octocatalog-diff/integration/reference_validation_spec.rb

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,14 @@ def self.catalog_contains_resource(result, type, title)
102102
expect(@result.exception).to be_a_kind_of(OctocatalogDiff::Errors::ReferenceValidationError)
103103
end
104104

105+
# Multiple line numbers given because Puppet 4.x and 3.8 correspond to first and last line of resource, respectively.
105106
# rubocop:disable Metrics/LineLength
106107
it 'should have formatted error messages' do
107108
msg = @result.exception.message
108-
expect(msg).to match(%r{exec\[subscribe caller 1\]\(/environments/production/modules/test/manifests/subscribe_callers.pp:2\) -> subscribe\[Exec\[subscribe target\]\]})
109-
expect(msg).to match(%r{exec\[subscribe caller 2\]\(/environments/production/modules/test/manifests/subscribe_callers.pp:7\) -> subscribe\[Exec\[subscribe target\]\]})
110-
expect(msg).to match(%r{exec\[subscribe caller 2\]\(/environments/production/modules/test/manifests/subscribe_callers.pp:7\) -> subscribe\[Exec\[subscribe target 2\]\]})
111-
expect(msg).to match(%r{exec\[subscribe caller 3\]\(/environments/production/modules/test/manifests/subscribe_callers.pp:15\) -> subscribe\[Exec\[subscribe target\]\]})
109+
expect(msg).to match(%r{exec\[subscribe caller 1\]\(/environments/production/modules/test/manifests/subscribe_callers.pp:(2|5)\) -> subscribe\[Exec\[subscribe target\]\]})
110+
expect(msg).to match(%r{exec\[subscribe caller 2\]\(/environments/production/modules/test/manifests/subscribe_callers.pp:(7|13)\) -> subscribe\[Exec\[subscribe target\]\]})
111+
expect(msg).to match(%r{exec\[subscribe caller 2\]\(/environments/production/modules/test/manifests/subscribe_callers.pp:(7|13)\) -> subscribe\[Exec\[subscribe target 2\]\]})
112+
expect(msg).to match(%r{exec\[subscribe caller 3\]\(/environments/production/modules/test/manifests/subscribe_callers.pp:(15|21)\) -> subscribe\[Exec\[subscribe target\]\]})
112113
expect(msg).not_to match(/exec\[subscribe caller 3\].+subscribe\[Exec\[subscribe caller 1\]\]/)
113114
end
114115
# rubocop:enable Metrics/LineLength
@@ -130,7 +131,7 @@ def self.catalog_contains_resource(result, type, title)
130131
# rubocop:disable Metrics/LineLength
131132
it 'should have formatted error messages' do
132133
msg = @result.exception.message
133-
expect(msg).to eq('Catalog has broken reference: exec[before caller](/environments/production/modules/test/manifests/before_callers.pp:2) -> before[Exec[before target]]')
134+
expect(msg).to match(%r{Catalog has broken reference: exec\[before caller\]\(/environments/production/modules/test/manifests/before_callers.pp:(2|5)\) -> before\[Exec\[before target\]\]})
134135
end
135136
# rubocop:enable Metrics/LineLength
136137
end
@@ -151,7 +152,7 @@ def self.catalog_contains_resource(result, type, title)
151152
# rubocop:disable Metrics/LineLength
152153
it 'should have formatted error messages' do
153154
msg = @result.exception.message
154-
expect(msg).to match(%r{exec\[notify caller\]\(/environments/production/modules/test/manifests/notify_callers.pp:2\) -> notify\[Test::Foo::Bar\[notify target\]\]})
155+
expect(msg).to match(%r{exec\[notify caller\]\(/environments/production/modules/test/manifests/notify_callers.pp:(2|4)\) -> notify\[Test::Foo::Bar\[notify target\]\]})
155156
end
156157
# rubocop:enable Metrics/LineLength
157158
end
@@ -172,9 +173,9 @@ def self.catalog_contains_resource(result, type, title)
172173
# rubocop:disable Metrics/LineLength
173174
it 'should have formatted error messages' do
174175
msg = @result.exception.message
175-
expect(msg).to match(%r{exec\[require caller\]\(/environments/production/modules/test/manifests/require_callers.pp:2\) -> require\[Exec\[require target\]\]})
176-
expect(msg).to match(%r{exec\[require caller 3\]\(/environments/production/modules/test/manifests/require_callers.pp:12\) -> require\[Exec\[require target\]\]})
177-
expect(msg).to match(%r{exec\[require caller 4\]\(/environments/production/modules/test/manifests/require_callers.pp:12\) -> require\[Exec\[require target\]\]})
176+
expect(msg).to match(%r{exec\[require caller\]\(/environments/production/modules/test/manifests/require_callers.pp:(2|5)\) -> require\[Exec\[require target\]\]})
177+
expect(msg).to match(%r{exec\[require caller 3\]\(/environments/production/modules/test/manifests/require_callers.pp:(12|18)\) -> require\[Exec\[require target\]\]})
178+
expect(msg).to match(%r{exec\[require caller 4\]\(/environments/production/modules/test/manifests/require_callers.pp:(12|18)\) -> require\[Exec\[require target\]\]})
178179
expect(msg).not_to match(/exec\[require caller 2\]/)
179180
expect(msg).not_to match(/-> require\[Exec\[require caller\]\]/)
180181
end
@@ -234,10 +235,10 @@ def self.catalog_contains_resource(result, type, title)
234235
# rubocop:disable Metrics/LineLength
235236
it 'should have formatted error messages' do
236237
msg = @result.exception.message
237-
expect(msg).to match(%r{exec\[before alias caller\]\(/environments/production/modules/test/manifests/alias_callers.pp:2\) -> before\[Exec\[before alias target\]\]})
238-
expect(msg).to match(%r{exec\[notify alias caller\]\(/environments/production/modules/test/manifests/alias_callers.pp:7\) -> before\[Exec\[notify alias target\]\]})
239-
expect(msg).to match(%r{exec\[require alias caller\]\(/environments/production/modules/test/manifests/alias_callers.pp:12\) -> before\[Exec\[require alias target\]\]})
240-
expect(msg).to match(%r{exec\[subscribe alias caller\]\(/environments/production/modules/test/manifests/alias_callers.pp:17\) -> before\[Exec\[subscribe alias target\]\]})
238+
expect(msg).to match(%r{exec\[before alias caller\]\(/environments/production/modules/test/manifests/alias_callers.pp:(2|5)\) -> before\[Exec\[before alias target\]\]})
239+
expect(msg).to match(%r{exec\[notify alias caller\]\(/environments/production/modules/test/manifests/alias_callers.pp:(7|10)\) -> before\[Exec\[notify alias target\]\]})
240+
expect(msg).to match(%r{exec\[require alias caller\]\(/environments/production/modules/test/manifests/alias_callers.pp:(12|15)\) -> before\[Exec\[require alias target\]\]})
241+
expect(msg).to match(%r{exec\[subscribe alias caller\]\(/environments/production/modules/test/manifests/alias_callers.pp:(17|20)\) -> before\[Exec\[subscribe alias target\]\]})
241242
end
242243
# rubocop:enable Metrics/LineLength
243244
end
@@ -290,10 +291,10 @@ def self.catalog_contains_resource(result, type, title)
290291
# rubocop:disable Metrics/LineLength
291292
it 'should have formatted error messages' do
292293
msg = @result.exception.message
293-
expect(msg).to match(%r{exec\[subscribe caller 1\]\(.+/modules/test/manifests/subscribe_callers.pp:2\) -> subscribe\[Exec\[subscribe target\]\]})
294-
expect(msg).to match(%r{exec\[subscribe caller 2\]\(.+/modules/test/manifests/subscribe_callers.pp:7\) -> subscribe\[Exec\[subscribe target\]\]})
295-
expect(msg).to match(%r{exec\[subscribe caller 2\]\(.+/modules/test/manifests/subscribe_callers.pp:7\) -> subscribe\[Exec\[subscribe target 2\]\]})
296-
expect(msg).to match(%r{exec\[subscribe caller 3\]\(.+/modules/test/manifests/subscribe_callers.pp:15\) -> subscribe\[Exec\[subscribe target\]\]})
294+
expect(msg).to match(%r{exec\[subscribe caller 1\]\(.+/modules/test/manifests/subscribe_callers.pp:(2|5)\) -> subscribe\[Exec\[subscribe target\]\]})
295+
expect(msg).to match(%r{exec\[subscribe caller 2\]\(.+/modules/test/manifests/subscribe_callers.pp:(7|13)\) -> subscribe\[Exec\[subscribe target\]\]})
296+
expect(msg).to match(%r{exec\[subscribe caller 2\]\(.+/modules/test/manifests/subscribe_callers.pp:(7|13)\) -> subscribe\[Exec\[subscribe target 2\]\]})
297+
expect(msg).to match(%r{exec\[subscribe caller 3\]\(.+/modules/test/manifests/subscribe_callers.pp:(15|21)\) -> subscribe\[Exec\[subscribe target\]\]})
297298
end
298299
# rubocop:enable Metrics/LineLength
299300
end
@@ -336,10 +337,10 @@ def self.catalog_contains_resource(result, type, title)
336337
# rubocop:disable Metrics/LineLength
337338
it 'should have formatted error messages from to-catalog only' do
338339
msg = @result.exception.message
339-
expect(msg).to match(%r{exec\[subscribe caller 1\]\(.+/modules/test/manifests/subscribe_callers.pp:2\) -> subscribe\[Exec\[subscribe target\]\]})
340-
expect(msg).to match(%r{exec\[subscribe caller 2\]\(.+/modules/test/manifests/subscribe_callers.pp:7\) -> subscribe\[Exec\[subscribe target\]\]})
341-
expect(msg).to match(%r{exec\[subscribe caller 2\]\(.+/modules/test/manifests/subscribe_callers.pp:7\) -> subscribe\[Exec\[subscribe target 2\]\]})
342-
expect(msg).to match(%r{exec\[subscribe caller 3\]\(.+/modules/test/manifests/subscribe_callers.pp:15\) -> subscribe\[Exec\[subscribe target\]\]})
340+
expect(msg).to match(%r{exec\[subscribe caller 1\]\(.+/modules/test/manifests/subscribe_callers.pp:(2|5)\) -> subscribe\[Exec\[subscribe target\]\]})
341+
expect(msg).to match(%r{exec\[subscribe caller 2\]\(.+/modules/test/manifests/subscribe_callers.pp:(7|13)\) -> subscribe\[Exec\[subscribe target\]\]})
342+
expect(msg).to match(%r{exec\[subscribe caller 2\]\(.+/modules/test/manifests/subscribe_callers.pp:(7|13)\) -> subscribe\[Exec\[subscribe target 2\]\]})
343+
expect(msg).to match(%r{exec\[subscribe caller 3\]\(.+/modules/test/manifests/subscribe_callers.pp:(15|21)\) -> subscribe\[Exec\[subscribe target\]\]})
343344
expect(msg).not_to match(/require target/)
344345
end
345346
# rubocop:enable Metrics/LineLength

0 commit comments

Comments
 (0)