@@ -324,26 +324,27 @@ def test_drep_id_is_blake2b_224_of_drep_vkey(
324324
325325 web .unpublish (url = drep_metadata_url )
326326
327- DREP_METADATA_PARAMS = (
328- {
329- "drep_metadata_file" : DATA_DIR / "drep_metadata_url.json" ,
330- "drep_metadata_url" : "https://tinyurl.com/w7vd3ek6" ,
331- "expected_hash" : "18b4b10150eab04ba66c8f9cb497ff05c6c31b9c9825388481c1790ce76b6b90" ,
332- },
333- {
334- "drep_metadata_file" : DATA_DIR / "drep_metadata_ipfs.json" ,
335- "drep_metadata_url" : "https://tinyurl.com/drep-ipfs" ,
336- "expected_hash" : "7b45535061dce55fca685fedfec6e41a195c4fe4ef812767c34505390b413ff3" ,
337- },
338- )
339-
340327 @allure .link (helpers .get_vcs_link ())
341328 @submit_utils .PARAM_SUBMIT_METHOD
342329 @common .PARAM_USE_BUILD_CMD
343330 @pytest .mark .dbsync
344331 @pytest .mark .testnets
345332 @pytest .mark .smoke
346- @pytest .mark .parametrize ("drep_metadata" , DREP_METADATA_PARAMS )
333+ @pytest .mark .parametrize (
334+ "drep_metadata" ,
335+ (
336+ {
337+ "drep_metadata_file" : DATA_DIR / "drep_metadata_url.json" ,
338+ "drep_metadata_url" : "https://tinyurl.com/w7vd3ek6" ,
339+ "expected_hash" : "18b4b10150eab04ba66c8f9cb497ff05c6c31b9c9825388481c1790ce76b6b90" ,
340+ },
341+ {
342+ "drep_metadata_file" : DATA_DIR / "drep_metadata_ipfs.json" ,
343+ "drep_metadata_url" : "https://tinyurl.com/drep-ipfs" ,
344+ "expected_hash" : "7b45535061dce55fca685fedfec6e41a195c4fe4ef812767c34505390b413ff3" ,
345+ },
346+ ),
347+ )
347348 def test_register_and_retire_drep (
348349 self ,
349350 cluster : clusterlib .ClusterLib ,
@@ -420,24 +421,32 @@ def test_register_and_retire_drep(
420421 metadata_anchor ["dataHash" ] == drep_metadata_hash == expected_hash
421422 ), "Unexpected metadata hash"
422423 assert metadata_anchor ["url" ] == drep_metadata_url , "Unexpected metadata url"
423- try :
424- _url = helpers .get_vcs_link ()
425- [r .start (url = _url ) for r in (reqc .db001 , reqc .db006 )]
426- drep_data = dbsync_utils .check_drep_registration (
427- drep = reg_drep , drep_state = reg_drep_state
428- )
429- [r .success () for r in (reqc .db001 , reqc .db006 )]
430424
431- def _query_func ():
432- dbsync_utils .check_off_chain_drep_registration (
433- drep_data = drep_data , metadata = drep_metadata_content
425+ if configuration .HAS_DBSYNC :
426+ try :
427+ _url = helpers .get_vcs_link ()
428+ [r .start (url = _url ) for r in (reqc .db001 , reqc .db006 )]
429+ drep_data = dbsync_utils .check_drep_registration (
430+ drep = reg_drep , drep_state = reg_drep_state
434431 )
432+ [r .success () for r in (reqc .db001 , reqc .db006 )]
435433
436- dbsync_utils .retry_query (query_func = _query_func , timeout = 360 )
434+ # The same metadata is used for all the parametrized tests. Therefore the data will
435+ # be present in db-sync once the first parametrized test runs. Therefore it doesn't
436+ # make sense to check the metadata for all combinations of parameters.
437+ if use_build_cmd and submit_method == "cli" :
438+
439+ def _query_func ():
440+ dbsync_utils .check_off_chain_drep_registration (
441+ drep_data = drep_data , metadata = drep_metadata_content
442+ )
443+
444+ dbsync_utils .retry_query (query_func = _query_func , timeout = 360 )
445+
446+ except AssertionError as exc :
447+ str_exc = str (exc )
448+ errors_final .append (f"DB-Sync unexpected DRep registration error: { str_exc } " )
437449
438- except AssertionError as exc :
439- str_exc = str (exc )
440- errors_final .append (f"DB-Sync unexpected DRep registration error: { str_exc } " )
441450 reqc .cli012 .success ()
442451
443452 # Retire DRep
@@ -480,11 +489,13 @@ def _query_func():
480489 - tx_output_ret .fee
481490 + reg_drep .deposit
482491 ), f"Incorrect balance for source address `{ payment_addr .address } `"
492+
483493 try :
484494 dbsync_utils .check_drep_deregistration (drep = reg_drep )
485495 except AssertionError as exc :
486496 str_exc = str (exc )
487497 errors_final .append (f"DB-Sync unexpected DRep deregistration error: { str_exc } " )
498+
488499 if errors_final :
489500 raise AssertionError ("\n " .join (errors_final ))
490501
0 commit comments