2017-06-29 17:35:26 -04:00
|
|
|
package task
|
|
|
|
|
|
|
|
import (
|
2018-05-03 21:02:44 -04:00
|
|
|
"context"
|
|
|
|
|
2017-06-29 17:35:26 -04:00
|
|
|
"github.com/docker/docker/api/types"
|
|
|
|
"github.com/docker/docker/api/types/swarm"
|
|
|
|
"github.com/docker/docker/client"
|
|
|
|
)
|
|
|
|
|
|
|
|
type fakeClient struct {
|
|
|
|
client.APIClient
|
|
|
|
nodeInspectWithRaw func(ref string) (swarm.Node, []byte, error)
|
|
|
|
serviceInspectWithRaw func(ref string, options types.ServiceInspectOptions) (swarm.Service, []byte, error)
|
|
|
|
}
|
|
|
|
|
2023-03-30 10:39:06 -04:00
|
|
|
func (cli *fakeClient) NodeInspectWithRaw(_ context.Context, ref string) (swarm.Node, []byte, error) {
|
2017-06-29 17:35:26 -04:00
|
|
|
if cli.nodeInspectWithRaw != nil {
|
|
|
|
return cli.nodeInspectWithRaw(ref)
|
|
|
|
}
|
|
|
|
return swarm.Node{}, nil, nil
|
|
|
|
}
|
|
|
|
|
2023-03-30 10:39:06 -04:00
|
|
|
func (cli *fakeClient) ServiceInspectWithRaw(_ context.Context, ref string, options types.ServiceInspectOptions) (swarm.Service, []byte, error) {
|
2017-06-29 17:35:26 -04:00
|
|
|
if cli.serviceInspectWithRaw != nil {
|
|
|
|
return cli.serviceInspectWithRaw(ref, options)
|
|
|
|
}
|
|
|
|
return swarm.Service{}, nil, nil
|
|
|
|
}
|