github.com/justincormack/cli@v0.0.0-20201215022714-831ebeae9675/cli/command/task/client_test.go (about)

     1  package task
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/docker/docker/api/types"
     7  	"github.com/docker/docker/api/types/swarm"
     8  	"github.com/docker/docker/client"
     9  )
    10  
    11  type fakeClient struct {
    12  	client.APIClient
    13  	nodeInspectWithRaw    func(ref string) (swarm.Node, []byte, error)
    14  	serviceInspectWithRaw func(ref string, options types.ServiceInspectOptions) (swarm.Service, []byte, error)
    15  }
    16  
    17  func (cli *fakeClient) NodeInspectWithRaw(ctx context.Context, ref string) (swarm.Node, []byte, error) {
    18  	if cli.nodeInspectWithRaw != nil {
    19  		return cli.nodeInspectWithRaw(ref)
    20  	}
    21  	return swarm.Node{}, nil, nil
    22  }
    23  
    24  func (cli *fakeClient) ServiceInspectWithRaw(ctx context.Context, ref string, options types.ServiceInspectOptions) (swarm.Service, []byte, error) {
    25  	if cli.serviceInspectWithRaw != nil {
    26  		return cli.serviceInspectWithRaw(ref, options)
    27  	}
    28  	return swarm.Service{}, nil, nil
    29  }