buildbucket

package
v0.0.0-...-d72fac8 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package buildbucket contains logic of interacting with Buildbucket.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UseFakeClient

func UseFakeClient(ctx context.Context, builds map[int64]*bbpb.Build) context.Context

UseFakeClient installs a fake buildbucket client into the context, with the given build data.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the client to communicate with Buildbucket. It wraps a bbpb.BuildsClient.

func NewClient

func NewClient(ctx context.Context, host, project string) (*Client, error)

NewClient creates a client to communicate with Buildbucket, acting as the given LUCI project.

func (*Client) GetBuild

func (c *Client) GetBuild(ctx context.Context, req *bbpb.GetBuildRequest) (*bbpb.Build, error)

GetBuild returns bbpb.Build for the requested build.

type FakeClient

type FakeClient struct {
	Builds map[int64]*bbpb.Build
}

FakeClient is a fake implementation of bbpb.BuildsClient for testing.

func (*FakeClient) GetBuild

func (f *FakeClient) GetBuild(ctx context.Context, in *bbpb.GetBuildRequest, opts ...grpc.CallOption) (*bbpb.Build, error)

GetBuild provides an implementation of the GetBuild RPC using an in-memory list of builds.

type GetBuildsClient

type GetBuildsClient interface {
	GetBuild(ctx context.Context, in *bbpb.GetBuildRequest, opts ...grpc.CallOption) (*bbpb.Build, error)
}

type MockedClient

type MockedClient struct {
	Client *bbpb.MockBuildsClient
	Ctx    context.Context
}

MockedClient is a mocked Buildbucket client for testing. It wraps a bbpb.MockBuildsClient and a context with the mocked client.

func NewMockedClient

func NewMockedClient(ctx context.Context, ctl *gomock.Controller) *MockedClient

NewMockedClient creates a MockedClient for testing.

func (*MockedClient) GetBuild

func (mc *MockedClient) GetBuild(req *bbpb.GetBuildRequest, res *bbpb.Build)

GetBuild Mocks the GetBuild RPC.

Jump to

Keyboard shortcuts

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