Skip to content

Commit

Permalink
core/services/ocr2/plugins/mercury: fix integration test race on shar…
Browse files Browse the repository at this point in the history
…ed error (#13555)
  • Loading branch information
jmank88 authored Jun 17, 2024
1 parent 0d4a3b2 commit 95f3e7b
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions core/services/ocr2/plugins/mercury/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,17 @@ func integration_MercuryV1(t *testing.T) {
bootstrapNode := Node{App: appBootstrap, KeyBundle: bootstrapKb}
logObservers = append(logObservers, observedLogs)

// Commit blocks to finality depth to ensure LogPoller has finalized blocks to read from
ch, err := bootstrapNode.App.GetRelayers().LegacyEVMChains().Get(testutils.SimulatedChainID.String())
require.NoError(t, err)
finalityDepth := ch.Config().EVM().FinalityDepth()
for i := 0; i < int(finalityDepth); i++ {
backend.Commit()
}

fromBlock := int(finalityDepth) // cannot use zero, start from finality depth
// cannot use zero, start from finality depth
fromBlock := func() int {
// Commit blocks to finality depth to ensure LogPoller has finalized blocks to read from
ch, err := bootstrapNode.App.GetRelayers().LegacyEVMChains().Get(testutils.SimulatedChainID.String())
require.NoError(t, err)
finalityDepth := ch.Config().EVM().FinalityDepth()
for i := 0; i < int(finalityDepth); i++ {
backend.Commit()
}
return int(finalityDepth)
}()

// Set up n oracles
var (
Expand Down Expand Up @@ -225,8 +227,7 @@ func integration_MercuryV1(t *testing.T) {

createBridge := func(name string, i int, p *big.Int, borm bridges.ORM) (bridgeName string) {
bridge := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
var b []byte
b, err = io.ReadAll(req.Body)
b, err := io.ReadAll(req.Body)
require.NoError(t, err)
require.Equal(t, `{"data":{"from":"ETH","to":"USD"}}`, string(b))

Expand Down

0 comments on commit 95f3e7b

Please sign in to comment.