File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -499,14 +499,20 @@ def test_requirement_links(self):
499
499
status ['message' ] = f"invalid link relation { link ['rel' ]} "
500
500
return status
501
501
502
- LOGGER .debug ('Checking that Pub/Sub links have a channel' )
502
+ LOGGER .debug ('Checking that Pub/Sub links have a valid channel' )
503
503
if link ['href' ].startswith ('mqtt' ):
504
504
if 'channel' not in link :
505
505
status ['code' ] = 'FAILED'
506
506
status ['message' ] = 'missing channel for Pub/Sub link'
507
507
return status
508
508
509
509
if link ['channel' ].startswith (('origin/a/wis2' , 'cache/a/wis2' )): # noqa
510
+ centre_id = link ['channel' ].split ('/' )[3 ]
511
+ if centre_id not in self .th .topics [3 ]:
512
+ status ['code' ] = 'FAILED'
513
+ status ['message' ] = 'Invalid WIS2 topic (bad centre-id) for Pub/Sub link channel' # noqa
514
+ return status
515
+
510
516
LOGGER .debug ('Validating topic in link channel' )
511
517
if not self .th .validate (link ['channel' ]):
512
518
status ['code' ] = 'FAILED'
Original file line number Diff line number Diff line change @@ -234,6 +234,23 @@ def test_fail_invalid_geometry_range(self):
234
234
self .assertEqual (codes .count ('PASSED' ), 11 )
235
235
self .assertEqual (codes .count ('SKIPPED' ), 0 )
236
236
237
+ def test_fail_invalid_link_channel_centre_id (self ):
238
+ """
239
+ Simple tests for a failing record with an invalid
240
+ centre-id in a link channel
241
+ """
242
+
243
+ with open (get_test_file_path ('data/wcmp2-failing-invalid-link-channel-centre-id.json' )) as fh : # noqa
244
+ record = json .load (fh )
245
+ ts = WMOCoreMetadataProfileTestSuite2 (record )
246
+ results = ts .run_tests ()
247
+
248
+ codes = [r ['code' ] for r in results ['tests' ]]
249
+
250
+ self .assertEqual (codes .count ('FAILED' ), 1 )
251
+ self .assertEqual (codes .count ('PASSED' ), 11 )
252
+ self .assertEqual (codes .count ('SKIPPED' ), 0 )
253
+
237
254
238
255
class WCMP2KPITest (unittest .TestCase ):
239
256
"""WCMP KPI tests of tests"""
You can’t perform that action at this time.
0 commit comments