mock

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package mock provides functionalities for mocking testcontainers-go.

Index

Constants

This section is empty.

Variables

View Source
var NoMockContainer = MockContainer()

NoMockContainer is no mock Container.

Functions

This section is empty.

Types

type Container

type Container struct {
	mock.Mock
}

Container is a testcontainers.Container.

func (*Container) ContainerIP

func (c *Container) ContainerIP(ctx context.Context) (string, error)

ContainerIP satisfies testcontainers.Container interface.

func (*Container) CopyFileFromContainer

func (c *Container) CopyFileFromContainer(ctx context.Context, filePath string) (io.ReadCloser, error)

CopyFileFromContainer satisfies testcontainers.Container interface.

func (*Container) CopyFileToContainer

func (c *Container) CopyFileToContainer(ctx context.Context, hostFilePath string, containerFilePath string, fileMode int64) error

CopyFileToContainer satisfies testcontainers.Container interface.

func (*Container) CopyToContainer

func (c *Container) CopyToContainer(ctx context.Context, fileContent []byte, containerFilePath string, fileMode int64) error

CopyToContainer satisfies testcontainers.Container interface.

func (*Container) Endpoint

func (c *Container) Endpoint(ctx context.Context, proto string) (string, error)

Endpoint satisfies testcontainers.Container interface.

func (*Container) Exec

func (c *Container) Exec(ctx context.Context, cmd []string) (int, error)

Exec satisfies testcontainers.Container interface.

func (*Container) FollowOutput

func (c *Container) FollowOutput(consumer testcontainers.LogConsumer)

FollowOutput satisfies testcontainers.Container interface.

func (*Container) GetContainerID

func (c *Container) GetContainerID() string

GetContainerID satisfies testcontainers.Container interface.

func (*Container) Host

func (c *Container) Host(ctx context.Context) (string, error)

Host satisfies testcontainers.Container interface.

func (*Container) Logs

func (c *Container) Logs(ctx context.Context) (io.ReadCloser, error)

Logs satisfies testcontainers.Container interface.

func (*Container) MappedPort

func (c *Container) MappedPort(ctx context.Context, port nat.Port) (nat.Port, error)

MappedPort satisfies testcontainers.Container interface.

func (*Container) Name

func (c *Container) Name(ctx context.Context) (string, error)

Name satisfies testcontainers.Container interface.

func (*Container) NetworkAliases

func (c *Container) NetworkAliases(ctx context.Context) (map[string][]string, error)

NetworkAliases satisfies testcontainers.Container interface.

func (*Container) Networks

func (c *Container) Networks(ctx context.Context) ([]string, error)

Networks satisfies testcontainers.Container interface.

func (*Container) PortEndpoint

func (c *Container) PortEndpoint(ctx context.Context, port nat.Port, proto string) (string, error)

PortEndpoint satisfies testcontainers.Container interface.

func (*Container) Ports

func (c *Container) Ports(ctx context.Context) (nat.PortMap, error)

Ports satisfies testcontainers.Container interface.

func (*Container) SessionID

func (c *Container) SessionID() string

SessionID satisfies testcontainers.Container interface.

func (*Container) Start

func (c *Container) Start(ctx context.Context) error

Start satisfies testcontainers.Container interface.

func (*Container) StartLogProducer

func (c *Container) StartLogProducer(ctx context.Context) error

StartLogProducer satisfies testcontainers.Container interface.

func (*Container) State

func (c *Container) State(ctx context.Context) (*types.ContainerState, error)

State satisfies testcontainers.Container interface.

func (*Container) Stop

func (c *Container) Stop(ctx context.Context, duration *time.Duration) error

Stop satisfies testcontainers.Container interface.

func (*Container) StopLogProducer

func (c *Container) StopLogProducer() error

StopLogProducer satisfies testcontainers.Container interface.

func (*Container) Terminate

func (c *Container) Terminate(ctx context.Context) error

Terminate satisfies testcontainers.Container interface.

type ContainerMocker

type ContainerMocker func(tb testing.TB) *Container

ContainerMocker is Container mocker.

func MockContainer

func MockContainer(mocks ...func(c *Container)) ContainerMocker

MockContainer creates Container mock with cleanup to ensure all the expectations are met. nolint: revive

Directories

Path Synopsis
Package wait provides functionalities for mocking testcontainers-go/wait.
Package wait provides functionalities for mocking testcontainers-go/wait.

Jump to

Keyboard shortcuts

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