diff --git a/tests/integration/cli/utils.go b/tests/integration/cli/utils.go index aba0f8dc88..236129fec9 100644 --- a/tests/integration/cli/utils.go +++ b/tests/integration/cli/utils.go @@ -85,14 +85,17 @@ func runDefraNode(t *testing.T, conf DefraNodeConfig) func() []string { cfg := config.DefaultConfig() ctx, cancel := context.WithCancel(context.Background()) - go func() { + ready := make(chan struct{}) + go func(ready chan struct{}) { defraCmd := cli.NewDefraCommand(cfg) defraCmd.RootCmd.SetArgs( append([]string{"start"}, args...), ) + ready <- struct{}{} err := defraCmd.Execute(ctx) assert.NoError(t, err) - }() + }(ready) + <-ready time.Sleep(1 * time.Second) // time buffer for it to start cancelAndOutput := func() []string { cancel() @@ -112,7 +115,7 @@ func runDefraCommand(t *testing.T, conf DefraNodeConfig, args []string) (stdout, "--url", conf.APIURL, }, args...) if !contains(args, "--rootdir") { - args = append(args, "--rootdir", t.TempDir()) + args = append(args, "--rootdir", conf.rootDir) } ctx, cancel := context.WithTimeout(context.Background(), COMMAND_TIMEOUT_SECONDS*time.Second)