diff --git a/app/app_test.go b/app/app_test.go index babb908f..026bbec3 100644 --- a/app/app_test.go +++ b/app/app_test.go @@ -320,8 +320,16 @@ func assertServerHealth(ctx context.Context, t *testing.T, opts sdkclient.Option t.Error(clientErr) } - if _, err := c.CheckHealth(ctx, nil); err != nil { - t.Error(err) + // Give the server 1 second to become healthy. + for i := 0; i < 10; i++ { + _, clientErr = c.CheckHealth(ctx, nil) + if clientErr == nil { + break + } + time.Sleep(100 * time.Millisecond) + } + if clientErr != nil { + t.Error(clientErr) } // Check for pollers on a system task queue to ensure that the worker service is running. diff --git a/server/commands.go b/server/commands.go index 5a1d45f4..9c20de4e 100644 --- a/server/commands.go +++ b/server/commands.go @@ -337,6 +337,7 @@ func NewServerCommands(defaultCfg *sconfig.Config) []*cli.Command { if err := s.Start(); err != nil { return cli.Exit(fmt.Sprintf("Unable to start server. Error: %v", err), 1) } + s.Stop() return cli.Exit("All services are stopped.", 0) }, },