-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
30076f3
commit b877f2a
Showing
16 changed files
with
171 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
core/services/ocr2/plugins/ccip/internal/ccipdata/commit_store_reader_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package ccipdata | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/ethereum/go-ethereum/common" | ||
"github.com/stretchr/testify/mock" | ||
"github.com/stretchr/testify/require" | ||
|
||
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/client/mocks" | ||
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller" | ||
lpmocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller/mocks" | ||
"github.com/smartcontractkit/chainlink/v2/core/logger" | ||
) | ||
|
||
func assertFilterRegistration(t *testing.T, lp *lpmocks.LogPoller, buildCloser func(lp *lpmocks.LogPoller, addr common.Address) Closer, numFilter int) { | ||
// Expected filter properties for a closer: | ||
// - Should be the same filter set registered that is unregistered | ||
// - Should be registered to the address specified | ||
// - Number of events specific to this component should be registered | ||
addr := common.HexToAddress("0x1234") | ||
var filters []logpoller.Filter | ||
lp.On("RegisterFilter", mock.Anything).Run(func(args mock.Arguments) { | ||
f := args.Get(0).(logpoller.Filter) | ||
require.Equal(t, len(f.Addresses), 1) | ||
require.Equal(t, f.Addresses[0], addr) | ||
filters = append(filters, f) | ||
}).Return(nil).Times(numFilter) | ||
c := buildCloser(lp, addr) | ||
for _, filter := range filters { | ||
lp.On("UnregisterFilter", filter.Name).Return(nil) | ||
} | ||
require.NoError(t, c.Close()) | ||
lp.AssertExpectations(t) | ||
} | ||
|
||
func TestCommitFilters(t *testing.T) { | ||
assertFilterRegistration(t, new(lpmocks.LogPoller), func(lp *lpmocks.LogPoller, addr common.Address) Closer { | ||
c, err := NewCommitStoreV1_0_0(logger.TestLogger(t), addr, new(mocks.Client), lp, nil) | ||
require.NoError(t, err) | ||
return c | ||
}, 1) | ||
assertFilterRegistration(t, new(lpmocks.LogPoller), func(lp *lpmocks.LogPoller, addr common.Address) Closer { | ||
c, err := NewCommitStoreV1_2_0(logger.TestLogger(t), addr, new(mocks.Client), lp, nil) | ||
require.NoError(t, err) | ||
return c | ||
}, 1) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
core/services/ocr2/plugins/ccip/internal/ccipdata/offramp_reader_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package ccipdata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.