mockcbt

package module
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

README

go-mockcbt

CircleCI GoDoc

Package mockcbt mocks Google Cloud BigTable for Golang testing.

Documentation

Overview

Package mockcbt mocks Google Cloud BigTable for Golang testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockBtAdminServer

type MockBtAdminServer struct {
	*MockServer
}

func NewAdmin

NewAdmin creates a new BigTable AdminClient and MockServer

func (*MockBtAdminServer) CreateAppProfile

func (s *MockBtAdminServer) CreateAppProfile(ctx context.Context, req *pb.CreateAppProfileRequest) (*pb.AppProfile, error)

Creates an app profile within an instance.

func (*MockBtAdminServer) CreateCluster

Creates a cluster within an instance.

func (*MockBtAdminServer) CreateInstance

Create an instance within a project.

func (*MockBtAdminServer) DeleteAppProfile

func (s *MockBtAdminServer) DeleteAppProfile(ctx context.Context, req *pb.DeleteAppProfileRequest) (*empty.Empty, error)

Deletes an app profile from an instance.

func (*MockBtAdminServer) DeleteCluster

func (s *MockBtAdminServer) DeleteCluster(ctx context.Context, req *pb.DeleteClusterRequest) (*empty.Empty, error)

Deletes a cluster from an instance.

func (*MockBtAdminServer) DeleteInstance

func (s *MockBtAdminServer) DeleteInstance(ctx context.Context, req *pb.DeleteInstanceRequest) (*empty.Empty, error)

Delete an instance from a project.

func (*MockBtAdminServer) GetAppProfile

func (s *MockBtAdminServer) GetAppProfile(ctx context.Context, req *pb.GetAppProfileRequest) (*pb.AppProfile, error)

Gets information about an app profile.

func (*MockBtAdminServer) GetCluster

func (s *MockBtAdminServer) GetCluster(ctx context.Context, req *pb.GetClusterRequest) (*pb.Cluster, error)

Gets information about a cluster.

func (*MockBtAdminServer) GetIamPolicy

func (s *MockBtAdminServer) GetIamPolicy(ctx context.Context, req *v1.GetIamPolicyRequest) (*v1.Policy, error)

Gets the access control policy for an instance resource. Returns an empty policy if an instance exists but does not have a policy set.

func (*MockBtAdminServer) GetInstance

func (s *MockBtAdminServer) GetInstance(ctx context.Context, req *pb.GetInstanceRequest) (*pb.Instance, error)

Gets information about an instance.

func (*MockBtAdminServer) ListAppProfiles

Lists information about app profiles in an instance.

func (*MockBtAdminServer) ListClusters

Lists information about clusters in an instance.

func (*MockBtAdminServer) ListHotTablets added in v1.0.3

Lists hot tablets in a cluster, within the time range provided. Hot tablets are ordered based on CPU usage.

func (*MockBtAdminServer) ListInstances

Lists information about instances in a project.

func (*MockBtAdminServer) PartialUpdateCluster added in v1.0.3

To disable autoscaling, clear cluster_config.cluster_autoscaling_config, and explicitly set a serve_node count via the update_mask.

func (*MockBtAdminServer) PartialUpdateInstance

Partially updates an instance within a project.

func (*MockBtAdminServer) SetIamPolicy

func (s *MockBtAdminServer) SetIamPolicy(ctx context.Context, req *v1.SetIamPolicyRequest) (*v1.Policy, error)

Sets the access control policy on an instance resource. Replaces any existing policy.

func (*MockBtAdminServer) TestIamPermissions

Returns permissions that the caller has on the specified instance resource.

func (*MockBtAdminServer) UpdateAppProfile

Updates an app profile within an instance.

func (*MockBtAdminServer) UpdateCluster

func (s *MockBtAdminServer) UpdateCluster(ctx context.Context, req *pb.Cluster) (*longrunning.Operation, error)

Updates a cluster within an instance.

func (*MockBtAdminServer) UpdateInstance

func (s *MockBtAdminServer) UpdateInstance(ctx context.Context, req *pb.Instance) (*pb.Instance, error)

Updates an instance within a project.

type MockBtServer

type MockBtServer struct {
	*MockServer
}

func New

func New() (*bigtable.Client, *MockBtServer, error)

New creates a new BigTable Client and MockServer

func (*MockBtServer) CheckAndMutateRow

CheckAndMutateRow mutates a row atomically based on the output of a predicate Reader filter.

func (*MockBtServer) MutateRow

MutateRow mutates a row atomically. Cells already present in the row are left unchanged unless explicitly changed by `mutation`.

func (*MockBtServer) MutateRows

MutateRows mutates multiple rows in a batch. Each individual row is mutated atomically as in MutateRow, but the entire batch is not executed atomically.

func (*MockBtServer) ReadModifyWriteRow

ReadModifyWriteRow modifies a row atomically on the server. The method reads the latest existing timestamp and value from the specified columns and writes a new entry based on predefined read/modify/write rules. The new value for the timestamp is the greater of the existing timestamp or the current server time. The method returns the new contents of all modified cells.

func (*MockBtServer) ReadRows

ReadRows streams back the contents of all requested rows in key order, optionally applying the same Reader filter to each. Depending on their size, rows and cells may be broken up across multiple responses, but atomicity of each row will still be preserved. See the ReadRowsResponse documentation for details.

func (*MockBtServer) SampleRowKeys

type MockServer

type MockServer struct {
	pb.BigtableServer
	Addr string
	// contains filtered or unexported fields
}

MockServer mocks the pb.BigtableServer interface

func (*MockServer) AddRPC

func (s *MockServer) AddRPC(wantReq proto.Message, resp interface{})

AddRPC adds a (request, response) pair to the server's list of expected interactions. The server will compare the incoming request with wantReq using proto.Equal. The response can be a message or an error.

For the Listen RPC, resp should be a []interface{}, where each element is either ListenResponse or an error.

Passing nil for wantReq disables the request check.

func (*MockServer) AddRPCAdjust

func (s *MockServer) AddRPCAdjust(wantReq proto.Message, resp interface{}, adjust func(gotReq proto.Message))

AddRPCAdjust is like AddRPC, but accepts a function that can be used to tweak the requests before comparison, for example to adjust for randomness.

func (*MockServer) Reset

func (s *MockServer) Reset()

Reset returns the MockServer to an empty state.

Jump to

Keyboard shortcuts

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