cloudtasks

package
v0.0.0-...-e560ebb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2021 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeServer

type FakeServer struct {
	taskspb.UnimplementedCloudTasksServer
	// CreateTaskRequest is set by calls to CreateTask.
	CreateTaskRequest *taskspb.CreateTaskRequest
	// CreateTaskResponse is returned by calls to CreateTask.
	CreateTaskResponse *taskspb.Task
	// CreateTaskError is returned by calls to CreateTask
	CreateTaskError error
	// contains filtered or unexported fields
}

FakeServer implements an in-memory fake implementation of a Cloud Tasks server, suitable for unit testing.

func (*FakeServer) CreateTask

func (s *FakeServer) CreateTask(ctx context.Context, req *taskspb.CreateTaskRequest) (*taskspb.Task, error)

CreateTask stores a reference to req and returns the return values set in s.

func (*FakeServer) NewClient

func (s *FakeServer) NewClient(ctx context.Context) (*cloudtasks.Client, error)

NewClient returns a cloudtasks.Client instance for a fake server, suitable for in-memory unit tests.

func (*FakeServer) Start

func (s *FakeServer) Start(ctx context.Context) (*grpc.Server, error)

Start listens to a randomly selected port on localhost, registers a grpc sever for fakeServer, starts the server and returns the server address and server instance. It is up to the caller to shut down the server instance.

type Options

type Options struct {
	*grpcclient.Options
}

Options describes the client configuration for cloudtasks.

func NewOptionsFromFlags

func NewOptionsFromFlags() *Options

NewOptionsFromFlags returns an Options instance populated from command line flag options.

func (*Options) NewClient

func (c *Options) NewClient(ctx context.Context) (*cloudtasks.Client, error)

NewClient returns a cloudtasks Client according to Options settings.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL