1
0
mirror of https://github.com/containrrr/watchtower.git synced 2024-12-15 09:14:13 +02:00
watchtower/container/mockclient/mock.go
Brian DeHamer dd80aa4a0d Support for --cleanup flag
The --cleanup flag will cause watchtower to automatically remove the old
image after a container is restart with a new image.
2015-07-31 18:24:27 +00:00

43 lines
977 B
Go

package mockclient
import (
"time"
"github.com/CenturyLinkLabs/watchtower/container"
"github.com/stretchr/testify/mock"
)
type MockClient struct {
mock.Mock
}
func (m *MockClient) ListContainers(cf container.Filter) ([]container.Container, error) {
args := m.Called(cf)
return args.Get(0).([]container.Container), args.Error(1)
}
func (m *MockClient) StopContainer(c container.Container, timeout time.Duration) error {
args := m.Called(c, timeout)
return args.Error(0)
}
func (m *MockClient) StartContainer(c container.Container) error {
args := m.Called(c)
return args.Error(0)
}
func (m *MockClient) RenameContainer(c container.Container, name string) error {
args := m.Called(c, name)
return args.Error(0)
}
func (m *MockClient) IsContainerStale(c container.Container) (bool, error) {
args := m.Called(c)
return args.Bool(0), args.Error(1)
}
func (m *MockClient) RemoveImage(c container.Container) error {
args := m.Called(c)
return args.Error(0)
}