try

package
v2.0.0-...-ec94ed8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const CITimeoutMultiplier = 3

CITimeoutMultiplier is the multiplier for all timeout in the CI.

Variables

This section is empty.

Functions

func Retry

func Retry(f func() error, timeout time.Duration) error

Retry runs a function over and over until it doesn't return an error or the given timeout duration is reached.

Types

type ResponseCondition

type ResponseCondition func(*http.Response) error

ResponseCondition is a retry condition function. It receives a response, and returns an error if the response failed the condition.

func BodyContains

func BodyContains(values ...string) ResponseCondition

BodyContains returns a retry condition function. The condition returns an error if the request body does not contain all the given strings.

func StatusCodeIs

func StatusCodeIs(status int) ResponseCondition

StatusCodeIs returns a retry condition function. The condition returns an error if the given response's status code is not the given HTTP status code.

type StringCondition

type StringCondition func(string) error

StringCondition is a retry condition function. It receives a string, and returns an error if the string failed the condition.

func StringContains

func StringContains(values ...string) StringCondition

StringContains returns a retry condition function. The condition returns an error if the string does not contain the given values.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL