canned

package module
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2020 License: MIT Imports: 6 Imported by: 0

README

License Tag Go Report Card

testcontainers-canned

Canned container for tests using the library testcontainers-go.

What does it mean? It means that if you have tests using the library testcontainers-go, you can easily spin up some specific applications without worring about the waiting logic or connection string/client url-building logic.

You can also specify your own images to be initialized using the same logic as one that is already implemented here (i.e. if you create your own SQL Server image with your tables already).

Included Containers

Generic API

Generic container starter for an HTTP API

  • Default Image: None. It must be provided on creation.
Mock-Server
SQL Server for Linux

More Features

Network Creation

The package ./networks includes a function to create a network with a random name.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddNetworkAlias

func AddNetworkAlias(req *testcontainers.GenericContainerRequest, network, alias string)

AddNetworkAlias adds a network alias to a generic container request

func GetAliasForNetwork

func GetAliasForNetwork(ctx context.Context, req testcontainers.GenericContainerRequest, network string) (string, error)

GetAliasForNetwork retrieves the container alias in the specified network

func GetHostAndPort

func GetHostAndPort(ctx context.Context, c testcontainers.Container, exposedPort nat.Port) (host string, port nat.Port, err error)

GetHostAndPort retrieves the container host and port

func GetLogs added in v0.0.9

func GetLogs(ctx context.Context, c testcontainers.Container) (string, error)

GetLogs retrieves all logs from the container

Types

type Container added in v0.0.17

type Container interface {
	Shutdownable
	GetLogs(context.Context) (string, error)
	HostAndPort(context.Context) (string, nat.Port, error)
}

Container represents a container

type Shutdownable added in v0.0.10

type Shutdownable interface {
	Shutdown(ctx context.Context) error
}

Shutdownable represents something that can be shut down

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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