testutil

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package testutil includes utilities used in test code of other packages.

Package testutil includes utilities used in test code of other packages.

Index

Constants

View Source
const (
	TestImage    = "docker.io/orlangure/gnomock-test-image"
	GoodPort80   = 80
	GoodPort8080 = 8080
	BadPort      = 8000
)

Test preset uses the following values:

Variables

This section is empty.

Functions

func Healthcheck

func Healthcheck(ctx context.Context, c *gnomock.Container) error

Healthcheck returns an error if either of ports 80 and 8080 of test preset returns an unexpected response.

func ListContainerByID added in v0.25.0

func ListContainerByID(cli *client.Client, id string) ([]types.Container, error)

ListContainerByID returns a list of Containers for the given container id.

Types

type TestPreset

type TestPreset struct {
	Img string
}

TestPreset is a preset used for tests.

func (*TestPreset) Image

func (t *TestPreset) Image() string

Image returns a canonical docker image used to setup this Preset.

func (*TestPreset) Options

func (t *TestPreset) Options() []gnomock.Option

Options returns a list of Option functions that allow to setup this Preset implementation. This test preset always returns a failing healthcheck.

func (*TestPreset) Ports

func (t *TestPreset) Ports() gnomock.NamedPorts

Ports returns a group of ports exposed by this Preset, where every port is given a unique name.

This Preset returns port 80 by "default" name.

Jump to

Keyboard shortcuts

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