@@ -90,6 +90,14 @@ func TestCCIPChainReader_getSourceChainsConfig(t *testing.T) {
9090 }, nil , chainC , offrampAddress , mockAddrCodec ,
9191 )
9292
93+ // Add cleanup to ensure resources are released
94+ t .Cleanup (func () {
95+ err := ccipReader .Close ()
96+ if err != nil {
97+ t .Logf ("Error closing ccipReader: %v" , err )
98+ }
99+ })
100+
93101 addrStr , err := mockAddrCodec .AddressBytesToString (offrampAddress , 111_111 )
94102 require .NoError (t , err )
95103
@@ -814,6 +822,14 @@ func TestCCIPChainReader_getFeeQuoterTokenPriceUSD(t *testing.T) {
814822 }, nil , chainC , offrampAddress , mockAddrCodec ,
815823 )
816824
825+ // Add cleanup to properly shut down the background polling
826+ t .Cleanup (func () {
827+ err := ccipReader .Close ()
828+ if err != nil {
829+ t .Logf ("Error closing ccipReader: %v" , err )
830+ }
831+ })
832+
817833 feeQuoterAddressStr , err := mockAddrCodec .AddressBytesToString (feeQuoterAddress , 111_111 )
818834 require .NoError (t , err )
819835 require .NoError (t , ccipReader .contractReaders [chainC ].Bind (
@@ -850,6 +866,14 @@ func TestCCIPFeeComponents_HappyPath(t *testing.T) {
850866 internal .NewMockAddressCodecHex (t ),
851867 )
852868
869+ // Add cleanup to ensure resources are released
870+ t .Cleanup (func () {
871+ err := ccipReader .Close ()
872+ if err != nil {
873+ t .Logf ("Error closing ccipReader: %v" , err )
874+ }
875+ })
876+
853877 ctx := context .Background ()
854878 feeComponents := ccipReader .GetChainsFeeComponents (ctx , []cciptypes.ChainSelector {chainA , chainB , chainC })
855879 assert .Len (t , feeComponents , 2 )
@@ -879,6 +903,14 @@ func TestCCIPFeeComponents_NotFoundErrors(t *testing.T) {
879903 internal .NewMockAddressCodecHex (t ),
880904 )
881905
906+ // Add cleanup to ensure resources are released
907+ t .Cleanup (func () {
908+ err := ccipReader .Close ()
909+ if err != nil {
910+ t .Logf ("Error closing ccipReader: %v" , err )
911+ }
912+ })
913+
882914 ctx := context .Background ()
883915 _ , err := ccipReader .GetDestChainFeeComponents (ctx )
884916 require .Error (t , err )
@@ -1532,13 +1564,6 @@ func (m *mockConfigCache) GetChainConfig(
15321564 return args .Get (0 ).(ChainConfigSnapshot ), args .Error (1 )
15331565}
15341566
1535- func (m * mockConfigCache ) RefreshChainConfig (
1536- ctx context.Context ,
1537- chainSel cciptypes.ChainSelector ) (ChainConfigSnapshot , error ) {
1538- args := m .Called (ctx , chainSel )
1539- return args .Get (0 ).(ChainConfigSnapshot ), args .Error (1 )
1540- }
1541-
15421567func (m * mockConfigCache ) GetOfframpSourceChainConfigs (
15431568 ctx context.Context ,
15441569 destChain cciptypes.ChainSelector ,
@@ -1547,10 +1572,26 @@ func (m *mockConfigCache) GetOfframpSourceChainConfigs(
15471572 return args .Get (0 ).(map [cciptypes.ChainSelector ]StaticSourceChainConfig ), args .Error (1 )
15481573}
15491574
1550- func (m * mockConfigCache ) RefreshSourceChainConfigs (
1551- ctx context.Context ,
1552- destChain cciptypes.ChainSelector ,
1553- sourceChains []cciptypes.ChainSelector ) (map [cciptypes.ChainSelector ]StaticSourceChainConfig , error ) {
1554- args := m .Called (ctx , destChain , sourceChains )
1555- return args .Get (0 ).(map [cciptypes.ChainSelector ]StaticSourceChainConfig ), args .Error (1 )
1575+ // Update Start method to accept context parameter
1576+ func (m * mockConfigCache ) Start (ctx context.Context ) error {
1577+ return m .Called (ctx ).Error (0 )
1578+ }
1579+
1580+ func (m * mockConfigCache ) Close () error {
1581+ return m .Called ().Error (0 )
1582+ }
1583+
1584+ // Implement HealthReport method for services.Service interface
1585+ func (m * mockConfigCache ) HealthReport () map [string ]error {
1586+ args := m .Called ()
1587+ return args .Get (0 ).(map [string ]error )
1588+ }
1589+
1590+ // Implement Name method for the Service interface
1591+ func (m * mockConfigCache ) Name () string {
1592+ return m .Called ().String (0 )
1593+ }
1594+
1595+ func (m * mockConfigCache ) Ready () error {
1596+ return m .Called ().Error (0 )
15561597}
0 commit comments