Documentation
¶
Index ¶
- Constants
- type CmdParameters
- type CommitterRuntime
- func (c *CommitterRuntime) AddOrUpdateNamespaces(t *testing.T, namespaces ...string)
- func (c *CommitterRuntime) CountAlternateStatus(t *testing.T, status committerpb.Status) int
- func (c *CommitterRuntime) CountStatus(t *testing.T, status committerpb.Status) int
- func (c *CommitterRuntime) CreateNamespacesAndCommit(t *testing.T, namespaces ...string)
- func (c *CommitterRuntime) CreateRuntimeClients(ctx context.Context, t *testing.T)
- func (c *CommitterRuntime) MakeAndSendTransactionsToOrderer(t *testing.T, txsNs [][]*applicationpb.TxNamespace, ...) []string
- func (c *CommitterRuntime) OpenNotificationStream(ctx context.Context, t *testing.T)
- func (c *CommitterRuntime) SendTransactionsToOrderer(t *testing.T, txs []*servicepb.LoadGenTx, expectedStatus []committerpb.Status) []string
- func (c *CommitterRuntime) Start(t *testing.T, serviceFlags int)
- func (c *CommitterRuntime) ValidateExpectedResultsInCommittedBlock(t *testing.T, expected *ExpectedStatusInBlock)
- type Config
- type DBClusterController
- func (cc *DBClusterController) GetClusterSize() int
- func (cc *DBClusterController) GetNodesContainerID(t *testing.T) []string
- func (cc *DBClusterController) GetSingleNodeByRole(role string) (*testdb.DatabaseContainer, int)
- func (cc *DBClusterController) IterNodesByRole(role string) iter.Seq2[int, *testdb.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 ¶
This section is empty.
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
DBEnv *vc.DatabaseTestEnv
OrdererStream *test.BroadcastStream
CoordinatorClient servicepb.CoordinatorClient
QueryServiceClient committerpb.QueryServiceClient
SidecarClient *sidecarclient.Client
NotifyClient committerpb.NotifierClient
NotifyStream committerpb.Notifier_OpenNotificationStreamClient
CommittedBlock chan *common.Block
TxBuilder *workload.TxBuilder
Config *Config
SeedForCryptoGen *rand.Rand
NextExpectedBlockNumber uint64
CredFactory *test.CredentialsFactory
}
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 committerpb.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 committerpb.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) CreateRuntimeClients ¶ added in v0.1.8
func (c *CommitterRuntime) CreateRuntimeClients(ctx context.Context, t *testing.T)
CreateRuntimeClients create and set the necessary service's clients.
func (*CommitterRuntime) MakeAndSendTransactionsToOrderer ¶ added in v0.1.6
func (c *CommitterRuntime) MakeAndSendTransactionsToOrderer( t *testing.T, txsNs [][]*applicationpb.TxNamespace, expectedStatus []committerpb.Status, ) []string
MakeAndSendTransactionsToOrderer creates a block with given transactions, send it to the committer, and verify the result.
func (*CommitterRuntime) OpenNotificationStream ¶ added in v0.1.8
func (c *CommitterRuntime) OpenNotificationStream(ctx context.Context, t *testing.T)
OpenNotificationStream starts a notification stream.
func (*CommitterRuntime) SendTransactionsToOrderer ¶
func (c *CommitterRuntime) SendTransactionsToOrderer( t *testing.T, txs []*servicepb.LoadGenTx, expectedStatus []committerpb.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 {
NumOrderers int
NumVerifiers int
NumVCService int
BlockSize uint64
BlockTimeout time.Duration
LoadgenBlockLimit uint64
// DBConnection configures the runtime to operate with a custom database connection.
DBConnection *testdb.Connection
// TLS configures the secure level between the components: none | tls | mtls
TLSMode string
// CrashTest is true to indicate a service crash is expected, and not a failure.
CrashTest bool
// RateLimit configures rate limiting for services that support it (query, sidecar).
RateLimit *connection.RateLimitConfig
// MaxRequestKeys is the maximum number of keys allowed in a single query request.
// Set to 0 to disable the limit.
MaxRequestKeys int
// VCMinTransactionBatchSize configures the minimum batch size for VC service.
VCMinTransactionBatchSize int
// VCTimeoutForMinTransactionBatchSize configures the timeout for min batch size
VCTimeoutForMinTransactionBatchSize time.Duration
// VerifierBatchTimeCutoff configures the batch time cutoff for verifier service
VerifierBatchTimeCutoff time.Duration
// VerifierBatchSizeCutoff configures the batch size cutoff for verifier service.
VerifierBatchSizeCutoff int
}
Config represents the runtime configuration.
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) (*testdb.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, *testdb.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 []committerpb.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
// contains filtered or unexported fields
}
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, *testdb.Connection)
StartPostgresCluster creates a postgres cluster with WAL streaming replication using the official postgres image. The setup follows the EDB streaming replication guide (https://www.enterprisedb.com/blog/how-set-streaming-replication-keep-your-postgresql-database-performant-and-date accessed 2026-02-13), omitting production concerns unnecessary for short-lived test clusters: WAL archiving (archive_mode/archive_command), replication slots, synchronous replication, and restore_command — since we use pg_basebackup -Xs for gapless WAL streaming.
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, *testdb.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.