Skip to content

Commit

Permalink
Merge f27ea86 into a573364
Browse files Browse the repository at this point in the history
  • Loading branch information
nolouch committed Dec 27, 2018
2 parents a573364 + f27ea86 commit 032f5d9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tests/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package tests
import (
"context"
"os"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -293,7 +294,18 @@ func NewTestCluster(initialServerCount int, opts ...ConfigOption) (*TestCluster,
// RunServer starts to run TestServer.
func (c *TestCluster) RunServer(ctx context.Context, server *TestServer) <-chan error {
resC := make(chan error)
go func() { resC <- server.Run(ctx) }()
go func() {
for i := 0; i < 10; i++ {
err := server.Run(ctx)
// retryable error
if err != nil && strings.Contains(err.Error(), "address already in use") {
time.Sleep(time.Second)
continue
}
resC <- err
return
}
}()
return resC
}

Expand Down

0 comments on commit 032f5d9

Please sign in to comment.