mirror of https://github.com/docker/cli.git
36 lines
936 B
Go
36 lines
936 B
Go
package service
|
|
|
|
import (
|
|
"github.com/docker/docker/api/types"
|
|
"github.com/docker/docker/api/types/swarm"
|
|
"github.com/docker/docker/client"
|
|
"golang.org/x/net/context"
|
|
)
|
|
|
|
type fakeClient struct {
|
|
client.Client
|
|
serviceListFunc func(context.Context, types.ServiceListOptions) ([]swarm.Service, error)
|
|
}
|
|
|
|
func (f *fakeClient) ServiceList(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error) {
|
|
if f.serviceListFunc != nil {
|
|
return f.serviceListFunc(ctx, options)
|
|
}
|
|
return nil, nil
|
|
}
|
|
|
|
func (f *fakeClient) TaskList(ctx context.Context, options types.TaskListOptions) ([]swarm.Task, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
func (f *fakeClient) NodeList(ctx context.Context, options types.NodeListOptions) ([]swarm.Node, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
func newService(id string, name string) swarm.Service {
|
|
return swarm.Service{
|
|
ID: id,
|
|
Spec: swarm.ServiceSpec{Annotations: swarm.Annotations{Name: name}},
|
|
}
|
|
}
|