Skip to content

Commit

Permalink
code health: reuse Retry in test helpers
Browse files Browse the repository at this point in the history
Part of #214
  • Loading branch information
DifferentialOrange committed Dec 16, 2022
1 parent 7665568 commit 5f81bea
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions test_helpers/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,20 @@ func DeleteRecordByKey(t *testing.T, conn tarantool.Connector,
// Returns false in case of connection is not in the connected state
// after specified retries count, true otherwise.
func WaitUntilReconnected(conn *tarantool.Connection, retries uint, timeout time.Duration) bool {
for i := uint(0); ; i++ {
err := Retry(func(arg interface{}) error {
conn := arg.(*tarantool.Connection)
connected := conn.ConnectedNow()
if connected {
return true
if !connected {
return fmt.Errorf("not connected")
}
return nil
}, conn, int(retries), timeout)

if i == retries {
break
}

time.Sleep(timeout)
if err != nil {
return false
}

return false
return true
}

func SkipIfSQLUnsupported(t testing.TB) {
Expand Down

0 comments on commit 5f81bea

Please sign in to comment.