mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-09 20:37:52 +00:00
add retry to MustRunCluster
This commit is contained in:
parent
bc13834343
commit
f2234929d8
1 changed files with 15 additions and 3 deletions
|
|
@ -414,11 +414,23 @@ func newCluster(tb testing.TB, size int, opts ...[]server.CommandOption) (*Clust
|
|||
// MustRunCluster creates and starts a new cluster. The opts parameter
|
||||
// is slightly magical; see MustNewCluster.
|
||||
func MustRunCluster(tb testing.TB, size int, opts ...[]server.CommandOption) *Cluster {
|
||||
cluster := MustNewCluster(tb, size, opts...)
|
||||
if err := cluster.Start(); err != nil {
|
||||
var tries int = 5
|
||||
var cluster *Cluster
|
||||
var err error
|
||||
|
||||
for i := 0; i < tries; i++ {
|
||||
if i > 0 {
|
||||
fmt.Printf("--- try starting cluster again: %d\n", i)
|
||||
}
|
||||
cluster = MustNewCluster(tb, size, opts...)
|
||||
if err = cluster.Start(); err == nil {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
tb.Fatalf("run cluster: %v", err)
|
||||
}
|
||||
fmt.Printf("done with AwaitState\n")
|
||||
return cluster
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue