Skip to content

Commit

Permalink
[CCIP-3376] tests
Browse files Browse the repository at this point in the history
  • Loading branch information
valerii-kabisov-cll committed Sep 20, 2024
1 parent 5fe2674 commit 34f06f9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
15 changes: 15 additions & 0 deletions core/services/ocr2/plugins/ccip/estimatorconfig/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,19 @@ func TestModifyGasPriceComponents(t *testing.T) {
_, _, err := svc.ModifyGasPriceComponents(ctx, initialExecGasPrice, initialDaGasPrice)
require.Error(t, err)
})

t.Run("without interceptors", func(t *testing.T) {
svc := estimatorconfig.NewFeeEstimatorConfigService()
ctx := context.Background()

initialExecGasPrice, initialDaGasPrice := big.NewInt(10), big.NewInt(1)

// has to return second interceptor values
resGasPrice, resDAGasPrice, err := svc.ModifyGasPriceComponents(ctx, initialExecGasPrice, initialDaGasPrice)
require.NoError(t, err)

// values should not be modified
require.Equal(t, initialExecGasPrice, resGasPrice)
require.Equal(t, initialDaGasPrice, resDAGasPrice)
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,16 @@ func TestCommitStoreReaders(t *testing.T) {
require.NoError(t, err)
assert.Equal(t, commonOffchain, c2)
// We should be able to query for gas prices now.

var execGasPrice, daGasPrice *big.Int
feeEstimatorConfig.On("ModifyGasPriceComponents", mock.Anything, mock.Anything, mock.Anything).Run(func(args mock.Arguments) {
execGasPrice = args.Get(0).(*big.Int)
daGasPrice = args.Get(1).(*big.Int)
}).Return(execGasPrice, daGasPrice, nil).Maybe()

gpe, err := cr.GasPriceEstimator(ctx)
require.NoError(t, err)

gp, err := gpe.GetGasPrice(context.Background())
require.NoError(t, err)
assert.True(t, gp.Cmp(big.NewInt(0)) > 0)
Expand Down

0 comments on commit 34f06f9

Please sign in to comment.