Avoid race condition with viper.Set (ref #668)

This commit is contained in:
Christopher Goes 2018-04-02 19:19:38 +02:00
parent fb3572c445
commit 3404ecca79
No known key found for this signature in database
GPG Key ID: E828D98232D328D3
1 changed files with 4 additions and 8 deletions

View File

@ -25,9 +25,9 @@ func TestStartStandAlone(t *testing.T) {
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
timeout := time.Duration(10) * time.Second
RunOrTimeout(startCmd, timeout, t)
close(RunOrTimeout(startCmd, timeout, t))
}
func TestStartWithTendermint(t *testing.T) {
@ -35,7 +35,6 @@ func TestStartWithTendermint(t *testing.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)
@ -44,10 +43,7 @@ func TestStartWithTendermint(t *testing.T) {
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
timeout := time.Duration(10) * time.Second
//a, _ := startCmd.Flags().GetString(flagAddress)
//panic(a)
RunOrTimeout(startCmd, timeout, t)
close(RunOrTimeout(startCmd, timeout, t))
}