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 AssertSrvVSchemaSlicesEqual(t *testing.T, expected []*vtadminpb.SrvVSchema, actual []*vtadminpb.SrvVSchema)
- func AssertTabletSlicesEqual(t *testing.T, expected []*vtadminpb.Tablet, actual []*vtadminpb.Tablet)
- func BuildCluster(t testing.TB, cfg TestClusterConfig) *cluster.Cluster
- func BuildClusters(t testing.TB, cfgs ...TestClusterConfig) []*cluster.Cluster
- func TopodataTabletsFromVTAdminTablets(tablets []*vtadminpb.Tablet) []*topodatapb.Tablet
- type Dbcfg
- type IntegrationTestCluster
- type TestClusterConfig
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 ...any)
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 ...any)
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)
AssertKeyspaceSlicesEqual is a convenience function to assert that two []*vtadminpb.Keyspaces slices are equal
func AssertSchemaSlicesEqual ¶
func AssertSchemaSlicesEqual(t *testing.T, expected []*vtadminpb.Schema, actual []*vtadminpb.Schema)
AssertSchemaSlicesEqual is a convenience function to assert that two []*vtadminpb.Schema slices are equal
func AssertSrvVSchemaSlicesEqual ¶ added in v0.11.0
func AssertSrvVSchemaSlicesEqual(t *testing.T, expected []*vtadminpb.SrvVSchema, actual []*vtadminpb.SrvVSchema)
AssertSrvVSchemaSlicesEqual is a convenience function to assert that two []*vtadminpb.SrvVSchema slices are equal
func AssertTabletSlicesEqual ¶
func AssertTabletSlicesEqual(t *testing.T, expected []*vtadminpb.Tablet, actual []*vtadminpb.Tablet)
AssertTabletSlicesEqual is a convenience function to assert that two []*vtadminpb.Tablet slices are equal
func BuildCluster ¶
func BuildCluster(t testing.TB, cfg TestClusterConfig) *cluster.Cluster
BuildCluster is a shared helper for building a cluster based on the given test configuration.
func BuildClusters ¶
func BuildClusters(t testing.TB, 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 IntegrationTestCluster ¶ added in v0.13.0
type IntegrationTestCluster struct { Cluster *cluster.Cluster Topo *topo.Server TopoFactory *memorytopo.Factory }
IntegrationTestCluster is a vtadmin cluster suitable for use in integration tests. It contains the cluster struct, the topo server backing the cluster, and the memorytopo.Factory to force topo errors for certain test cases.
func BuildIntegrationTestCluster ¶ added in v0.13.0
func BuildIntegrationTestCluster(t testing.TB, c *vtadminpb.Cluster, cells ...string) *IntegrationTestCluster
BuildIntegrationTestCluster is a helper for building a test cluster with a real grpcvtctldserver-backing implementation.
(TODO|@ajm188): Unify this with the BuildCluster API. Also this does not support any cluster methods that involve vtgate/vitessdriver queries.
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 // Config controls certain cluster config options, primarily used to // properly setup various RPC pools for different testing scenarios. // Other fields (such as ID, Name, and DiscoveryImpl) are ignored. Config *cluster.Config }
TestClusterConfig controls the way that a cluster.Cluster object is constructed for testing vtadmin code.