func RetryUntilSuccess()

in internal/testhelpers/helpers.go [68:79]


func RetryUntilSuccess(attempts int, d time.Duration, f func() error) (err error) {
	for i := 0; i < attempts; i++ {
		if i > 0 {
			time.Sleep(d)
		}
		err = f()
		if err == nil {
			return nil
		}
	}
	return fmt.Errorf("after %d attempts, last error: %s", attempts, err)
}