56 lines
1.3 KiB
Go
56 lines
1.3 KiB
Go
package server
|
|
|
|
import (
|
|
// "os"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/spf13/viper"
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/cosmos/cosmos-sdk/mock"
|
|
"github.com/tendermint/tmlibs/log"
|
|
)
|
|
|
|
func TestStartStandAlone(t *testing.T) {
|
|
defer setupViper(t)()
|
|
|
|
logger := log.NewNopLogger()
|
|
initCmd := InitCmd(mock.GenInitOptions, logger)
|
|
err := initCmd.RunE(nil, nil)
|
|
require.NoError(t, err)
|
|
|
|
// set up app and start up
|
|
viper.Set(flagWithTendermint, false)
|
|
viper.Set(flagAddress, "localhost:11122")
|
|
startCmd := StartCmd(mock.NewApp, logger)
|
|
startCmd.Flags().Set(flagAddress, FreeTCPAddr(t)) // set to a new free address
|
|
timeout := time.Duration(3) * time.Second
|
|
|
|
RunOrTimeout(startCmd, timeout, t)
|
|
}
|
|
|
|
/*
|
|
func TestStartWithTendermint(t *testing.T) {
|
|
defer setupViper(t)()
|
|
|
|
logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout)).
|
|
With("module", "mock-cmd")
|
|
// logger := log.NewNopLogger()
|
|
initCmd := InitCmd(mock.GenInitOptions, logger)
|
|
err := initCmd.RunE(nil, nil)
|
|
require.NoError(t, err)
|
|
|
|
// set up app and start up
|
|
viper.Set(flagWithTendermint, true)
|
|
startCmd := StartCmd(mock.NewApp, logger)
|
|
startCmd.Flags().Set(flagAddress, FreeTCPAddr(t)) // set to a new free address
|
|
timeout := time.Duration(3) * time.Second
|
|
|
|
//a, _ := startCmd.Flags().GetString(flagAddress)
|
|
//panic(a)
|
|
|
|
RunOrTimeout(startCmd, timeout, t)
|
|
}
|
|
*/
|