containers

package
v3.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MappedLocalPort

func MappedLocalPort(t *testing.T, containerPort nat.Port) string

MappedLocalPort returns a port mapping for a container port that can be used to access the container from the host. The returned string is in the format expected by testcontainers.ContainerRequest ExposedPorts.

This is a workaround for a bug in docker that causes IPv4 and IPv6 port mappings to overlap with different containers on the same host. See: https://github.com/moby/moby/issues/42442.

Types

type HTTPBin

type HTTPBin struct {
	// contains filtered or unexported fields
}

HTTPBin represents a docker container running the `kong/httpbin`.

func NewHTTPBin

func NewHTTPBin(ctx context.Context, t *testing.T) HTTPBin

NewHTTPBin spawns a docker container running the `kong/httpbin` which can be used for proxy routing testing.

func (HTTPBin) IP

func (h HTTPBin) IP(ctx context.Context, t *testing.T) string

IP returns the IP address of the HTTPBin container reachable from the docker network. Can be used to configure Kong services.

type Kong

type Kong struct {
	// contains filtered or unexported fields
}

Kong represents a docker container running Kong.

func NewKong

func NewKong(ctx context.Context, t *testing.T, opts ...KongOpt) Kong

NewKong spawns a docker container running Kong (its image is determined by environment variables). It sets up a cleanup function that will terminate the container when the test finishes.

func (Kong) AdminURL

func (c Kong) AdminURL(ctx context.Context, t *testing.T) string

AdminURL returns the admin API URL of the Kong container reachable from the host machine.

func (Kong) ProxyURL

func (c Kong) ProxyURL(ctx context.Context, t *testing.T) string

ProxyURL returns the proxy URL of the Kong container reachable from the host machine.

func (Kong) Terminate added in v3.1.1

func (c Kong) Terminate(ctx context.Context) error

type KongOpt

type KongOpt func(*testcontainers.ContainerRequest)

func KongWithRouterFlavor

func KongWithRouterFlavor(flavor string) KongOpt

Jump to

Keyboard shortcuts

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