badgerauthtest

package
v1.43.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2022 License: AGPL-3.0 Imports: 18 Imported by: 0

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 added in v1.28.0

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.

func (Clock) Check

func (step Clock) Check(t testing.TB, node *badgerauth.Node)

Check runs the test.

type Cluster added in v1.28.0

type Cluster struct {
	Nodes []*badgerauth.Node
}

Cluster represents a collection of badgerauth nodes.

func (*Cluster) Addresses added in v1.32.0

func (c *Cluster) Addresses() (addresses []string)

Addresses returns a slice of all cluster node addresses.

type ClusterConfig added in v1.28.0

type ClusterConfig struct {
	NodeCount int
	Defaults  badgerauth.Config

	ReconfigureNode func(index int, config *badgerauth.Config)
}

ClusterConfig is used for configuring the cluster.

type Get

type Get struct {
	KeyHash authdb.KeyHash
	Result  *authdb.Record
	Error   error
}

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

type Put struct {
	KeyHash authdb.KeyHash
	Record  *authdb.Record
	Error   error
}

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

type PutAtTime struct {
	KeyHash authdb.KeyHash
	Record  *authdb.Record
	Error   error
	Time    time.Time
}

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 added in v1.29.0

type Replicate struct {
	Request *pb.ReplicationRequest
	Result  *pb.ReplicationResponse
	Error   error
}

Replicate is for testing the badgerauth.(*Node).Replicate method.

func (Replicate) Check added in v1.29.0

func (step Replicate) Check(ctx *testcontext.Context, t testing.TB, node *badgerauth.Node)

Check runs the test.

type ReplicationLogEntryWithTTL added in v1.27.0

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 added in v1.30.0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL