-
Notifications
You must be signed in to change notification settings - Fork 351
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(testnode): configure custom min gas price and fix chain id (#3689)
Context: celestiaorg/celestia-node#3453 (comment) Fix testnode so that it is possible to query the local min gas price again. I plan on backporting this to v2.x to fix celestia-node integration tests which query local min gas price.<hr>This is an automatic backport of pull request #3680 done by [Mergify](https://mergify.com). --------- Co-authored-by: Rootul P <[email protected]>
- Loading branch information
1 parent
be6b40b
commit 43a360e
Showing
4 changed files
with
108 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package app_test | ||
|
||
import ( | ||
"testing" | ||
|
||
v2 "github.com/celestiaorg/celestia-app/v2/pkg/appconsts/v2" | ||
"github.com/celestiaorg/celestia-app/v2/test/util/testnode" | ||
"github.com/celestiaorg/celestia-app/v2/x/minfee" | ||
nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node" | ||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func Test_testnode(t *testing.T) { | ||
t.Run("testnode can start a network with default chain ID", func(t *testing.T) { | ||
testnode.NewNetwork(t, testnode.DefaultConfig()) | ||
}) | ||
t.Run("testnode can start a network with a custom chain ID", func(t *testing.T) { | ||
chainID := "custom-chain-id" | ||
config := testnode.DefaultConfig().WithChainID(chainID) | ||
testnode.NewNetwork(t, config) | ||
}) | ||
t.Run("testnode can query network min gas price", func(t *testing.T) { | ||
config := testnode.DefaultConfig() | ||
cctx, _, _ := testnode.NewNetwork(t, config) | ||
|
||
queryClient := minfee.NewQueryClient(cctx.GRPCClient) | ||
resp, err := queryClient.NetworkMinGasPrice(cctx.GoContext(), &minfee.QueryNetworkMinGasPrice{}) | ||
require.NoError(t, err) | ||
got, err := resp.NetworkMinGasPrice.Float64() | ||
require.NoError(t, err) | ||
assert.Equal(t, v2.NetworkMinGasPrice, got) | ||
}) | ||
t.Run("testnode can query local min gas price", func(t *testing.T) { | ||
config := testnode.DefaultConfig() | ||
cctx, _, _ := testnode.NewNetwork(t, config) | ||
|
||
serviceClient := nodeservice.NewServiceClient(cctx.GRPCClient) | ||
resp, err := serviceClient.Config(cctx.GoContext(), &nodeservice.ConfigRequest{}) | ||
require.NoError(t, err) | ||
want := "0.002000000000000000utia" | ||
assert.Equal(t, want, resp.MinimumGasPrice) | ||
}) | ||
} |
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