Skip to content

Commit

Permalink
core/services/ocr2/plugins/ccip: fix CLO test (#1230)
Browse files Browse the repository at this point in the history
## Motivation

We were getting this log in the CLO integration test:

```
panic: Log in goroutine after Test_CLOSpecApprovalFlow_dynamicPriceGetter has completed: 2024-07-30T12:04:28.447Z	ERROR	Feeds	[email protected]/client.go:512	failed to connect to server at http://localhost:8080, got: [wsrpc] error while dialing dial tcp: lookup http on 127.0.0.53:53: server misbehaving	{"version": "2.14.0-ccip1.4.13@dadff37"}  
```

This appears to be due to the wsrpc client trying to connect to the CLO
server when it doesn't actually exist. We set the mocked out connection
manager previously, but it happened after the RegisterManager call, when
it should be before.

## Solution

Set the connections manager of the feeds service to the mock connection
manager prior to registering the manager, since registering triggers a
connect loop which uses wsrpc and has reconnection logic.
  • Loading branch information
makramkd authored Jul 30, 2024
1 parent e0a5bc2 commit 068b3fe
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -639,14 +639,15 @@ func (c *CCIPIntegrationTestHarness) SetupFeedsManager(t *testing.T) {
PublicKey: *pkey,
}

_, err = f.RegisterManager(testutils.Context(t), m)
require.NoError(t, err)

connManager := feedsMocks.NewConnectionsManager(t)
connManager.On("Connect", mock.Anything).Maybe()
connManager.On("GetClient", mock.Anything).Maybe().Return(NoopFeedsClient{}, nil)
connManager.On("Close").Maybe().Return()
connManager.On("IsConnected", mock.Anything).Maybe().Return(true)
f.Unsafe_SetConnectionsManager(connManager)

_, err = f.RegisterManager(testutils.Context(t), m)
require.NoError(t, err)
}
}

Expand Down

0 comments on commit 068b3fe

Please sign in to comment.