Documentation ¶
Index ¶
- func CreateContainerForProgress(index int, idPrefix int, nameFormat string) (wt.Container, wt.ImageID)
- func CreateMockContainer(id string, name string, image string, created time.Time) wt.Container
- func CreateMockContainerWithConfig(id string, name string, image string, running bool, restarting bool, ...) wt.Container
- func CreateMockContainerWithDigest(id string, name string, image string, created time.Time, digest string) wt.Container
- func CreateMockContainerWithImageInfo(id string, name string, image string, created time.Time, ...) wt.Container
- func CreateMockContainerWithImageInfoP(id string, name string, image string, created time.Time, ...) wt.Container
- func CreateMockContainerWithLinks(id string, name string, image string, created time.Time, links []string, ...) wt.Container
- func CreateMockImageInfo(image string) *types.ImageInspect
- func CreateMockProgressReport(states ...session.State) wt.Report
- type MockClient
- func (client MockClient) ExecuteCommand(_ t.ContainerID, command string, _ int) (SkipUpdate bool, err error)
- func (client MockClient) GetContainer(_ t.ContainerID) (t.Container, error)
- func (client MockClient) IsContainerStale(cont t.Container, params t.UpdateParams) (bool, t.ImageID, error)
- func (client MockClient) ListContainers(_ t.Filter) ([]t.Container, error)
- func (client MockClient) RemoveImageByID(_ t.ImageID) error
- func (client MockClient) RenameContainer(_ t.Container, _ string) error
- func (client MockClient) StartContainer(_ t.Container) (t.ContainerID, error)
- func (client MockClient) StopContainer(c t.Container, _ time.Duration) error
- func (client MockClient) WarnOnHeadPullFailed(_ t.Container) bool
- type TestData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateContainerForProgress ¶
func CreateContainerForProgress(index int, idPrefix int, nameFormat string) (wt.Container, wt.ImageID)
CreateContainerForProgress creates a container substitute for tracking session/update progress
func CreateMockContainer ¶
CreateMockContainer creates a container substitute valid for testing
func CreateMockContainerWithConfig ¶
func CreateMockContainerWithConfig(id string, name string, image string, running bool, restarting bool, created time.Time, config *dockerContainer.Config) wt.Container
CreateMockContainerWithConfig creates a container substitute valid for testing
func CreateMockContainerWithDigest ¶
func CreateMockContainerWithDigest(id string, name string, image string, created time.Time, digest string) wt.Container
CreateMockContainerWithDigest should only be used for testing
func CreateMockContainerWithImageInfo ¶
func CreateMockContainerWithImageInfo(id string, name string, image string, created time.Time, imageInfo types.ImageInspect) wt.Container
CreateMockContainerWithImageInfo should only be used for testing
func CreateMockContainerWithImageInfoP ¶
func CreateMockContainerWithImageInfoP(id string, name string, image string, created time.Time, imageInfo *types.ImageInspect) wt.Container
CreateMockContainerWithImageInfoP should only be used for testing
func CreateMockContainerWithLinks ¶
func CreateMockContainerWithLinks(id string, name string, image string, created time.Time, links []string, imageInfo *types.ImageInspect) wt.Container
CreateMockContainerWithLinks should only be used for testing
func CreateMockImageInfo ¶
func CreateMockImageInfo(image string) *types.ImageInspect
CreateMockImageInfo returns a mock image info struct based on the passed image
Types ¶
type MockClient ¶
type MockClient struct { TestData *TestData // contains filtered or unexported fields }
MockClient is a mock that passes as a watchtower Client
func CreateMockClient ¶
func CreateMockClient(data *TestData, pullImages bool, removeVolumes bool) MockClient
CreateMockClient creates a mock watchtower Client for usage in tests
func (MockClient) ExecuteCommand ¶
func (client MockClient) ExecuteCommand(_ t.ContainerID, command string, _ int) (SkipUpdate bool, err error)
ExecuteCommand is a mock method
func (MockClient) GetContainer ¶
func (client MockClient) GetContainer(_ t.ContainerID) (t.Container, error)
GetContainer is a mock method
func (MockClient) IsContainerStale ¶
func (client MockClient) IsContainerStale(cont t.Container, params t.UpdateParams) (bool, t.ImageID, error)
IsContainerStale is true if not explicitly stated in TestData for the mock client
func (MockClient) ListContainers ¶
ListContainers is a mock method returning the provided container testdata
func (MockClient) RemoveImageByID ¶
func (client MockClient) RemoveImageByID(_ t.ImageID) error
RemoveImageByID increments the TriedToRemoveImageCount on being called
func (MockClient) RenameContainer ¶
func (client MockClient) RenameContainer(_ t.Container, _ string) error
RenameContainer is a mock method
func (MockClient) StartContainer ¶
func (client MockClient) StartContainer(_ t.Container) (t.ContainerID, error)
StartContainer is a mock method
func (MockClient) StopContainer ¶
StopContainer is a mock method
func (MockClient) WarnOnHeadPullFailed ¶
func (client MockClient) WarnOnHeadPullFailed(_ t.Container) bool
WarnOnHeadPullFailed is always true for the mock client
type TestData ¶
type TestData struct { TriedToRemoveImageCount int NameOfContainerToKeep string Containers []t.Container Staleness map[string]bool }
TestData is the data used to perform the test
func (*TestData) TriedToRemoveImage ¶
TriedToRemoveImage is a test helper function to check whether RemoveImageByID has been called