2015-07-21 21:37:18 +02:00
|
|
|
package mockclient
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/CenturyLinkLabs/watchtower/container"
|
|
|
|
"github.com/stretchr/testify/mock"
|
|
|
|
)
|
|
|
|
|
|
|
|
type MockClient struct {
|
|
|
|
mock.Mock
|
|
|
|
}
|
|
|
|
|
2015-07-22 00:41:58 +02:00
|
|
|
func (m *MockClient) ListContainers(cf container.Filter) ([]container.Container, error) {
|
2015-07-21 21:37:18 +02:00
|
|
|
args := m.Called(cf)
|
|
|
|
return args.Get(0).([]container.Container), args.Error(1)
|
|
|
|
}
|
|
|
|
|
2015-07-22 00:41:58 +02:00
|
|
|
func (m *MockClient) StopContainer(c container.Container, timeout time.Duration) error {
|
2015-07-21 21:37:18 +02:00
|
|
|
args := m.Called(c, timeout)
|
|
|
|
return args.Error(0)
|
|
|
|
}
|
|
|
|
|
2015-07-22 00:41:58 +02:00
|
|
|
func (m *MockClient) StartContainer(c container.Container) error {
|
2015-07-21 21:37:18 +02:00
|
|
|
args := m.Called(c)
|
|
|
|
return args.Error(0)
|
|
|
|
}
|
|
|
|
|
2015-07-22 00:41:58 +02:00
|
|
|
func (m *MockClient) RenameContainer(c container.Container, name string) error {
|
2015-07-21 21:37:18 +02:00
|
|
|
args := m.Called(c, name)
|
|
|
|
return args.Error(0)
|
|
|
|
}
|
2015-07-22 00:41:58 +02:00
|
|
|
|
|
|
|
func (m *MockClient) IsContainerStale(c container.Container) (bool, error) {
|
|
|
|
args := m.Called(c)
|
|
|
|
return args.Bool(0), args.Error(1)
|
|
|
|
}
|
2015-07-31 20:24:27 +02:00
|
|
|
|
|
|
|
func (m *MockClient) RemoveImage(c container.Container) error {
|
|
|
|
args := m.Called(c)
|
|
|
|
return args.Error(0)
|
|
|
|
}
|