Skip to content

Commit

Permalink
test: wait for queue cluster
Browse files Browse the repository at this point in the history
We need to wait for a successful role cluster configuration because
an instance bootstrap may haven't finished yet.

Part of #291
  • Loading branch information
oleg-jukovec committed May 18, 2023
1 parent 38f635b commit 0593018
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions queue/queue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -938,13 +938,22 @@ func runTestMain(m *testing.M) int {

defer test_helpers.StopTarantoolInstances(instances)

roles := []bool{false, true}
connOpts := Opts{
Timeout: 500 * time.Millisecond,
User: "test",
Pass: "test",
for i := 0; i < 10; i++ {
// We need to skip bootstrap errors and to make sure that cluster is
// configured.
roles := []bool{false, true}
connOpts := Opts{
Timeout: 500 * time.Millisecond,
User: "test",
Pass: "test",
}

err = test_helpers.SetClusterRO(serversPool, connOpts, roles)
if err == nil {
break
}
time.Sleep(time.Second)
}
err = test_helpers.SetClusterRO(serversPool, connOpts, roles)

if err != nil {
log.Fatalf("Failed to set roles in tarantool pool: %s", err)
Expand Down

0 comments on commit 0593018

Please sign in to comment.