Documentation ¶
Index ¶
- func AssertClusterWorkflowsEqual(t *testing.T, expected *vtadminpb.ClusterWorkflows, ...)
- func AssertGetWorkflowsResponsesEqual(t *testing.T, expected *vtadminpb.GetWorkflowsResponse, ...)
- func AssertKeyspaceSlicesEqual(t *testing.T, expected []*vtadminpb.Keyspace, actual []*vtadminpb.Keyspace, ...)
- func AssertSchemaSlicesEqual(t *testing.T, expected []*vtadminpb.Schema, actual []*vtadminpb.Schema, ...)
- func AssertTabletSlicesEqual(t *testing.T, expected []*vtadminpb.Tablet, actual []*vtadminpb.Tablet, ...)
- func AssertTabletsEqual(t *testing.T, expected *vtadminpb.Tablet, actual *vtadminpb.Tablet, ...)
- func BuildCluster(cfg TestClusterConfig) *cluster.Cluster
- func BuildClusters(cfgs ...TestClusterConfig) []*cluster.Cluster
- func TopodataTabletsFromVTAdminTablets(tablets []*vtadminpb.Tablet) []*topodatapb.Tablet
- type Dbcfg
- type TestClusterConfig
- type VtctldClient
- func (fake *VtctldClient) FindAllShardsInKeyspace(ctx context.Context, req *vtctldatapb.FindAllShardsInKeyspaceRequest, ...) (*vtctldatapb.FindAllShardsInKeyspaceResponse, error)
- func (fake *VtctldClient) GetKeyspaces(ctx context.Context, req *vtctldatapb.GetKeyspacesRequest, ...) (*vtctldatapb.GetKeyspacesResponse, error)
- func (fake *VtctldClient) GetSchema(ctx context.Context, req *vtctldatapb.GetSchemaRequest, ...) (*vtctldatapb.GetSchemaResponse, error)
- func (fake *VtctldClient) GetVSchema(ctx context.Context, req *vtctldatapb.GetVSchemaRequest, ...) (*vtctldatapb.GetVSchemaResponse, error)
- func (fake *VtctldClient) GetWorkflows(ctx context.Context, req *vtctldatapb.GetWorkflowsRequest, ...) (*vtctldatapb.GetWorkflowsResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertClusterWorkflowsEqual ¶
func AssertClusterWorkflowsEqual(t *testing.T, expected *vtadminpb.ClusterWorkflows, actual *vtadminpb.ClusterWorkflows, msgAndArgs ...interface{})
AssertClusterWorkflowsEqual is a test helper for asserting that two ClusterWorkflows objects are equal.
func AssertGetWorkflowsResponsesEqual ¶
func AssertGetWorkflowsResponsesEqual(t *testing.T, expected *vtadminpb.GetWorkflowsResponse, actual *vtadminpb.GetWorkflowsResponse, msgAndArgs ...interface{})
AssertGetWorkflowsResponsesEqual is a test helper for asserting that two GetWorkflowsResponse objects are equal.
func AssertKeyspaceSlicesEqual ¶
func AssertKeyspaceSlicesEqual(t *testing.T, expected []*vtadminpb.Keyspace, actual []*vtadminpb.Keyspace, msgAndArgs ...interface{})
AssertKeyspaceSlicesEqual is a convenience function to assert that two []*vtadminpb.Keyspaces slices are equal, after clearing out any reserved proto XXX_ fields.
func AssertSchemaSlicesEqual ¶
func AssertSchemaSlicesEqual(t *testing.T, expected []*vtadminpb.Schema, actual []*vtadminpb.Schema, msgAndArgs ...interface{})
AssertSchemaSlicesEqual is a convenience function to assert that two []*vtadminpb.Schema slices are equal, after clearing out any reserved proto XXX_ fields.
func AssertTabletSlicesEqual ¶
func AssertTabletSlicesEqual(t *testing.T, expected []*vtadminpb.Tablet, actual []*vtadminpb.Tablet, msgAndArgs ...interface{})
AssertTabletSlicesEqual is a convenience function to assert that two []*vtadminpb.Tablet slices are equal, after clearing out any reserved proto XXX_ fields.
func AssertTabletsEqual ¶
func AssertTabletsEqual(t *testing.T, expected *vtadminpb.Tablet, actual *vtadminpb.Tablet, msgAndArgs ...interface{})
AssertTabletsEqual is a convenience function to assert that two *vtadminpb.Tablets are equal, after clearing out any reserved proto XXX_ fields.
func BuildCluster ¶
func BuildCluster(cfg TestClusterConfig) *cluster.Cluster
BuildCluster is a shared helper for building a cluster based on the given test configuration.
func BuildClusters ¶
func BuildClusters(cfgs ...TestClusterConfig) []*cluster.Cluster
BuildClusters is a helper for building multiple clusters from a slice of TestClusterConfigs.
func TopodataTabletsFromVTAdminTablets ¶
func TopodataTabletsFromVTAdminTablets(tablets []*vtadminpb.Tablet) []*topodatapb.Tablet
TopodataTabletsFromVTAdminTablets returns a slice of topodatapb.Tablet objects from a slice of vtadminpb.Tablet objects. It is the equivalent of
map(func(t *vtadminpb.Tablet) (*topodatapb.Tablet) { return t.Tablet }, tablets)
Types ¶
type Dbcfg ¶
type Dbcfg struct {
ShouldErr bool
}
Dbcfg is a test utility for controlling the behavior of the cluster's DB at the package sql level.
type TestClusterConfig ¶
type TestClusterConfig struct { // Cluster provides the protobuf-based version of the cluster info. It is // to set the ID and Name of the resulting cluster.Cluster, as well as to // name a single, phony, vtgate entry in the cluster's discovery service. Cluster *vtadminpb.Cluster // VtctldClient provides the vtctldclient.VtctldClient implementation the // cluster's vtctld proxy will use. Most unit tests will use an instance of // the VtctldClient type provided by this package in order to mock out the // vtctld layer. VtctldClient vtctldclient.VtctldClient // Tablets provides the set of tablets reachable by this cluster's vtsql.DB. // Tablets are copied, and then mutated to have their Cluster field set to // match the Cluster provided by this TestClusterConfig, so mutations are // transparent to the caller. Tablets []*vtadminpb.Tablet // DBConfig controls the behavior of the cluster's vtsql.DB. DBConfig Dbcfg }
TestClusterConfig controls the way that a cluster.Cluster object is constructed for testing vtadmin code.
type VtctldClient ¶
type VtctldClient struct { vtctldclient.VtctldClient FindAllShardsInKeyspaceResults map[string]struct { Response *vtctldatapb.FindAllShardsInKeyspaceResponse Error error } GetKeyspacesResults struct { Keyspaces []*vtctldatapb.Keyspace Error error } GetSchemaResults map[string]struct { Response *vtctldatapb.GetSchemaResponse Error error } GetVSchemaResults map[string]struct { Response *vtctldatapb.GetVSchemaResponse Error error } GetWorkflowsResults map[string]struct { Response *vtctldatapb.GetWorkflowsResponse Error error } }
VtctldClient provides a partial mock implementation of the vtctldclient.VtctldClient interface for use in testing.
func (*VtctldClient) FindAllShardsInKeyspace ¶
func (fake *VtctldClient) FindAllShardsInKeyspace(ctx context.Context, req *vtctldatapb.FindAllShardsInKeyspaceRequest, opts ...grpc.CallOption) (*vtctldatapb.FindAllShardsInKeyspaceResponse, error)
FindAllShardsInKeyspace is part of the vtctldclient.VtctldClient interface.
func (*VtctldClient) GetKeyspaces ¶
func (fake *VtctldClient) GetKeyspaces(ctx context.Context, req *vtctldatapb.GetKeyspacesRequest, opts ...grpc.CallOption) (*vtctldatapb.GetKeyspacesResponse, error)
GetKeyspaces is part of the vtctldclient.VtctldClient interface.
func (*VtctldClient) GetSchema ¶
func (fake *VtctldClient) GetSchema(ctx context.Context, req *vtctldatapb.GetSchemaRequest, opts ...grpc.CallOption) (*vtctldatapb.GetSchemaResponse, error)
GetSchema is part of the vtctldclient.VtctldClient interface.
func (*VtctldClient) GetVSchema ¶
func (fake *VtctldClient) GetVSchema(ctx context.Context, req *vtctldatapb.GetVSchemaRequest, opts ...grpc.CallOption) (*vtctldatapb.GetVSchemaResponse, error)
GetVSchema is part of the vtctldclient.VtctldClient interface.
func (*VtctldClient) GetWorkflows ¶
func (fake *VtctldClient) GetWorkflows(ctx context.Context, req *vtctldatapb.GetWorkflowsRequest, opts ...grpc.CallOption) (*vtctldatapb.GetWorkflowsResponse, error)
GetWorkflows is part of the vtctldclient.VtctldClient interface.