Documentation ¶
Overview ¶
Package badgerauthtest is roughly inspired by the design of the storj/satellite/metabase/metabasetest package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunCluster ¶
func RunCluster(t *testing.T, c ClusterConfig, fn func(ctx *testcontext.Context, t *testing.T, cluster *Cluster))
RunCluster tests against a multinode cluster of badgerauth.
func RunSingleNode ¶
func RunSingleNode(t *testing.T, config badgerauth.Config, fn func(ctx *testcontext.Context, t *testing.T, log *zap.Logger, node *badgerauth.Node))
RunSingleNode tests against a single node cluster of badgerauth.
Types ¶
type Clock ¶
type Clock struct { NodeID badgerauth.NodeID Value int }
Clock is for verifying the db state of the clock.
type Cluster ¶
type Cluster struct {
Nodes []*badgerauth.Node
}
Cluster represents a collection of badgerauth nodes.
type ClusterConfig ¶
type ClusterConfig struct { NodeCount int Defaults badgerauth.Config ReconfigureNode func(index int, config *badgerauth.Config) ReconfigurePeerAddress func(index int) string }
ClusterConfig is used for configuring the cluster.
type Get ¶
Get is for testing badgerauth.(*DB).Get method.
func (Get) Check ¶
func (step Get) Check(ctx *testcontext.Context, t testing.TB, node *badgerauth.Node)
Check runs the test.
type Put ¶
Put is for testing badgerauth.(*DB).Put method.
func (Put) Check ¶
func (step Put) Check(ctx *testcontext.Context, t testing.TB, node *badgerauth.Node)
Check runs the test.
type PutAtTime ¶
PutAtTime is for testing badgerauth.(*DB).PutAtTime method.
func (PutAtTime) Check ¶
func (step PutAtTime) Check(ctx *testcontext.Context, t testing.TB, node *badgerauth.Node)
Check runs the test.
type Replicate ¶
type Replicate struct { Request *pb.ReplicationRequest Result *pb.ReplicationResponse Error error }
Replicate is for testing the badgerauth.(*Node).Replicate method.
func (Replicate) Check ¶
func (step Replicate) Check(ctx *testcontext.Context, t testing.TB, node *badgerauth.Node)
Check runs the test.
type ReplicationLogEntryWithTTL ¶
type ReplicationLogEntryWithTTL struct { Entry badgerauth.ReplicationLogEntry ExpiresAt time.Time }
ReplicationLogEntryWithTTL wraps ReplicationLogEntry with an expiration time, so it's convenient while verifying the state of the replication log.
func CreateFullRecords ¶
func CreateFullRecords( ctx *testcontext.Context, t testing.TB, node *badgerauth.Node, count int, ) ( records map[authdb.KeyHash]*authdb.Record, keys []authdb.KeyHash, entries []ReplicationLogEntryWithTTL, )
CreateFullRecords creates count of records with random data at node returning created records and corresponding replication log entries.
type VerifyReplicationLog ¶
type VerifyReplicationLog struct {
Entries []ReplicationLogEntryWithTTL
}
VerifyReplicationLog is for verifying the state of the replication log.
func (VerifyReplicationLog) Check ¶
func (step VerifyReplicationLog) Check(ctx *testcontext.Context, t testing.TB, node *badgerauth.Node)
Check runs the test.