diff --git a/provider/marathon/marathon_test.go b/provider/marathon/marathon_test.go index b0056ebd0..f5fa363a8 100644 --- a/provider/marathon/marathon_test.go +++ b/provider/marathon/marathon_test.go @@ -6,7 +6,7 @@ import ( "reflect" "testing" - "github.com/containous/traefik/mocks" + "github.com/containous/traefik/provider/marathon/mocks" "github.com/containous/traefik/testhelpers" "github.com/containous/traefik/types" "github.com/davecgh/go-spew/spew" diff --git a/mocks/Marathon.go b/provider/marathon/mocks/Marathon.go similarity index 84% rename from mocks/Marathon.go rename to provider/marathon/mocks/Marathon.go index bde9b1942..29048d930 100644 --- a/mocks/Marathon.go +++ b/provider/marathon/mocks/Marathon.go @@ -1,3 +1,5 @@ +// Package mocks Code generated by mockery v1.0.0 +// mockery -recursive -dir=vendor/github.com/gambol99/ -name=Marathon -output=provider/marathon/mocks package mocks import ( @@ -8,359 +10,48 @@ import ( "github.com/stretchr/testify/mock" ) -// Marathon is a mock of marathon.Marathon +// Marathon is an autogenerated mock type for the Marathon type type Marathon struct { mock.Mock } -// ListApplications provides a mock function with given fields: _a0 -func (_m *Marathon) ListApplications(_a0 url.Values) ([]string, error) { - ret := _m.Called(_a0) +// AbdicateLeader provides a mock function with given fields: +func (_m *Marathon) AbdicateLeader() (string, error) { + ret := _m.Called() - var r0 []string - if rf, ok := ret.Get(0).(func(url.Values) []string); ok { - r0 = rf(_a0) + var r0 string + if rf, ok := ret.Get(0).(func() string); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(string) + } + + var r1 error + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// AddEventsListener provides a mock function with given fields: filter +func (_m *Marathon) AddEventsListener(filter int) (marathon.EventsChannel, error) { + ret := _m.Called(filter) + + var r0 marathon.EventsChannel + if rf, ok := ret.Get(0).(func(int) marathon.EventsChannel); ok { + r0 = rf(filter) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]string) + r0 = ret.Get(0).(marathon.EventsChannel) } } var r1 error - if rf, ok := ret.Get(1).(func(url.Values) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ApplicationVersions provides a mock function with given fields: name -func (_m *Marathon) ApplicationVersions(name string) (*marathon.ApplicationVersions, error) { - ret := _m.Called(name) - - var r0 *marathon.ApplicationVersions - if rf, ok := ret.Get(0).(func(string) *marathon.ApplicationVersions); ok { - r0 = rf(name) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*marathon.ApplicationVersions) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(name) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// HasApplicationVersion provides a mock function with given fields: name, version -func (_m *Marathon) HasApplicationVersion(name string, version string) (bool, error) { - ret := _m.Called(name, version) - - var r0 bool - if rf, ok := ret.Get(0).(func(string, string) bool); ok { - r0 = rf(name, version) - } else { - r0 = ret.Get(0).(bool) - } - - var r1 error - if rf, ok := ret.Get(1).(func(string, string) error); ok { - r1 = rf(name, version) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// SetApplicationVersion provides a mock function with given fields: name, version -func (_m *Marathon) SetApplicationVersion(name string, version *marathon.ApplicationVersion) (*marathon.DeploymentID, error) { - ret := _m.Called(name, version) - - var r0 *marathon.DeploymentID - if rf, ok := ret.Get(0).(func(string, *marathon.ApplicationVersion) *marathon.DeploymentID); ok { - r0 = rf(name, version) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*marathon.DeploymentID) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(string, *marathon.ApplicationVersion) error); ok { - r1 = rf(name, version) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ApplicationOK provides a mock function with given fields: name -func (_m *Marathon) ApplicationOK(name string) (bool, error) { - ret := _m.Called(name) - - var r0 bool - if rf, ok := ret.Get(0).(func(string) bool); ok { - r0 = rf(name) - } else { - r0 = ret.Get(0).(bool) - } - - var r1 error - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(name) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CreateApplication provides a mock function with given fields: application -func (_m *Marathon) CreateApplication(application *marathon.Application) (*marathon.Application, error) { - ret := _m.Called(application) - - var r0 *marathon.Application - if rf, ok := ret.Get(0).(func(*marathon.Application) *marathon.Application); ok { - r0 = rf(application) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*marathon.Application) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*marathon.Application) error); ok { - r1 = rf(application) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DeleteApplication provides a mock function with given fields: name -func (_m *Marathon) DeleteApplication(name string, force bool) (*marathon.DeploymentID, error) { - ret := _m.Called(name) - - var r0 *marathon.DeploymentID - if rf, ok := ret.Get(0).(func(string) *marathon.DeploymentID); ok { - r0 = rf(name) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*marathon.DeploymentID) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(name) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// UpdateApplication provides a mock function with given fields: application, force -func (_m *Marathon) UpdateApplication(application *marathon.Application, force bool) (*marathon.DeploymentID, error) { - ret := _m.Called(application, force) - - var r0 *marathon.DeploymentID - if rf, ok := ret.Get(0).(func(*marathon.Application, bool) *marathon.DeploymentID); ok { - r0 = rf(application, force) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*marathon.DeploymentID) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*marathon.Application, bool) error); ok { - r1 = rf(application, force) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ApplicationDeployments provides a mock function with given fields: name -func (_m *Marathon) ApplicationDeployments(name string) ([]*marathon.DeploymentID, error) { - ret := _m.Called(name) - - var r0 []*marathon.DeploymentID - if rf, ok := ret.Get(0).(func(string) []*marathon.DeploymentID); ok { - r0 = rf(name) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*marathon.DeploymentID) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(name) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ScaleApplicationInstances provides a mock function with given fields: name, instances, force -func (_m *Marathon) ScaleApplicationInstances(name string, instances int, force bool) (*marathon.DeploymentID, error) { - ret := _m.Called(name, instances, force) - - var r0 *marathon.DeploymentID - if rf, ok := ret.Get(0).(func(string, int, bool) *marathon.DeploymentID); ok { - r0 = rf(name, instances, force) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*marathon.DeploymentID) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(string, int, bool) error); ok { - r1 = rf(name, instances, force) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// RestartApplication provides a mock function with given fields: name, force -func (_m *Marathon) RestartApplication(name string, force bool) (*marathon.DeploymentID, error) { - ret := _m.Called(name, force) - - var r0 *marathon.DeploymentID - if rf, ok := ret.Get(0).(func(string, bool) *marathon.DeploymentID); ok { - r0 = rf(name, force) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*marathon.DeploymentID) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(string, bool) error); ok { - r1 = rf(name, force) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Applications provides a mock function with given fields: _a0 -func (_m *Marathon) Applications(_a0 url.Values) (*marathon.Applications, error) { - ret := _m.Called(_a0) - - var r0 *marathon.Applications - if rf, ok := ret.Get(0).(func(url.Values) *marathon.Applications); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*marathon.Applications) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(url.Values) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Application provides a mock function with given fields: name -func (_m *Marathon) Application(name string) (*marathon.Application, error) { - ret := _m.Called(name) - - var r0 *marathon.Application - if rf, ok := ret.Get(0).(func(string) *marathon.Application); ok { - r0 = rf(name) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*marathon.Application) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(name) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ApplicationByVersion provides a mock function with given fields: name, version -func (_m *Marathon) ApplicationByVersion(name string, version string) (*marathon.Application, error) { - ret := _m.Called(name, version) - - var r0 *marathon.Application - if rf, ok := ret.Get(0).(func(string, string) *marathon.Application); ok { - r0 = rf(name, version) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*marathon.Application) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(string, string) error); ok { - r1 = rf(name, version) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WaitOnApplication provides a mock function with given fields: name, timeout -func (_m *Marathon) WaitOnApplication(name string, timeout time.Duration) error { - ret := _m.Called(name, timeout) - - var r0 error - if rf, ok := ret.Get(0).(func(string, time.Duration) error); ok { - r0 = rf(name, timeout) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Tasks provides a mock function with given fields: application -func (_m *Marathon) Tasks(application string) (*marathon.Tasks, error) { - ret := _m.Called(application) - - var r0 *marathon.Tasks - if rf, ok := ret.Get(0).(func(string) *marathon.Tasks); ok { - r0 = rf(application) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*marathon.Tasks) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(application) + if rf, ok := ret.Get(1).(func(int) error); ok { + r1 = rf(filter) } else { r1 = ret.Error(1) } @@ -391,22 +82,493 @@ func (_m *Marathon) AllTasks(opts *marathon.AllTasksOpts) (*marathon.Tasks, erro return r0, r1 } -// TaskEndpoints provides a mock function with given fields: name, port, healthCheck -func (_m *Marathon) TaskEndpoints(name string, port int, healthCheck bool) ([]string, error) { - ret := _m.Called(name, port, healthCheck) +// Application provides a mock function with given fields: name +func (_m *Marathon) Application(name string) (*marathon.Application, error) { + ret := _m.Called(name) - var r0 []string - if rf, ok := ret.Get(0).(func(string, int, bool) []string); ok { - r0 = rf(name, port, healthCheck) + var r0 *marathon.Application + if rf, ok := ret.Get(0).(func(string) *marathon.Application); ok { + r0 = rf(name) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]string) + r0 = ret.Get(0).(*marathon.Application) } } var r1 error - if rf, ok := ret.Get(1).(func(string, int, bool) error); ok { - r1 = rf(name, port, healthCheck) + if rf, ok := ret.Get(1).(func(string) error); ok { + r1 = rf(name) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ApplicationBy provides a mock function with given fields: name, opts +func (_m *Marathon) ApplicationBy(name string, opts *marathon.GetAppOpts) (*marathon.Application, error) { + ret := _m.Called(name, opts) + + var r0 *marathon.Application + if rf, ok := ret.Get(0).(func(string, *marathon.GetAppOpts) *marathon.Application); ok { + r0 = rf(name, opts) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*marathon.Application) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(string, *marathon.GetAppOpts) error); ok { + r1 = rf(name, opts) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ApplicationByVersion provides a mock function with given fields: name, version +func (_m *Marathon) ApplicationByVersion(name string, version string) (*marathon.Application, error) { + ret := _m.Called(name, version) + + var r0 *marathon.Application + if rf, ok := ret.Get(0).(func(string, string) *marathon.Application); ok { + r0 = rf(name, version) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*marathon.Application) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(string, string) error); ok { + r1 = rf(name, version) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ApplicationDeployments provides a mock function with given fields: name +func (_m *Marathon) ApplicationDeployments(name string) ([]*marathon.DeploymentID, error) { + ret := _m.Called(name) + + var r0 []*marathon.DeploymentID + if rf, ok := ret.Get(0).(func(string) []*marathon.DeploymentID); ok { + r0 = rf(name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*marathon.DeploymentID) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(string) error); ok { + r1 = rf(name) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ApplicationOK provides a mock function with given fields: name +func (_m *Marathon) ApplicationOK(name string) (bool, error) { + ret := _m.Called(name) + + var r0 bool + if rf, ok := ret.Get(0).(func(string) bool); ok { + r0 = rf(name) + } else { + r0 = ret.Get(0).(bool) + } + + var r1 error + if rf, ok := ret.Get(1).(func(string) error); ok { + r1 = rf(name) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ApplicationVersions provides a mock function with given fields: name +func (_m *Marathon) ApplicationVersions(name string) (*marathon.ApplicationVersions, error) { + ret := _m.Called(name) + + var r0 *marathon.ApplicationVersions + if rf, ok := ret.Get(0).(func(string) *marathon.ApplicationVersions); ok { + r0 = rf(name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*marathon.ApplicationVersions) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(string) error); ok { + r1 = rf(name) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Applications provides a mock function with given fields: _a0 +func (_m *Marathon) Applications(_a0 url.Values) (*marathon.Applications, error) { + ret := _m.Called(_a0) + + var r0 *marathon.Applications + if rf, ok := ret.Get(0).(func(url.Values) *marathon.Applications); ok { + r0 = rf(_a0) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*marathon.Applications) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(url.Values) error); ok { + r1 = rf(_a0) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CreateApplication provides a mock function with given fields: application +func (_m *Marathon) CreateApplication(application *marathon.Application) (*marathon.Application, error) { + ret := _m.Called(application) + + var r0 *marathon.Application + if rf, ok := ret.Get(0).(func(*marathon.Application) *marathon.Application); ok { + r0 = rf(application) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*marathon.Application) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(*marathon.Application) error); ok { + r1 = rf(application) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CreateGroup provides a mock function with given fields: group +func (_m *Marathon) CreateGroup(group *marathon.Group) error { + ret := _m.Called(group) + + var r0 error + if rf, ok := ret.Get(0).(func(*marathon.Group) error); ok { + r0 = rf(group) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// DeleteApplication provides a mock function with given fields: name, force +func (_m *Marathon) DeleteApplication(name string, force bool) (*marathon.DeploymentID, error) { + ret := _m.Called(name, force) + + var r0 *marathon.DeploymentID + if rf, ok := ret.Get(0).(func(string, bool) *marathon.DeploymentID); ok { + r0 = rf(name, force) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*marathon.DeploymentID) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(string, bool) error); ok { + r1 = rf(name, force) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// DeleteDeployment provides a mock function with given fields: id, force +func (_m *Marathon) DeleteDeployment(id string, force bool) (*marathon.DeploymentID, error) { + ret := _m.Called(id, force) + + var r0 *marathon.DeploymentID + if rf, ok := ret.Get(0).(func(string, bool) *marathon.DeploymentID); ok { + r0 = rf(id, force) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*marathon.DeploymentID) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(string, bool) error); ok { + r1 = rf(id, force) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// DeleteGroup provides a mock function with given fields: name, force +func (_m *Marathon) DeleteGroup(name string, force bool) (*marathon.DeploymentID, error) { + ret := _m.Called(name, force) + + var r0 *marathon.DeploymentID + if rf, ok := ret.Get(0).(func(string, bool) *marathon.DeploymentID); ok { + r0 = rf(name, force) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*marathon.DeploymentID) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(string, bool) error); ok { + r1 = rf(name, force) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// DeleteQueueDelay provides a mock function with given fields: appID +func (_m *Marathon) DeleteQueueDelay(appID string) error { + ret := _m.Called(appID) + + var r0 error + if rf, ok := ret.Get(0).(func(string) error); ok { + r0 = rf(appID) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Deployments provides a mock function with given fields: +func (_m *Marathon) Deployments() ([]*marathon.Deployment, error) { + ret := _m.Called() + + var r0 []*marathon.Deployment + if rf, ok := ret.Get(0).(func() []*marathon.Deployment); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*marathon.Deployment) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetMarathonURL provides a mock function with given fields: +func (_m *Marathon) GetMarathonURL() string { + ret := _m.Called() + + var r0 string + if rf, ok := ret.Get(0).(func() string); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Group provides a mock function with given fields: name +func (_m *Marathon) Group(name string) (*marathon.Group, error) { + ret := _m.Called(name) + + var r0 *marathon.Group + if rf, ok := ret.Get(0).(func(string) *marathon.Group); ok { + r0 = rf(name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*marathon.Group) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(string) error); ok { + r1 = rf(name) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GroupBy provides a mock function with given fields: name, opts +func (_m *Marathon) GroupBy(name string, opts *marathon.GetGroupOpts) (*marathon.Group, error) { + ret := _m.Called(name, opts) + + var r0 *marathon.Group + if rf, ok := ret.Get(0).(func(string, *marathon.GetGroupOpts) *marathon.Group); ok { + r0 = rf(name, opts) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*marathon.Group) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(string, *marathon.GetGroupOpts) error); ok { + r1 = rf(name, opts) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Groups provides a mock function with given fields: +func (_m *Marathon) Groups() (*marathon.Groups, error) { + ret := _m.Called() + + var r0 *marathon.Groups + if rf, ok := ret.Get(0).(func() *marathon.Groups); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*marathon.Groups) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GroupsBy provides a mock function with given fields: opts +func (_m *Marathon) GroupsBy(opts *marathon.GetGroupOpts) (*marathon.Groups, error) { + ret := _m.Called(opts) + + var r0 *marathon.Groups + if rf, ok := ret.Get(0).(func(*marathon.GetGroupOpts) *marathon.Groups); ok { + r0 = rf(opts) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*marathon.Groups) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(*marathon.GetGroupOpts) error); ok { + r1 = rf(opts) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// HasApplicationVersion provides a mock function with given fields: name, version +func (_m *Marathon) HasApplicationVersion(name string, version string) (bool, error) { + ret := _m.Called(name, version) + + var r0 bool + if rf, ok := ret.Get(0).(func(string, string) bool); ok { + r0 = rf(name, version) + } else { + r0 = ret.Get(0).(bool) + } + + var r1 error + if rf, ok := ret.Get(1).(func(string, string) error); ok { + r1 = rf(name, version) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// HasDeployment provides a mock function with given fields: id +func (_m *Marathon) HasDeployment(id string) (bool, error) { + ret := _m.Called(id) + + var r0 bool + if rf, ok := ret.Get(0).(func(string) bool); ok { + r0 = rf(id) + } else { + r0 = ret.Get(0).(bool) + } + + var r1 error + if rf, ok := ret.Get(1).(func(string) error); ok { + r1 = rf(id) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// HasGroup provides a mock function with given fields: name +func (_m *Marathon) HasGroup(name string) (bool, error) { + ret := _m.Called(name) + + var r0 bool + if rf, ok := ret.Get(0).(func(string) bool); ok { + r0 = rf(name) + } else { + r0 = ret.Get(0).(bool) + } + + var r1 error + if rf, ok := ret.Get(1).(func(string) error); ok { + r1 = rf(name) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Info provides a mock function with given fields: +func (_m *Marathon) Info() (*marathon.Info, error) { + ret := _m.Called() + + var r0 *marathon.Info + if rf, ok := ret.Get(0).(func() *marathon.Info); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*marathon.Info) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() } else { r1 = ret.Error(1) } @@ -474,17 +636,15 @@ func (_m *Marathon) KillTasks(taskIDs []string, opts *marathon.KillTaskOpts) err return r0 } -// Groups provides a mock function with given fields: -func (_m *Marathon) Groups() (*marathon.Groups, error) { +// Leader provides a mock function with given fields: +func (_m *Marathon) Leader() (string, error) { ret := _m.Called() - var r0 *marathon.Groups - if rf, ok := ret.Get(0).(func() *marathon.Groups); ok { + var r0 string + if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*marathon.Groups) - } + r0 = ret.Get(0).(string) } var r1 error @@ -497,22 +657,22 @@ func (_m *Marathon) Groups() (*marathon.Groups, error) { return r0, r1 } -// Group provides a mock function with given fields: name -func (_m *Marathon) Group(name string) (*marathon.Group, error) { - ret := _m.Called(name) +// ListApplications provides a mock function with given fields: _a0 +func (_m *Marathon) ListApplications(_a0 url.Values) ([]string, error) { + ret := _m.Called(_a0) - var r0 *marathon.Group - if rf, ok := ret.Get(0).(func(string) *marathon.Group); ok { - r0 = rf(name) + var r0 []string + if rf, ok := ret.Get(0).(func(url.Values) []string); ok { + r0 = rf(_a0) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*marathon.Group) + r0 = ret.Get(0).([]string) } } var r1 error - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(name) + if rf, ok := ret.Get(1).(func(url.Values) error); ok { + r1 = rf(_a0) } else { r1 = ret.Error(1) } @@ -520,80 +680,20 @@ func (_m *Marathon) Group(name string) (*marathon.Group, error) { return r0, r1 } -// CreateGroup provides a mock function with given fields: group -func (_m *Marathon) CreateGroup(group *marathon.Group) error { - ret := _m.Called(group) - - var r0 error - if rf, ok := ret.Get(0).(func(*marathon.Group) error); ok { - r0 = rf(group) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// DeleteGroup provides a mock function with given fields: name -func (_m *Marathon) DeleteGroup(name string, force bool) (*marathon.DeploymentID, error) { - ret := _m.Called(name) - - var r0 *marathon.DeploymentID - if rf, ok := ret.Get(0).(func(string) *marathon.DeploymentID); ok { - r0 = rf(name) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*marathon.DeploymentID) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(name) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// UpdateGroup provides a mock function with given fields: id, group -func (_m *Marathon) UpdateGroup(id string, group *marathon.Group, force bool) (*marathon.DeploymentID, error) { - ret := _m.Called(id, group) - - var r0 *marathon.DeploymentID - if rf, ok := ret.Get(0).(func(string, *marathon.Group) *marathon.DeploymentID); ok { - r0 = rf(id, group) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*marathon.DeploymentID) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(string, *marathon.Group) error); ok { - r1 = rf(id, group) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// HasGroup provides a mock function with given fields: name -func (_m *Marathon) HasGroup(name string) (bool, error) { - ret := _m.Called(name) +// Ping provides a mock function with given fields: +func (_m *Marathon) Ping() (bool, error) { + ret := _m.Called() var r0 bool - if rf, ok := ret.Get(0).(func(string) bool); ok { - r0 = rf(name) + if rf, ok := ret.Get(0).(func() bool); ok { + r0 = rf() } else { r0 = ret.Get(0).(bool) } var r1 error - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(name) + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() } else { r1 = ret.Error(1) } @@ -601,30 +701,16 @@ func (_m *Marathon) HasGroup(name string) (bool, error) { return r0, r1 } -// WaitOnGroup provides a mock function with given fields: name, timeout -func (_m *Marathon) WaitOnGroup(name string, timeout time.Duration) error { - ret := _m.Called(name, timeout) - - var r0 error - if rf, ok := ret.Get(0).(func(string, time.Duration) error); ok { - r0 = rf(name, timeout) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Deployments provides a mock function with given fields: -func (_m *Marathon) Deployments() ([]*marathon.Deployment, error) { +// Queue provides a mock function with given fields: +func (_m *Marathon) Queue() (*marathon.Queue, error) { ret := _m.Called() - var r0 []*marathon.Deployment - if rf, ok := ret.Get(0).(func() []*marathon.Deployment); ok { + var r0 *marathon.Queue + if rf, ok := ret.Get(0).(func() *marathon.Queue); ok { r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]*marathon.Deployment) + r0 = ret.Get(0).(*marathon.Queue) } } @@ -638,13 +724,18 @@ func (_m *Marathon) Deployments() ([]*marathon.Deployment, error) { return r0, r1 } -// DeleteDeployment provides a mock function with given fields: id, force -func (_m *Marathon) DeleteDeployment(id string, force bool) (*marathon.DeploymentID, error) { - ret := _m.Called(id, force) +// RemoveEventsListener provides a mock function with given fields: channel +func (_m *Marathon) RemoveEventsListener(channel marathon.EventsChannel) { + _m.Called(channel) +} + +// RestartApplication provides a mock function with given fields: name, force +func (_m *Marathon) RestartApplication(name string, force bool) (*marathon.DeploymentID, error) { + ret := _m.Called(name, force) var r0 *marathon.DeploymentID if rf, ok := ret.Get(0).(func(string, bool) *marathon.DeploymentID); ok { - r0 = rf(id, force) + r0 = rf(name, force) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*marathon.DeploymentID) @@ -653,7 +744,7 @@ func (_m *Marathon) DeleteDeployment(id string, force bool) (*marathon.Deploymen var r1 error if rf, ok := ret.Get(1).(func(string, bool) error); ok { - r1 = rf(id, force) + r1 = rf(name, force) } else { r1 = ret.Error(1) } @@ -661,20 +752,22 @@ func (_m *Marathon) DeleteDeployment(id string, force bool) (*marathon.Deploymen return r0, r1 } -// HasDeployment provides a mock function with given fields: id -func (_m *Marathon) HasDeployment(id string) (bool, error) { - ret := _m.Called(id) +// ScaleApplicationInstances provides a mock function with given fields: name, instances, force +func (_m *Marathon) ScaleApplicationInstances(name string, instances int, force bool) (*marathon.DeploymentID, error) { + ret := _m.Called(name, instances, force) - var r0 bool - if rf, ok := ret.Get(0).(func(string) bool); ok { - r0 = rf(id) + var r0 *marathon.DeploymentID + if rf, ok := ret.Get(0).(func(string, int, bool) *marathon.DeploymentID); ok { + r0 = rf(name, instances, force) } else { - r0 = ret.Get(0).(bool) + if ret.Get(0) != nil { + r0 = ret.Get(0).(*marathon.DeploymentID) + } } var r1 error - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(id) + if rf, ok := ret.Get(1).(func(string, int, bool) error); ok { + r1 = rf(name, instances, force) } else { r1 = ret.Error(1) } @@ -682,13 +775,36 @@ func (_m *Marathon) HasDeployment(id string) (bool, error) { return r0, r1 } -// WaitOnDeployment provides a mock function with given fields: id, timeout -func (_m *Marathon) WaitOnDeployment(id string, timeout time.Duration) error { - ret := _m.Called(id, timeout) +// SetApplicationVersion provides a mock function with given fields: name, version +func (_m *Marathon) SetApplicationVersion(name string, version *marathon.ApplicationVersion) (*marathon.DeploymentID, error) { + ret := _m.Called(name, version) + + var r0 *marathon.DeploymentID + if rf, ok := ret.Get(0).(func(string, *marathon.ApplicationVersion) *marathon.DeploymentID); ok { + r0 = rf(name, version) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*marathon.DeploymentID) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(string, *marathon.ApplicationVersion) error); ok { + r1 = rf(name, version) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Subscribe provides a mock function with given fields: _a0 +func (_m *Marathon) Subscribe(_a0 string) error { + ret := _m.Called(_a0) var r0 error - if rf, ok := ret.Get(0).(func(string, time.Duration) error); ok { - r0 = rf(id, timeout) + if rf, ok := ret.Get(0).(func(string) error); ok { + r0 = rf(_a0) } else { r0 = ret.Error(0) } @@ -719,24 +835,50 @@ func (_m *Marathon) Subscriptions() (*marathon.Subscriptions, error) { return r0, r1 } -// AddEventsListener provides a mock function with given fields: channel, filter -func (_m *Marathon) AddEventsListener(filter int) (marathon.EventsChannel, error) { - update := make(marathon.EventsChannel, 5) - ret := _m.Called(update, filter) +// TaskEndpoints provides a mock function with given fields: name, port, healthCheck +func (_m *Marathon) TaskEndpoints(name string, port int, healthCheck bool) ([]string, error) { + ret := _m.Called(name, port, healthCheck) - var r0 error - if rf, ok := ret.Get(0).(func(marathon.EventsChannel, int) error); ok { - r0 = rf(update, filter) + var r0 []string + if rf, ok := ret.Get(0).(func(string, int, bool) []string); ok { + r0 = rf(name, port, healthCheck) } else { - r0 = ret.Error(0) + if ret.Get(0) != nil { + r0 = ret.Get(0).([]string) + } } - return update, r0 + var r1 error + if rf, ok := ret.Get(1).(func(string, int, bool) error); ok { + r1 = rf(name, port, healthCheck) + } else { + r1 = ret.Error(1) + } + + return r0, r1 } -// RemoveEventsListener provides a mock function with given fields: channel -func (_m *Marathon) RemoveEventsListener(channel marathon.EventsChannel) { - _m.Called(channel) +// Tasks provides a mock function with given fields: application +func (_m *Marathon) Tasks(application string) (*marathon.Tasks, error) { + ret := _m.Called(application) + + var r0 *marathon.Tasks + if rf, ok := ret.Get(0).(func(string) *marathon.Tasks); ok { + r0 = rf(application) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*marathon.Tasks) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(string) error); ok { + r1 = rf(application) + } else { + r1 = ret.Error(1) + } + + return r0, r1 } // Unsubscribe provides a mock function with given fields: _a0 @@ -753,132 +895,90 @@ func (_m *Marathon) Unsubscribe(_a0 string) error { return r0 } -// GetMarathonURL provides a mock function with given fields: -func (_m *Marathon) GetMarathonURL() string { - ret := _m.Called() +// UpdateApplication provides a mock function with given fields: application, force +func (_m *Marathon) UpdateApplication(application *marathon.Application, force bool) (*marathon.DeploymentID, error) { + ret := _m.Called(application, force) - var r0 string - if rf, ok := ret.Get(0).(func() string); ok { - r0 = rf() + var r0 *marathon.DeploymentID + if rf, ok := ret.Get(0).(func(*marathon.Application, bool) *marathon.DeploymentID); ok { + r0 = rf(application, force) } else { - r0 = ret.Get(0).(string) + if ret.Get(0) != nil { + r0 = ret.Get(0).(*marathon.DeploymentID) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(*marathon.Application, bool) error); ok { + r1 = rf(application, force) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// UpdateGroup provides a mock function with given fields: id, group, force +func (_m *Marathon) UpdateGroup(id string, group *marathon.Group, force bool) (*marathon.DeploymentID, error) { + ret := _m.Called(id, group, force) + + var r0 *marathon.DeploymentID + if rf, ok := ret.Get(0).(func(string, *marathon.Group, bool) *marathon.DeploymentID); ok { + r0 = rf(id, group, force) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*marathon.DeploymentID) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(string, *marathon.Group, bool) error); ok { + r1 = rf(id, group, force) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// WaitOnApplication provides a mock function with given fields: name, timeout +func (_m *Marathon) WaitOnApplication(name string, timeout time.Duration) error { + ret := _m.Called(name, timeout) + + var r0 error + if rf, ok := ret.Get(0).(func(string, time.Duration) error); ok { + r0 = rf(name, timeout) + } else { + r0 = ret.Error(0) } return r0 } -// Ping provides a mock function with given fields: -func (_m *Marathon) Ping() (bool, error) { - ret := _m.Called() +// WaitOnDeployment provides a mock function with given fields: id, timeout +func (_m *Marathon) WaitOnDeployment(id string, timeout time.Duration) error { + ret := _m.Called(id, timeout) - var r0 bool - if rf, ok := ret.Get(0).(func() bool); ok { - r0 = rf() + var r0 error + if rf, ok := ret.Get(0).(func(string, time.Duration) error); ok { + r0 = rf(id, timeout) } else { - r0 = ret.Get(0).(bool) + r0 = ret.Error(0) } - var r1 error - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() + return r0 +} + +// WaitOnGroup provides a mock function with given fields: name, timeout +func (_m *Marathon) WaitOnGroup(name string, timeout time.Duration) error { + ret := _m.Called(name, timeout) + + var r0 error + if rf, ok := ret.Get(0).(func(string, time.Duration) error); ok { + r0 = rf(name, timeout) } else { - r1 = ret.Error(1) + r0 = ret.Error(0) } - return r0, r1 -} - -// Info provides a mock function with given fields: -func (_m *Marathon) Info() (*marathon.Info, error) { - ret := _m.Called() - - var r0 *marathon.Info - if rf, ok := ret.Get(0).(func() *marathon.Info); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*marathon.Info) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Leader provides a mock function with given fields: -func (_m *Marathon) Leader() (string, error) { - ret := _m.Called() - - var r0 string - if rf, ok := ret.Get(0).(func() string); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(string) - } - - var r1 error - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// AbdicateLeader provides a mock function with given fields: -func (_m *Marathon) AbdicateLeader() (string, error) { - ret := _m.Called() - - var r0 string - if rf, ok := ret.Get(0).(func() string); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(string) - } - - var r1 error - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ApplicationBy mocks the marathon client function but does nothing -func (_m *Marathon) ApplicationBy(name string, opts *marathon.GetAppOpts) (*marathon.Application, error) { - return nil, nil -} - -// Subscribe mocks the marathon client function but does nothing -func (_m *Marathon) Subscribe(string) error { - return nil -} - -// Queue mocks the marathon client function but does nothing -func (_m *Marathon) Queue() (*marathon.Queue, error) { - return nil, nil -} - -// DeleteQueueDelay mocks the marathon client function but does nothing -func (_m *Marathon) DeleteQueueDelay(appID string) error { - return nil -} - -// GroupsBy mocks the marathon client function but does nothing -func (_m *Marathon) GroupsBy(opts *marathon.GetGroupOpts) (*marathon.Groups, error) { - return nil, nil -} - -// GroupBy mocks the marathon client function but does nothing -func (_m *Marathon) GroupBy(name string, opts *marathon.GetGroupOpts) (*marathon.Group, error) { - return nil, nil + return r0 }