@@ -13,6 +13,7 @@ use graph::{
1313 prelude:: SubgraphManifest ,
1414 prelude:: SubgraphName ,
1515 prelude:: SubgraphVersionSwitchingMode ,
16+ prelude:: UnfailOutcome ,
1617 prelude:: { futures03, StoreEvent } ,
1718 prelude:: { CheapClone , DeploymentHash , NodeId , SubgraphStore as _} ,
1819 semver:: Version ,
@@ -630,11 +631,12 @@ fn fail_unfail_deterministic_error() {
630631 assert_eq ! ( Some ( 1 ) , vi. latest_ethereum_block_number) ;
631632
632633 // Unfail the subgraph.
633- writable
634+ let outcome = writable
634635 . unfail_deterministic_error ( & BLOCKS [ 1 ] , & BLOCKS [ 0 ] )
635636 . unwrap ( ) ;
636637
637638 // We don't have fatal errors anymore and the block got reverted.
639+ assert_eq ! ( outcome, UnfailOutcome :: Unfailed ) ;
638640 assert ! ( !query_store. has_non_fatal_errors( None ) . await . unwrap( ) ) ;
639641 let vi = get_version_info ( & store, NAME ) ;
640642 assert_eq ! ( & * NAME , vi. deployment_id. as_str( ) ) ;
@@ -702,11 +704,12 @@ fn fail_unfail_deterministic_error_noop() {
702704 . expect ( "can get writable" ) ;
703705
704706 // Run unfail with no errors results in NOOP.
705- writable
707+ let outcome = writable
706708 . unfail_deterministic_error ( & BLOCKS [ 1 ] , & BLOCKS [ 0 ] )
707709 . unwrap ( ) ;
708710
709711 // Nothing to unfail, state continues the same.
712+ assert_eq ! ( outcome, UnfailOutcome :: Noop ) ;
710713 assert_eq ! ( count( ) , 0 ) ;
711714 let vi = get_version_info ( & store, NAME ) ;
712715 assert_eq ! ( & * NAME , vi. deployment_id. as_str( ) ) ;
@@ -732,12 +735,13 @@ fn fail_unfail_deterministic_error_noop() {
732735 assert_eq ! ( Some ( 1 ) , vi. latest_ethereum_block_number) ;
733736
734737 // Running unfail_deterministic_error against a NON-deterministic error will do nothing.
735- writable
738+ let outcome = writable
736739 . unfail_deterministic_error ( & BLOCKS [ 1 ] , & BLOCKS [ 0 ] )
737740 . unwrap ( ) ;
738741
739742 // State continues the same, nothing happened.
740743 // Neither the block got reverted or error deleted.
744+ assert_eq ! ( outcome, UnfailOutcome :: Noop ) ;
741745 assert_eq ! ( count( ) , 1 ) ;
742746 let vi = get_version_info ( & store, NAME ) ;
743747 assert_eq ! ( & * NAME , vi. deployment_id. as_str( ) ) ;
@@ -757,12 +761,13 @@ fn fail_unfail_deterministic_error_noop() {
757761
758762 // Running unfail_deterministic_error won't do anything,
759763 // the hashes won't match and there's nothing to revert.
760- writable
764+ let outcome = writable
761765 . unfail_deterministic_error ( & BLOCKS [ 1 ] , & BLOCKS [ 0 ] )
762766 . unwrap ( ) ;
763767
764768 // State continues the same.
765769 // Neither the block got reverted or error deleted.
770+ assert_eq ! ( outcome, UnfailOutcome :: Noop ) ;
766771 assert_eq ! ( count( ) , 2 ) ;
767772 let vi = get_version_info ( & store, NAME ) ;
768773 assert_eq ! ( & * NAME , vi. deployment_id. as_str( ) ) ;
@@ -848,9 +853,10 @@ fn fail_unfail_non_deterministic_error() {
848853 assert_eq ! ( Some ( 1 ) , vi. latest_ethereum_block_number) ;
849854
850855 // Unfail the subgraph and delete the fatal error.
851- writable. unfail_non_deterministic_error ( & BLOCKS [ 1 ] ) . unwrap ( ) ;
856+ let outcome = writable. unfail_non_deterministic_error ( & BLOCKS [ 1 ] ) . unwrap ( ) ;
852857
853858 // We don't have fatal errors anymore and the subgraph is healthy.
859+ assert_eq ! ( outcome, UnfailOutcome :: Unfailed ) ;
854860 assert_eq ! ( count( ) , 0 ) ;
855861 let vi = get_version_info ( & store, NAME ) ;
856862 assert_eq ! ( & * NAME , vi. deployment_id. as_str( ) ) ;
@@ -918,9 +924,10 @@ fn fail_unfail_non_deterministic_error_noop() {
918924 . expect ( "can get writable" ) ;
919925
920926 // Running unfail without any errors will do nothing.
921- writable. unfail_non_deterministic_error ( & BLOCKS [ 1 ] ) . unwrap ( ) ;
927+ let outcome = writable. unfail_non_deterministic_error ( & BLOCKS [ 1 ] ) . unwrap ( ) ;
922928
923929 // State continues the same, nothing happened.
930+ assert_eq ! ( outcome, UnfailOutcome :: Noop ) ;
924931 assert_eq ! ( count( ) , 0 ) ;
925932 let vi = get_version_info ( & store, NAME ) ;
926933 assert_eq ! ( & * NAME , vi. deployment_id. as_str( ) ) ;
@@ -946,9 +953,10 @@ fn fail_unfail_non_deterministic_error_noop() {
946953 assert_eq ! ( Some ( 1 ) , vi. latest_ethereum_block_number) ;
947954
948955 // Running unfail_non_deterministic_error will be NOOP, the error is deterministic.
949- writable. unfail_non_deterministic_error ( & BLOCKS [ 1 ] ) . unwrap ( ) ;
956+ let outcome = writable. unfail_non_deterministic_error ( & BLOCKS [ 1 ] ) . unwrap ( ) ;
950957
951958 // Nothing happeened, state continues the same.
959+ assert_eq ! ( outcome, UnfailOutcome :: Noop ) ;
952960 assert_eq ! ( count( ) , 1 ) ;
953961 let vi = get_version_info ( & store, NAME ) ;
954962 assert_eq ! ( & * NAME , vi. deployment_id. as_str( ) ) ;
@@ -967,9 +975,10 @@ fn fail_unfail_non_deterministic_error_noop() {
967975 writable. fail_subgraph ( error) . await . unwrap ( ) ;
968976
969977 // Since the block range of the block won't match the deployment head, this will be NOOP.
970- writable. unfail_non_deterministic_error ( & BLOCKS [ 1 ] ) . unwrap ( ) ;
978+ let outcome = writable. unfail_non_deterministic_error ( & BLOCKS [ 1 ] ) . unwrap ( ) ;
971979
972980 // State continues the same besides a new error added to the database.
981+ assert_eq ! ( outcome, UnfailOutcome :: Noop ) ;
973982 assert_eq ! ( count( ) , 2 ) ;
974983 let vi = get_version_info ( & store, NAME ) ;
975984 assert_eq ! ( & * NAME , vi. deployment_id. as_str( ) ) ;
0 commit comments