Documentation
¶
Index ¶
- Constants
- func Run(cmd *exec.Cmd, name, startCheck string) ifrit.Process
- type CmdParameters
- type CommitterRuntime
- func (c *CommitterRuntime) AddOrUpdateNamespaces(t *testing.T, namespaces ...string)
- func (c *CommitterRuntime) CountAlternateStatus(t *testing.T, status protoblocktx.Status) int
- func (c *CommitterRuntime) CountStatus(t *testing.T, status protoblocktx.Status) int
- func (c *CommitterRuntime) CreateNamespacesAndCommit(t *testing.T, namespaces ...string)
- func (c *CommitterRuntime) MakeAndSendTransactionsToOrderer(t *testing.T, txsNs [][]*protoblocktx.TxNamespace, ...) []string
- func (c *CommitterRuntime) SendTransactionsToOrderer(t *testing.T, txs []*protoloadgen.TX, expectedStatus []protoblocktx.Status) []string
- func (c *CommitterRuntime) Start(t *testing.T, serviceFlags int)
- func (c *CommitterRuntime) ValidateExpectedResultsInCommittedBlock(t *testing.T, expected *ExpectedStatusInBlock)
- type Config
- type Crypto
- type DBClusterController
- func (cc *DBClusterController) GetClusterSize() int
- func (cc *DBClusterController) GetNodesContainerID(t *testing.T) []string
- func (cc *DBClusterController) GetSingleNodeByRole(role string) (*dbtest.DatabaseContainer, int)
- func (cc *DBClusterController) IterNodesByRole(role string) iter.Seq2[int, *dbtest.DatabaseContainer]
- func (cc *DBClusterController) StopAndRemoveSingleNodeByIndex(t *testing.T, index int)
- func (cc *DBClusterController) StopAndRemoveSingleNodeByRole(t *testing.T, role string)
- type ExpectedStatusInBlock
- type PostgresClusterController
- type ProcessWithConfig
- type YugaClusterController
Constants ¶
const ( // PrimaryNode represents a primary postgres db node. PrimaryNode = "primary" // SecondaryNode represents a secondary postgres db node. SecondaryNode = "secondary" )
const ( Orderer = 1 << iota Sidecar Coordinator Verifier VC QueryService LoadGenForOnlyOrderer LoadGenForOrderer LoadGenForCommitter LoadGenForCoordinator LoadGenForVerifier LoadGenForVCService LoadGenForDistributedLoadGen CommitterTxPath = Sidecar | Coordinator | Verifier | VC FullTxPath = Orderer | CommitterTxPath FullTxPathWithLoadGen = FullTxPath | LoadGenForOrderer FullTxPathWithQuery = FullTxPath | QueryService CommitterTxPathWithLoadGen = CommitterTxPath | LoadGenForCommitter TestChannelName = "channel1" )
Service flags.
const ( // MasterNode represents yugabyte master db node. MasterNode = "master" // TabletNode represents yugabyte tablet db node. TabletNode = "tablet" // LeaderMasterNode represents the yugabyte master node currently serving as the Raft leader. LeaderMasterNode = "leader" // FollowerMasterNode represents a yugabyte master node that is not the leader (a follower). FollowerMasterNode = "follower" )
Variables ¶
This section is empty.
Functions ¶
func Run ¶
Run executes the specified command and returns the corresponding process. It is important to note that the underlying invocation function (Invoke) returns only when either process.Ready or process.Wait has been read. Consequently, the caller only needs to read process.Wait to wait for the process to complete and capture any errors that may have occurred during execution.
Types ¶
type CmdParameters ¶
CmdParameters holds the parameters for a command.
type CommitterRuntime ¶
type CommitterRuntime struct { SystemConfig config.SystemConfig MockOrderer *ProcessWithConfig Sidecar *ProcessWithConfig Coordinator *ProcessWithConfig QueryService *ProcessWithConfig Verifier []*ProcessWithConfig VcService []*ProcessWithConfig CoordinatorClient protocoordinatorservice.CoordinatorClient QueryServiceClient protoqueryservice.QueryServiceClient CommittedBlock chan *common.Block TxBuilder *workload.TxBuilder LastReceivedBlockNumber uint64 // contains filtered or unexported fields }
CommitterRuntime represents a test system of Coordinator, SigVerifier, VCService and Query processes.
func NewRuntime ¶
func NewRuntime(t *testing.T, conf *Config) *CommitterRuntime
NewRuntime creates a new test runtime.
func (*CommitterRuntime) AddOrUpdateNamespaces ¶ added in v0.1.6
func (c *CommitterRuntime) AddOrUpdateNamespaces(t *testing.T, namespaces ...string)
AddOrUpdateNamespaces adds policies for namespaces. If already exists, the policy will be updated.
func (*CommitterRuntime) CountAlternateStatus ¶
func (c *CommitterRuntime) CountAlternateStatus(t *testing.T, status protoblocktx.Status) int
CountAlternateStatus returns the number of transactions not with a given tx status.
func (*CommitterRuntime) CountStatus ¶
func (c *CommitterRuntime) CountStatus(t *testing.T, status protoblocktx.Status) int
CountStatus returns the number of transactions with a given tx status.
func (*CommitterRuntime) CreateNamespacesAndCommit ¶
func (c *CommitterRuntime) CreateNamespacesAndCommit(t *testing.T, namespaces ...string)
CreateNamespacesAndCommit creates namespaces in the committer.
func (*CommitterRuntime) MakeAndSendTransactionsToOrderer ¶ added in v0.1.6
func (c *CommitterRuntime) MakeAndSendTransactionsToOrderer( t *testing.T, txsNs [][]*protoblocktx.TxNamespace, expectedStatus []protoblocktx.Status, ) []string
MakeAndSendTransactionsToOrderer creates a block with given transactions, send it to the committer, and verify the result.
func (*CommitterRuntime) SendTransactionsToOrderer ¶
func (c *CommitterRuntime) SendTransactionsToOrderer( t *testing.T, txs []*protoloadgen.TX, expectedStatus []protoblocktx.Status, ) []string
SendTransactionsToOrderer creates a block with given transactions, send it to the committer, and verify the result.
func (*CommitterRuntime) Start ¶
func (c *CommitterRuntime) Start(t *testing.T, serviceFlags int)
Start runs all services and load generator as configured by the serviceFlags.
func (*CommitterRuntime) ValidateExpectedResultsInCommittedBlock ¶
func (c *CommitterRuntime) ValidateExpectedResultsInCommittedBlock(t *testing.T, expected *ExpectedStatusInBlock)
ValidateExpectedResultsInCommittedBlock validates the status of transactions in the committed block.
type Config ¶
type Config struct { NumVerifiers int NumVCService int BlockSize uint64 BlockTimeout time.Duration LoadgenBlockLimit uint64 // DBCluster configures the cluster to operate in DB cluster mode. DBCluster *dbtest.Connection // CrashTest is true to indicate a service crash is expected, and not a failure. CrashTest bool }
Config represents the runtime configuration.
type Crypto ¶
type Crypto struct { Namespace string Profile *workload.Policy HashSigner *workload.HashSignerVerifier NsSigner *sigtest.NsSigner PubKey []byte PubKeyPath string }
Crypto holds crypto material for a namespace.
type DBClusterController ¶
type DBClusterController struct {
// contains filtered or unexported fields
}
DBClusterController is a class that facilitates the manipulation of a DB cluster, with its nodes running in Docker containers.
func (*DBClusterController) GetClusterSize ¶
func (cc *DBClusterController) GetClusterSize() int
GetClusterSize returns the number of active nodes in the cluster.
func (*DBClusterController) GetNodesContainerID ¶
func (cc *DBClusterController) GetNodesContainerID(t *testing.T) []string
GetNodesContainerID returns the container IDs of the current nodes.
func (*DBClusterController) GetSingleNodeByRole ¶ added in v0.1.6
func (cc *DBClusterController) GetSingleNodeByRole(role string) (*dbtest.DatabaseContainer, int)
GetSingleNodeByRole returns the first node that matches the requested role in the cluster.
func (*DBClusterController) IterNodesByRole ¶ added in v0.1.6
func (cc *DBClusterController) IterNodesByRole(role string) iter.Seq2[int, *dbtest.DatabaseContainer]
IterNodesByRole returns an iterator over the cluster's nodes that match the given role.
func (*DBClusterController) StopAndRemoveSingleNodeByIndex ¶ added in v0.1.6
func (cc *DBClusterController) StopAndRemoveSingleNodeByIndex(t *testing.T, index int)
StopAndRemoveSingleNodeByIndex stop and remove the node in the provided index.
func (*DBClusterController) StopAndRemoveSingleNodeByRole ¶ added in v0.1.6
func (cc *DBClusterController) StopAndRemoveSingleNodeByRole(t *testing.T, role string)
StopAndRemoveSingleNodeByRole stops and removes a node given a role.
type ExpectedStatusInBlock ¶
type ExpectedStatusInBlock struct { TxIDs []string Statuses []protoblocktx.Status }
ExpectedStatusInBlock holds pairs of expected txID and the corresponding status in a block. The order of statuses is expected to be the same as in the committed block.
type PostgresClusterController ¶
type PostgresClusterController struct {
DBClusterController
}
PostgresClusterController is a struct that facilitates the manipulation of postgres cluster, with its nodes running in Docker containers. We create a cluster of size 2; one primary and one secondary.
func StartPostgresCluster ¶
func StartPostgresCluster(ctx context.Context, t *testing.T) (*PostgresClusterController, *dbtest.Connection)
StartPostgresCluster creates a postgres cluster in a Docker environment and returns its connection properties.
func (*PostgresClusterController) PromoteSecondaryNode ¶ added in v0.1.6
func (cc *PostgresClusterController) PromoteSecondaryNode(t *testing.T)
PromoteSecondaryNode runs a script that promotes the first follower db node it finds, from read-only to read-write node.
type ProcessWithConfig ¶
type ProcessWithConfig struct {
// contains filtered or unexported fields
}
ProcessWithConfig holds the ifrit process and the corresponding configuration.
func (*ProcessWithConfig) Restart ¶
func (p *ProcessWithConfig) Restart(t *testing.T)
Restart stops the process if it is running and then starts it.
func (*ProcessWithConfig) Stop ¶
func (p *ProcessWithConfig) Stop(t *testing.T)
Stop stops the running process.
type YugaClusterController ¶
type YugaClusterController struct { DBClusterController // contains filtered or unexported fields }
YugaClusterController is a struct that facilitates the manipulation of a DB cluster, with nodes running in Docker containers. It allows configuring the number of master and tablet nodes. The cluster's replication factor (RF) is determined as follows:
- If the number of tablet nodes is greater than or equal to 3, RF is set to 3; otherwise, RF is set to 1.
func StartYugaCluster ¶
func StartYugaCluster(ctx context.Context, t *testing.T, numberOfMasters, numberOfTablets uint) ( *YugaClusterController, *dbtest.Connection, )
StartYugaCluster creates a Yugabyte cluster in a Docker environment and returns its connection properties.
func (*YugaClusterController) StopAndRemoveSingleMasterNodeByRaftRole ¶ added in v0.1.6
func (cc *YugaClusterController) StopAndRemoveSingleMasterNodeByRaftRole(t *testing.T, raftRole string)
StopAndRemoveSingleMasterNodeByRaftRole stops and removes a single master node from the cluster based on the provided role.