From 47822096e31ce4e3fa69385288d37bbb6a34dee6 Mon Sep 17 00:00:00 2001 From: Oleg Jukovec Date: Mon, 15 May 2023 13:59:41 +0300 Subject: [PATCH] test: wait for queue cluster We need to wait for a success role cluster configuration because an instance bootstrap may hasn't finished yet. Part of #291 --- queue/queue_test.go | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/queue/queue_test.go b/queue/queue_test.go index 0a3d4e919..c2ffad4ec 100644 --- a/queue/queue_test.go +++ b/queue/queue_test.go @@ -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 erros and 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)