dockertest

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package dockertest provides a wrapper for running a lakeFS container in integration tests.

Index

Constants

View Source
const (
	DockerLakeFSRepository  = "treeverse/lakefs"
	ContainerTimeoutSeconds = 5 * 60
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Build

type Build struct {
	Repository string
	// DockerTag is the docker tag to fetch.  It is required or New() will
	// fail.
	DockerTag string
	// LocalDirectory is the directory to mount into the container and
	// use for the lakeFS local block adapter.  By default it is a
	// temporary test directory.
	LocalDirectory string
	// Env sets the environment.
	Env []string
}

Build holds parameters for building a lakeFS dockertest container.

func New

func New() *Build

func (*Build) New

func (b *Build) New(ctx context.Context, t testing.TB, pool *dockertest.Pool) *Container

TODO(ariels): Add RunOptions? Add HostConfigs?

func (*Build) WithEnv

func (b *Build) WithEnv(e ...string) *Build

func (*Build) WithLocalDirectory

func (b *Build) WithLocalDirectory(dir string) *Build

func (*Build) WithRepository

func (b *Build) WithRepository(repository string) *Build

func (*Build) WithTag

func (b *Build) WithTag(tag string) *Build

type Container

type Container struct {
	Resource *dockertest.Resource

	// Client is an authenticated client attached to the Endpoint.
	Client apigen.ClientWithResponsesInterface
	// Endpoint is the endpoint to use to contact the container.  It
	// includes /api/v1.
	Endpoint string
	// LocalDirectory is the local directory that is mounted into the
	// container and used by the lakeFS local block adapter.
	LocalDirectory string
	// AccessKeyID is the access key for authenticating as the admin.
	AccessKeyID string
	// SecretAccessKey is the secret access key for authenticating as
	// the admin.
	SecretAccessKey string

	// Closer must be called at the end of the test.  Close() is a func
	// that calls it.
	Closer func() error
}

Container holds a lakeFS dockertest container.

func (*Container) Close

func (c *Container) Close() error

Close calls Closer and must be called at the end of the test.

Jump to

Keyboard shortcuts

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