From 3404ecca793f7db6f08dd70b034db3486e32f60b Mon Sep 17 00:00:00 2001 From: Christopher Goes Date: Mon, 2 Apr 2018 19:19:38 +0200 Subject: [PATCH] Avoid race condition with viper.Set (ref #668) --- server/start_test.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/server/start_test.go b/server/start_test.go index 4934e84022..3a37de1b5c 100644 --- a/server/start_test.go +++ b/server/start_test.go @@ -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)) }