mocks

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const NetSupplierContainerName = "/wt-contnet-producer-1"
View Source
const NetSupplierNotFoundID = "badc1dbadc1dbadc1dbadc1dbadc1dbadc1dbadc1dbadc1dbadc1dbadc1dbadc"

Variables

View Source
var Dockwatch = ContainerRef{
	// contains filtered or unexported fields
}
View Source
var NetConsumerInvalidSupplier = ContainerRef{
	// contains filtered or unexported fields
}

NetConsumerInvalidSupplier is used for testing `container` networking mode returns a container that references a supplying container that does not exist

View Source
var NetConsumerOK = ContainerRef{
	// contains filtered or unexported fields
}

NetConsumerOK is used for testing `container` networking mode returns a container that consumes an existing supplier container

View Source
var Restarting = ContainerRef{
	// contains filtered or unexported fields
}
View Source
var Running = ContainerRef{
	// contains filtered or unexported fields
}
View Source
var Stopped = ContainerRef{
	// contains filtered or unexported fields
}

Functions

func DelayedWaitContainerHandler added in v1.0.0

func DelayedWaitContainerHandler(containerID string, delay time.Duration) http.HandlerFunc

DelayedWaitContainerHandler mocks the POST containers/{id}/wait endpoint for a removal, responding only after the supplied delay. Used to simulate a removal that takes longer to complete than the caller's stop timeout allows.

func GetContainerHandler

func GetContainerHandler(containerID string, containerInfo *dockercontainer.InspectResponse) http.HandlerFunc

GetContainerHandler mocks the GET containers/{id}/json endpoint

func GetContainerHandlers

func GetContainerHandlers(containerRefs ...*ContainerRef) []http.HandlerFunc

GetContainerHandlers returns the handlers serving lookups for the supplied container mock files

func GetImageHandler

func GetImageHandler(imageInfo *dockerimage.InspectResponse) http.HandlerFunc

GetImageHandler mocks the GET images/{id}/json endpoint

func ImagePullHandler added in v1.0.0

func ImagePullHandler(progressStream string) http.HandlerFunc

ImagePullHandler mocks the POST images/create endpoint, returning the supplied newline-delimited JSON progress stream as the daemon would.

func KillContainerHandler

func KillContainerHandler(containerID string, found FoundStatus) http.HandlerFunc

KillContainerHandler mocks the POST containers/{id}/kill endpoint

func ListContainersHandler

func ListContainersHandler(statuses ...string) http.HandlerFunc

ListContainersHandler mocks the GET containers/json endpoint, filtering the returned containers based on statuses

func RemoveContainerConflictHandler added in v1.0.0

func RemoveContainerConflictHandler(containerID string) http.HandlerFunc

RemoveContainerConflictHandler mocks the DELETE containers/{id} endpoint responding with the 409 the daemon returns when a removal of that container is already underway.

func RemoveContainerHandler

func RemoveContainerHandler(containerID string, found FoundStatus) http.HandlerFunc

RemoveContainerHandler mocks the DELETE containers/{id} endpoint

func RemoveImageHandler

func RemoveImageHandler(imagesWithParents map[string][]string) http.HandlerFunc

RemoveImageHandler mocks the DELETE images/ID endpoint, simulating removal of the given imagesWithParents

func RespondWithJSONFile

func RespondWithJSONFile(relPath string, statusCode int, optionalHeader ...http.Header) http.HandlerFunc

RespondWithJSONFile handles a request by returning the contents of the supplied file

func WaitContainerHandler added in v0.2.1

func WaitContainerHandler(containerID string, found FoundStatus) http.HandlerFunc

WaitContainerHandler mocks the POST containers/{id}/wait endpoint used by ContainerWait. When found is Missing it returns 404, which the client treats as "already gone" (no error).

func WaitRemovedContainerHandler added in v1.0.0

func WaitRemovedContainerHandler(containerID string) http.HandlerFunc

WaitRemovedContainerHandler mocks the POST containers/{id}/wait endpoint, asserting that the caller waited on the removal specifically and not merely on the container stopping.

Types

type ContainerRef

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

func (*ContainerRef) ContainerID

func (cr *ContainerRef) ContainerID() t.ContainerID

type FilterableContainer

type FilterableContainer struct {
	mock.Mock
}

FilterableContainer is an autogenerated mock type for the FilterableContainer type

func (*FilterableContainer) Enabled

func (_m *FilterableContainer) Enabled() (bool, bool)

Enabled provides a mock function with given fields:

func (*FilterableContainer) ImageName

func (_m *FilterableContainer) ImageName() string

ImageName provides a mock function with given fields:

func (*FilterableContainer) IsDockwatch

func (_m *FilterableContainer) IsDockwatch() bool

IsDockwatch provides a mock function with given fields:

func (*FilterableContainer) Name

func (_m *FilterableContainer) Name() string

Name provides a mock function with given fields:

func (*FilterableContainer) Scope

func (_m *FilterableContainer) Scope() (string, bool)

Scope provides a mock function with given fields:

type FoundStatus

type FoundStatus bool
const (
	Found   FoundStatus = true
	Missing FoundStatus = false
)

Jump to

Keyboard shortcuts

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