fix(simapp/v2): panic with testnet init-files command (#21012)
This commit is contained in:
parent
d2dc3eed29
commit
f9f2ad7fa9
@ -7,11 +7,11 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"cosmossdk.io/core/transaction"
|
||||
svrcmd "cosmossdk.io/server/v2"
|
||||
"cosmossdk.io/simapp/v2"
|
||||
"cosmossdk.io/simapp/v2/simdv2/cmd"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
|
||||
"github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
|
||||
)
|
||||
|
||||
|
||||
@ -198,7 +198,7 @@ func initTestnetFiles[T transaction.Tx](
|
||||
// generate private keys, node IDs, and initial transactions
|
||||
for i := 0; i < args.numValidators; i++ {
|
||||
var portOffset int
|
||||
var grpcConfig *grpc.Config
|
||||
grpcConfig := grpc.DefaultConfig()
|
||||
if args.singleMachine {
|
||||
portOffset = i
|
||||
p2pPortStart = 16656 // use different start point to not conflict with rpc port
|
||||
|
||||
27
simapp/v2/simdv2/cmd/testnet_test.go
Normal file
27
simapp/v2/simdv2/cmd/testnet_test.go
Normal file
@ -0,0 +1,27 @@
|
||||
package cmd_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"cosmossdk.io/core/transaction"
|
||||
svrcmd "cosmossdk.io/server/v2"
|
||||
"cosmossdk.io/simapp/v2"
|
||||
"cosmossdk.io/simapp/v2/simdv2/cmd"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keyring"
|
||||
)
|
||||
|
||||
func TestInitTestFilesCmd(t *testing.T) {
|
||||
rootCmd := cmd.NewRootCmd[transaction.Tx]()
|
||||
rootCmd.SetArgs([]string{
|
||||
"testnet", // Test the testnet init-files command
|
||||
"init-files",
|
||||
fmt.Sprintf("--%s=%s", flags.FlagKeyringBackend, keyring.BackendTest), // Set keyring-backend to test
|
||||
})
|
||||
|
||||
require.NoError(t, svrcmd.Execute(rootCmd, "", simapp.DefaultNodeHome))
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user