@@ -102,14 +102,17 @@ def self.catalog_contains_resource(result, type, title)
102
102
expect ( @result . exception ) . to be_a_kind_of ( OctocatalogDiff ::Errors ::ReferenceValidationError )
103
103
end
104
104
105
+ # Multiple line numbers given because Puppet 4.x and 3.8 correspond to first and last line of resource, respectively.
106
+ # rubocop:disable Metrics/LineLength
105
107
it 'should have formatted error messages' do
106
108
msg = @result . exception . message
107
- expect ( msg ) . to match ( / exec\[ subscribe caller 1\] -> subscribe\[ Exec\[ subscribe target\] \] / )
108
- expect ( msg ) . to match ( / exec\[ subscribe caller 2\] -> subscribe\[ Exec\[ subscribe target\] \] / )
109
- expect ( msg ) . to match ( / exec\[ subscribe caller 2\] -> subscribe\[ Exec\[ subscribe target 2\] \] / )
110
- expect ( msg ) . to match ( / exec\[ subscribe caller 3\] -> subscribe\[ Exec\[ subscribe target\] \] / )
111
- expect ( msg ) . not_to match ( /exec\[ subscribe caller 3\] -> subscribe\[ Exec\[ subscribe caller 1\] \] / )
109
+ expect ( msg ) . to match ( %r{ exec\[ subscribe caller 1\] \( modules/test/manifests/subscribe_callers.pp:(2|5) \) -> subscribe\[ Exec\[ subscribe target\] \] } )
110
+ expect ( msg ) . to match ( %r{ exec\[ subscribe caller 2\] \( modules/test/manifests/subscribe_callers.pp:(7|13) \) -> subscribe\[ Exec\[ subscribe target\] \] } )
111
+ expect ( msg ) . to match ( %r{ exec\[ subscribe caller 2\] \( modules/test/manifests/subscribe_callers.pp:(7|13) \) -> subscribe\[ Exec\[ subscribe target 2\] \] } )
112
+ expect ( msg ) . to match ( %r{ exec\[ subscribe caller 3\] \( modules/test/manifests/subscribe_callers.pp:(15|21) \) -> subscribe\[ Exec\[ subscribe target\] \] } )
113
+ expect ( msg ) . not_to match ( /exec\[ subscribe caller 3\] .+ subscribe\[ Exec\[ subscribe caller 1\] \] / )
112
114
end
115
+ # rubocop:enable Metrics/LineLength
113
116
end
114
117
115
118
context 'with broken before' do
@@ -125,10 +128,12 @@ def self.catalog_contains_resource(result, type, title)
125
128
expect ( @result . exception ) . to be_a_kind_of ( OctocatalogDiff ::Errors ::ReferenceValidationError )
126
129
end
127
130
131
+ # rubocop:disable Metrics/LineLength
128
132
it 'should have formatted error messages' do
129
133
msg = @result . exception . message
130
- expect ( msg ) . to eq ( ' Catalog has broken reference: exec[before caller] -> before[Exec[before target]]' )
134
+ expect ( msg ) . to match ( %r{ Catalog has broken reference: exec\ [ before caller\] \( modules/test/manifests/before_callers.pp:(2|5) \) -> before\ [ Exec\ [ before target\] \] } )
131
135
end
136
+ # rubocop:enable Metrics/LineLength
132
137
end
133
138
134
139
context 'with broken notify' do
@@ -144,10 +149,12 @@ def self.catalog_contains_resource(result, type, title)
144
149
expect ( @result . exception ) . to be_a_kind_of ( OctocatalogDiff ::Errors ::ReferenceValidationError )
145
150
end
146
151
152
+ # rubocop:disable Metrics/LineLength
147
153
it 'should have formatted error messages' do
148
154
msg = @result . exception . message
149
- expect ( msg ) . to match ( / exec\[ notify caller\] -> notify\[ Test::Foo::Bar\[ notify target\] \] / )
155
+ expect ( msg ) . to match ( %r{ exec\[ notify caller\] \( modules/test/manifests/notify_callers.pp:(2|4) \) -> notify\[ Test::Foo::Bar\[ notify target\] \] } )
150
156
end
157
+ # rubocop:enable Metrics/LineLength
151
158
end
152
159
153
160
context 'with broken require' do
@@ -163,14 +170,16 @@ def self.catalog_contains_resource(result, type, title)
163
170
expect ( @result . exception ) . to be_a_kind_of ( OctocatalogDiff ::Errors ::ReferenceValidationError )
164
171
end
165
172
173
+ # rubocop:disable Metrics/LineLength
166
174
it 'should have formatted error messages' do
167
175
msg = @result . exception . message
168
- expect ( msg ) . to match ( / exec\[ require caller\] -> require\[ Exec\[ require target\] \] / )
169
- expect ( msg ) . to match ( / exec\[ require caller 3\] -> require\[ Exec\[ require target\] \] / )
170
- expect ( msg ) . to match ( / exec\[ require caller 4\] -> require\[ Exec\[ require target\] \] / )
176
+ expect ( msg ) . to match ( %r{ exec\[ require caller\] \( modules/test/manifests/require_callers.pp:(2|5) \) -> require\[ Exec\[ require target\] \] } )
177
+ expect ( msg ) . to match ( %r{ exec\[ require caller 3\] \( modules/test/manifests/require_callers.pp:(12|18) \) -> require\[ Exec\[ require target\] \] } )
178
+ expect ( msg ) . to match ( %r{ exec\[ require caller 4\] \( modules/test/manifests/require_callers.pp:(12|18) \) -> require\[ Exec\[ require target\] \] } )
171
179
expect ( msg ) . not_to match ( /exec\[ require caller 2\] / )
172
180
expect ( msg ) . not_to match ( /-> require\[ Exec\[ require caller\] \] / )
173
181
end
182
+ # rubocop:enable Metrics/LineLength
174
183
end
175
184
176
185
context 'with broken subscribe but subscribe not checked' do
@@ -223,13 +232,15 @@ def self.catalog_contains_resource(result, type, title)
223
232
expect ( @result . exception ) . to be_a_kind_of ( OctocatalogDiff ::Errors ::ReferenceValidationError )
224
233
end
225
234
235
+ # rubocop:disable Metrics/LineLength
226
236
it 'should have formatted error messages' do
227
237
msg = @result . exception . message
228
- expect ( msg ) . to match ( / exec\[ before alias caller\] -> before\[ Exec\[ before alias target\] \] / )
229
- expect ( msg ) . to match ( / exec\[ notify alias caller\] -> before\[ Exec\[ notify alias target\] \] / )
230
- expect ( msg ) . to match ( / exec\[ require alias caller\] -> before\[ Exec\[ require alias target\] \] / )
231
- expect ( msg ) . to match ( / exec\[ subscribe alias caller\] -> before\[ Exec\[ subscribe alias target\] \] / )
238
+ expect ( msg ) . to match ( %r{ exec\[ before alias caller\] \( modules/test/manifests/alias_callers.pp:(2|5) \) -> before\[ Exec\[ before alias target\] \] } )
239
+ expect ( msg ) . to match ( %r{ exec\[ notify alias caller\] \( modules/test/manifests/alias_callers.pp:(7|10) \) -> before\[ Exec\[ notify alias target\] \] } )
240
+ expect ( msg ) . to match ( %r{ exec\[ require alias caller\] \( modules/test/manifests/alias_callers.pp:(12|15) \) -> before\[ Exec\[ require alias target\] \] } )
241
+ expect ( msg ) . to match ( %r{ exec\[ subscribe alias caller\] \( modules/test/manifests/alias_callers.pp:(17|20) \) -> before\[ Exec\[ subscribe alias target\] \] } )
232
242
end
243
+ # rubocop:enable Metrics/LineLength
233
244
end
234
245
end
235
246
@@ -277,13 +288,15 @@ def self.catalog_contains_resource(result, type, title)
277
288
expect ( @result . exception ) . to be_a_kind_of ( OctocatalogDiff ::Errors ::ReferenceValidationError )
278
289
end
279
290
291
+ # rubocop:disable Metrics/LineLength
280
292
it 'should have formatted error messages' do
281
293
msg = @result . exception . message
282
- expect ( msg ) . to match ( / exec\[ subscribe caller 1\] -> subscribe\[ Exec\[ subscribe target\] \] / )
283
- expect ( msg ) . to match ( / exec\[ subscribe caller 2\] -> subscribe\[ Exec\[ subscribe target\] \] / )
284
- expect ( msg ) . to match ( / exec\[ subscribe caller 2\] -> subscribe\[ Exec\[ subscribe target 2\] \] / )
285
- expect ( msg ) . to match ( / exec\[ subscribe caller 3\] -> 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\] \] } )
286
298
end
299
+ # rubocop:enable Metrics/LineLength
287
300
end
288
301
289
302
context 'with broken references in from-catalog' do
@@ -321,14 +334,16 @@ def self.catalog_contains_resource(result, type, title)
321
334
expect ( @result . exception ) . to be_a_kind_of ( OctocatalogDiff ::Errors ::ReferenceValidationError )
322
335
end
323
336
337
+ # rubocop:disable Metrics/LineLength
324
338
it 'should have formatted error messages from to-catalog only' do
325
339
msg = @result . exception . message
326
- expect ( msg ) . to match ( / exec\[ subscribe caller 1\] -> subscribe\[ Exec\[ subscribe target\] \] / )
327
- expect ( msg ) . to match ( / exec\[ subscribe caller 2\] -> subscribe\[ Exec\[ subscribe target\] \] / )
328
- expect ( msg ) . to match ( / exec\[ subscribe caller 2\] -> subscribe\[ Exec\[ subscribe target 2\] \] / )
329
- expect ( msg ) . to match ( / exec\[ subscribe caller 3\] -> 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\] \] } )
330
344
expect ( msg ) . not_to match ( /require target/ )
331
345
end
346
+ # rubocop:enable Metrics/LineLength
332
347
end
333
348
334
349
context 'with broken references, but checking not enabled' do
0 commit comments