mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-16 15:10:12 +01:00
Set-up CircleCI builds
This commit is contained in:
parent
c02c4b9ec1
commit
31b6a30686
83 changed files with 18516 additions and 1 deletions
152
Godeps/_workspace/src/github.com/samalba/dockerclient/mockclient/mock.go
generated
vendored
Normal file
152
Godeps/_workspace/src/github.com/samalba/dockerclient/mockclient/mock.go
generated
vendored
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
package mockclient
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/samalba/dockerclient"
|
||||
"github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
type MockClient struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
func NewMockClient() *MockClient {
|
||||
return &MockClient{}
|
||||
}
|
||||
|
||||
func (client *MockClient) Info() (*dockerclient.Info, error) {
|
||||
args := client.Mock.Called()
|
||||
return args.Get(0).(*dockerclient.Info), args.Error(1)
|
||||
}
|
||||
|
||||
func (client *MockClient) ListContainers(all bool, size bool, filters string) ([]dockerclient.Container, error) {
|
||||
args := client.Mock.Called(all, size, filters)
|
||||
return args.Get(0).([]dockerclient.Container), args.Error(1)
|
||||
}
|
||||
|
||||
func (client *MockClient) InspectContainer(id string) (*dockerclient.ContainerInfo, error) {
|
||||
args := client.Mock.Called(id)
|
||||
return args.Get(0).(*dockerclient.ContainerInfo), args.Error(1)
|
||||
}
|
||||
|
||||
func (client *MockClient) InspectImage(id string) (*dockerclient.ImageInfo, error) {
|
||||
args := client.Mock.Called(id)
|
||||
return args.Get(0).(*dockerclient.ImageInfo), args.Error(1)
|
||||
}
|
||||
|
||||
func (client *MockClient) CreateContainer(config *dockerclient.ContainerConfig, name string) (string, error) {
|
||||
args := client.Mock.Called(config, name)
|
||||
return args.String(0), args.Error(1)
|
||||
}
|
||||
|
||||
func (client *MockClient) ContainerLogs(id string, options *dockerclient.LogOptions) (io.ReadCloser, error) {
|
||||
args := client.Mock.Called(id, options)
|
||||
return args.Get(0).(io.ReadCloser), args.Error(1)
|
||||
}
|
||||
|
||||
func (client *MockClient) ContainerChanges(id string) ([]*dockerclient.ContainerChanges, error) {
|
||||
args := client.Mock.Called(id)
|
||||
return args.Get(0).([]*dockerclient.ContainerChanges), args.Error(1)
|
||||
}
|
||||
|
||||
func (client *MockClient) StartContainer(id string, config *dockerclient.HostConfig) error {
|
||||
args := client.Mock.Called(id, config)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (client *MockClient) StopContainer(id string, timeout int) error {
|
||||
args := client.Mock.Called(id, timeout)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (client *MockClient) RestartContainer(id string, timeout int) error {
|
||||
args := client.Mock.Called(id, timeout)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (client *MockClient) KillContainer(id, signal string) error {
|
||||
args := client.Mock.Called(id, signal)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (client *MockClient) MonitorEvents(options *dockerclient.MonitorEventsOptions, stopChan <-chan struct{}) (<-chan dockerclient.EventOrError, error) {
|
||||
args := client.Mock.Called(options, stopChan)
|
||||
return args.Get(0).(<-chan dockerclient.EventOrError), args.Error(1)
|
||||
}
|
||||
|
||||
func (client *MockClient) StartMonitorEvents(cb dockerclient.Callback, ec chan error, args ...interface{}) {
|
||||
client.Mock.Called(cb, ec, args)
|
||||
}
|
||||
|
||||
func (client *MockClient) StopAllMonitorEvents() {
|
||||
client.Mock.Called()
|
||||
}
|
||||
|
||||
func (client *MockClient) TagImage(nameOrID string, repo string, tag string, force bool) error {
|
||||
args := client.Mock.Called(nameOrID, repo, tag, force)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (client *MockClient) StartMonitorStats(id string, cb dockerclient.StatCallback, ec chan error, args ...interface{}) {
|
||||
client.Mock.Called(id, cb, ec, args)
|
||||
}
|
||||
|
||||
func (client *MockClient) StopAllMonitorStats() {
|
||||
client.Mock.Called()
|
||||
}
|
||||
|
||||
func (client *MockClient) Version() (*dockerclient.Version, error) {
|
||||
args := client.Mock.Called()
|
||||
return args.Get(0).(*dockerclient.Version), args.Error(1)
|
||||
}
|
||||
|
||||
func (client *MockClient) PullImage(name string, auth *dockerclient.AuthConfig) error {
|
||||
args := client.Mock.Called(name, auth)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (client *MockClient) LoadImage(reader io.Reader) error {
|
||||
args := client.Mock.Called(reader)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (client *MockClient) RemoveContainer(id string, force, volumes bool) error {
|
||||
args := client.Mock.Called(id, force, volumes)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (client *MockClient) ListImages() ([]*dockerclient.Image, error) {
|
||||
args := client.Mock.Called()
|
||||
return args.Get(0).([]*dockerclient.Image), args.Error(1)
|
||||
}
|
||||
|
||||
func (client *MockClient) RemoveImage(name string) ([]*dockerclient.ImageDelete, error) {
|
||||
args := client.Mock.Called(name)
|
||||
return args.Get(0).([]*dockerclient.ImageDelete), args.Error(1)
|
||||
}
|
||||
|
||||
func (client *MockClient) PauseContainer(name string) error {
|
||||
args := client.Mock.Called(name)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (client *MockClient) UnpauseContainer(name string) error {
|
||||
args := client.Mock.Called(name)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (client *MockClient) Exec(config *dockerclient.ExecConfig) (string, error) {
|
||||
args := client.Mock.Called(config)
|
||||
return args.String(0), args.Error(1)
|
||||
}
|
||||
|
||||
func (client *MockClient) RenameContainer(oldName string, newName string) error {
|
||||
args := client.Mock.Called(oldName, newName)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (client *MockClient) ImportImage(source string, repository string, tag string, tar io.Reader) (io.ReadCloser, error) {
|
||||
args := client.Mock.Called(source, repository, tag, tar)
|
||||
return args.Get(0).(io.ReadCloser), args.Error(1)
|
||||
}
|
||||
32
Godeps/_workspace/src/github.com/samalba/dockerclient/mockclient/mock_test.go
generated
vendored
Normal file
32
Godeps/_workspace/src/github.com/samalba/dockerclient/mockclient/mock_test.go
generated
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
package mockclient
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/samalba/dockerclient"
|
||||
)
|
||||
|
||||
func TestMock(t *testing.T) {
|
||||
mock := NewMockClient()
|
||||
mock.On("Version").Return(&dockerclient.Version{Version: "foo"}, nil).Once()
|
||||
|
||||
v, err := mock.Version()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if v.Version != "foo" {
|
||||
t.Fatal(v)
|
||||
}
|
||||
|
||||
mock.Mock.AssertExpectations(t)
|
||||
}
|
||||
|
||||
func TestMockInterface(t *testing.T) {
|
||||
iface := reflect.TypeOf((*dockerclient.Client)(nil)).Elem()
|
||||
mock := NewMockClient()
|
||||
|
||||
if !reflect.TypeOf(mock).Implements(iface) {
|
||||
t.Fatalf("Mock does not implement the Client interface")
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue