utils

package
v0.2.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsMaxRetries

func IsMaxRetries(err error) bool

IsMaxRetries checks whether the error is due to hitting the maximum number of retries or not.

func KillContainer added in v0.2.0

func KillContainer(containerName string) error

KillContainer stops and removes specified container.

func OrStrings added in v0.2.0

func OrStrings(strs ...string) string

OrStrings returns the first non empty string in its arguments

func PullImage added in v0.2.0

func PullImage(imageName string) error

PullImage pulls an image from docker hub if image is not available or not up to date.

func Retry

func Retry(fn Func, maxRetries int) error

Retry keeps trying the function until the second argument returns false, or no error is returned.

func RunContainer added in v0.2.0

func RunContainer(containerName string, imageName string, exposedPorts nat.PortSet, portBindings nat.PortMap) error

RunContainer reproduces docker run command.

Types

type Func

type Func func(attempt int) (retry bool, err error)

Func represents functions that can be retried.

Jump to

Keyboard shortcuts

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