Merge pull request #10062 from filecoin-project/iand/issue-9849-config

itests: verify eth filter api is disabled via config
This commit is contained in:
Geoff Stuart 2023-02-01 22:25:21 -05:00 committed by GitHub
commit b8c4fbaff0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 67 additions and 0 deletions

View File

@ -623,6 +623,11 @@ workflows:
suite: itest-eth_block_hash
target: "./itests/eth_block_hash_test.go"
- test:
name: test-itest-eth_config
suite: itest-eth_config
target: "./itests/eth_config_test.go"
- test:
name: test-itest-eth_deploy
suite: itest-eth_deploy

62
itests/eth_config_test.go Normal file
View File

@ -0,0 +1,62 @@
// stm: #integration
package itests
import (
"context"
"testing"
"github.com/stretchr/testify/require"
"github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/types/ethtypes"
"github.com/filecoin-project/lotus/itests/kit"
)
func TestEthFilterAPIDisabledViaConfig(t *testing.T) {
ctx := context.Background()
kit.QuietMiningLogs()
// pass kit.DisableEthRPC() so RealTimeFilterAPI will not be enabled
client, _, _ := kit.EnsembleMinimal(t, kit.MockProofs(), kit.ThroughRPC(), kit.DisableEthRPC())
_, err := client.EthNewPendingTransactionFilter(ctx)
require.NotNil(t, err)
require.Equal(t, err.Error(), api.ErrNotSupported.Error())
_, err = client.EthGetLogs(ctx, &ethtypes.EthFilterSpec{})
require.NotNil(t, err)
require.Equal(t, err.Error(), api.ErrNotSupported.Error())
_, err = client.EthGetFilterChanges(ctx, ethtypes.EthFilterID{})
require.NotNil(t, err)
require.Equal(t, err.Error(), api.ErrNotSupported.Error())
_, err = client.EthGetFilterLogs(ctx, ethtypes.EthFilterID{})
require.NotNil(t, err)
require.Equal(t, err.Error(), api.ErrNotSupported.Error())
_, err = client.EthNewFilter(ctx, &ethtypes.EthFilterSpec{})
require.NotNil(t, err)
require.Equal(t, err.Error(), api.ErrNotSupported.Error())
_, err = client.EthNewBlockFilter(ctx)
require.NotNil(t, err)
require.Equal(t, err.Error(), api.ErrNotSupported.Error())
_, err = client.EthNewPendingTransactionFilter(ctx)
require.NotNil(t, err)
require.Equal(t, err.Error(), api.ErrNotSupported.Error())
_, err = client.EthUninstallFilter(ctx, ethtypes.EthFilterID{})
require.NotNil(t, err)
require.Equal(t, err.Error(), api.ErrNotSupported.Error())
_, err = client.EthSubscribe(ctx, "newHeads", nil)
require.NotNil(t, err)
require.Equal(t, err.Error(), api.ErrNotSupported.Error())
_, err = client.EthUnsubscribe(ctx, ethtypes.EthSubscriptionID{})
require.NotNil(t, err)
require.Equal(t, err.Error(), api.ErrNotSupported.Error())
}