diff --git a/app/test/testnode_test.go b/app/test/testnode_test.go index 4de6086527..90046dad09 100644 --- a/app/test/testnode_test.go +++ b/app/test/testnode_test.go @@ -11,8 +11,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "google.golang.org/grpc" - "google.golang.org/grpc/connectivity" - "google.golang.org/grpc/credentials/insecure" ) func Test_testnode(t *testing.T) { @@ -20,37 +18,18 @@ func Test_testnode(t *testing.T) { testnode.NewNetwork(t, testnode.DefaultConfig()) }) t.Run("testnode can start with a custom MinGasPrice", func(t *testing.T) { + want := "0.003utia" appConfig := testnode.DefaultAppConfig() - appConfig.MinGasPrices = "0.003utia" - + appConfig.MinGasPrices = want config := testnode.DefaultConfig().WithAppConfig(appConfig) - cctx, _, grpcAddr := testnode.NewNetwork(t, config) - - grpcConn := createGrpcConnection(t, cctx.GoContext(), grpcAddr) - got, err := queryMinimumGasPrice(cctx.GoContext(), grpcConn) + cctx, _, _ := testnode.NewNetwork(t, config) + got, err := queryMinimumGasPrice(cctx.GoContext(), cctx.GRPCClient) require.NoError(t, err) assert.Equal(t, float64(0.003), got) }) } -func createGrpcConnection(t *testing.T, ctx context.Context, grpcAddr string) *grpc.ClientConn { - client, err := grpc.NewClient( - grpcAddr, - grpc.WithTransportCredentials(insecure.NewCredentials()), - ) - require.NoError(t, err) - - // this ensures we can't start the node without core connection - client.Connect() - if !client.WaitForStateChange(ctx, connectivity.Ready) { - // hits the case when context is canceled - t.Fatalf("couldn't connect to core endpoint(%s): %v", grpcAddr, ctx.Err()) - } - return client -} - func queryMinimumGasPrice(ctx context.Context, grpcConn *grpc.ClientConn) (float64, error) { - cfgRsp, err := nodeservice.NewServiceClient(grpcConn).Config(ctx, &nodeservice.ConfigRequest{}) if err != nil { return 0, err