gen

package
v0.0.0-...-2627f95 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package gen contains generators for commands used in property-based tests

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func After

func After(replicaStore *model.ReplicaStoreModel) gopter.Gen

After generates a page cursor

func AnyKey

func AnyKey() gopter.Gen

AnyKey generates random keys

func AnyTarget

func AnyTarget(replicaStore *model.ReplicaStoreModel) gopter.Gen

AnyTarget generates a random combination of field and value

func AnyValue

func AnyValue() gopter.Gen

AnyValue generates random values

func ChangesCommand

func ChangesCommand(id int, replicaStore *model.ReplicaStoreModel) gopter.Gen

ChangesCommand returns a generator that generates changes commands that are valid for the replica store

func Commands

func Commands(replicaStoreSet []model.ReplicaStoreModel) gopter.Gen

Commands returns a generator that generates a range of storage commands that are valid for the set of replica stores

func CommandsOne

func CommandsOne(id int, replicaStore *model.ReplicaStoreModel) gopter.Gen

CommandsOne returns a generator that generates a range of storage commands that are valid for the replica store

func CompactCommand

func CompactCommand(id int, replicaStore *model.ReplicaStoreModel) gopter.Gen

CompactCommand returns a generator that generates compact commands that are valid for the replica store

func Condition

func Condition(replicaStore *model.ReplicaStoreModel) gopter.Gen

Condition returns a generator that generates a list of conditions that are valid for the replica store

func CreateLeaseCommand

func CreateLeaseCommand(id int, replicaStore *model.ReplicaStoreModel) gopter.Gen

CreateLeaseCommand returns a generator that generates create lease commands that are valid for the replica store

func ExistingKey

func ExistingKey(replicaStore *model.ReplicaStoreModel) gopter.Gen

ExistingKey generates existing keys

func ExistingLease

func ExistingLease(replicaStore *model.ReplicaStoreModel) gopter.Gen

ExistingLease generates an existing lease if one exists, 0 otherwise.

func ExistingRevision

func ExistingRevision(replicaStore *model.ReplicaStoreModel) gopter.Gen

ExistingRevision generates valid revision numbers for the replica store if it has any revisions

func ExistingValue

func ExistingValue(replicaStore *model.ReplicaStoreModel) gopter.Gen

ExistingValue generates values that exist in the replica store

func ExistingVersion

func ExistingVersion(replicaStore *model.ReplicaStoreModel) gopter.Gen

ExistingVersion generates a version for the target union field of a predicate that matches an existing key version

func GetLeaseCommand

func GetLeaseCommand(replicaStoreID int, replicaStore *model.ReplicaStoreModel) gopter.Gen

GetLeaseCommand returns a generator that generates get lease commands that are valid for the replica store

func Index

func Index(replicaStore *model.ReplicaStoreModel) gopter.Gen

Index generates indexes for update commands

func IndexCommand

func IndexCommand(id int, replicaStore *model.ReplicaStoreModel) gopter.Gen

IndexCommand returns a generator that generates index commands that are valid for the replica store

func KVDeleteRequest

func KVDeleteRequest(replicaStore *model.ReplicaStoreModel) gopter.Gen

KVDeleteRequest generates delete requests

func KVPredicate

func KVPredicate(replicaStore *model.ReplicaStoreModel) gopter.Gen

KVPredicate returns a generator that generates predicates that are valid for the replica store

func KVPredicate_CreateRevision

func KVPredicate_CreateRevision(replicaStore *model.ReplicaStoreModel) gopter.Gen

KVPredicate_CreateRevision generates a create revision for the target union field of a predicate

func KVPredicate_Key

func KVPredicate_Key(replicaStore *model.ReplicaStoreModel) gopter.Gen

KVPredicate_Key generates a value for the target union field of a predicate

func KVPredicate_Lease

func KVPredicate_Lease(replicaStore *model.ReplicaStoreModel) gopter.Gen

KVPredicate_Lease generates a lease for the target union field of a predicate

func KVPredicate_ModRevision

func KVPredicate_ModRevision(replicaStore *model.ReplicaStoreModel) gopter.Gen

KVPredicate_ModRevision generates a mod revision for the target union field of a predicate

func KVPredicate_Value

func KVPredicate_Value(replicaStore *model.ReplicaStoreModel) gopter.Gen

KVPredicate_Value generates a value for the target union field of a predicate

func KVPredicate_Version

func KVPredicate_Version(replicaStore *model.ReplicaStoreModel) gopter.Gen

KVPredicate_Version generates a version for the target union field of a predicate

func KVPutRequest

func KVPutRequest(replicaStore *model.ReplicaStoreModel) gopter.Gen

KVPutRequest generates put requests

func KVQueryRequest

func KVQueryRequest(replicaStore *model.ReplicaStoreModel) gopter.Gen

KVQueryRequest generates query requests, some of which should match some keys in the replica store

func KVRequestOp

func KVRequestOp(replicaStore *model.ReplicaStoreModel, depth int) gopter.Gen

KVRequestOp returns a generator that generates request ops that are valid for the replica store

func KVSelection

func KVSelection(replicaStore *model.ReplicaStoreModel) gopter.Gen

KVSelection returns a generator that generates selections that are valid for the replica store. The majority of possible randomly generated selections wouldn't match anything. This generates selections in a way that will increase the chances of a match.

func KVTxnRequest

func KVTxnRequest(replicaStore *model.ReplicaStoreModel, depth int) gopter.Gen

KVTxnRequest generates txn requests

func KVWatchCursor

func KVWatchCursor(replicaStore *model.ReplicaStoreModel) gopter.Gen

KVWatchCursor generates a watch cursor

func KVWatchRequest

func KVWatchRequest(replicaStore *model.ReplicaStoreModel) gopter.Gen

KVWatchRequest generates watch requests, some of which should match some keys in the replica store

func Key

func Key(replicaStore *model.ReplicaStoreModel) gopter.Gen

Key generates keys, some of which already exist in the replica store

func KeyRange

func KeyRange(replicaStore *model.ReplicaStoreModel) gopter.Gen

KeyRange generates a key range for a selection.

func KeyRangeGt

func KeyRangeGt(replicaStore *model.ReplicaStoreModel) gopter.Gen

KeyRangeGt generates a key range max > some key

func KeyRangeGte

func KeyRangeGte(replicaStore *model.ReplicaStoreModel) gopter.Gen

KeyRangeGte generates a key range min >= some key

func KeyRangeKey

func KeyRangeKey(replicaStore *model.ReplicaStoreModel) gopter.Gen

KeyRangeKey generates keys for a key range's key field. It is more weighted toward generating a nil key to prevent key ranges from being dominated by those matching only a single key.

func KeyRangeLt

func KeyRangeLt(replicaStore *model.ReplicaStoreModel) gopter.Gen

KeyRangeLt generates a key range max < some key

func KeyRangeLte

func KeyRangeLte(replicaStore *model.ReplicaStoreModel) gopter.Gen

KeyRangeLte generates a key range max <= some key

func KeyRangeMarker

func KeyRangeMarker(replicaStore *model.ReplicaStoreModel) gopter.Gen

KeyRangeMarker generates a key for a key range marker

func KeyRangeMax

func KeyRangeMax(replicaStore *model.ReplicaStoreModel) gopter.Gen

KeyRangeMax generates a key range's maximum value.

func KeyRangeMin

func KeyRangeMin(replicaStore *model.ReplicaStoreModel) gopter.Gen

KeyRangeMin generates a key range's minimum value.

func KeyStartsWith

func KeyStartsWith(replicaStore *model.ReplicaStoreModel) gopter.Gen

KeyStartsWith generates a key prefix for a selection's KeyStartsWith field

func Lease

func Lease(replicaStore *model.ReplicaStoreModel) gopter.Gen

Lease generates a lease and is weighted toward generating an existing lease

func LeasesCommand

func LeasesCommand(id int, replicaStore *model.ReplicaStoreModel) gopter.Gen

LeasesCommand returns a generator that generates leases commands that are valid for the replica store

func NewestRevisionCommand

func NewestRevisionCommand(id int, replicaStore *model.ReplicaStoreModel) gopter.Gen

NewestRevisionCommand returns a generator that generates newest revision commands that are valid for the replica store

func OldestRevisionCommand

func OldestRevisionCommand(id int, replicaStore *model.ReplicaStoreModel) gopter.Gen

OldestRevisionCommand returns a generator that generates oldest revision commands that are valid for the replica store

func Operator

func Operator() gopter.Gen

Operator generates a KV predicate's operator field

func QueryCommand

func QueryCommand(id int, replicaStore *model.ReplicaStoreModel) gopter.Gen

QueryCommand returns a generator that generates query commands that are valid for the replica store

func ReplicaStoreModelDiff

func ReplicaStoreModelDiff(replicaStore storage.ReplicaStore, model *model.ReplicaStoreModel) (string, error)

ReplicaStoreModelDiff returns the diff between the actual replica store and a model. Returns an empty string if they are identical.

func Revision

func Revision(replicaStore *model.ReplicaStoreModel) gopter.Gen

Revision generates a revision number that may be valid for the replica store

func RevokeLeaseCommand

func RevokeLeaseCommand(id int, replicaStore *model.ReplicaStoreModel) gopter.Gen

RevokeLeaseCommand returns a generator that generates revoke lease commands that are valid for the replica store

func SnapshotCommand

func SnapshotCommand(replicaStores []model.ReplicaStoreModel) gopter.Gen

SnapshotCommand returns a generator that generates snapshot commands

func SortOrder

func SortOrder() gopter.Gen

SortOrder generates a sort order for a query

func SortTarget

func SortTarget() gopter.Gen

SortTarget generates a sort target for a query

func Target

func Target(replicaStore *model.ReplicaStoreModel) gopter.Gen

Target generates the target for a comparison in a KV predicate's field and value fields.

func TxnCommand

func TxnCommand(id int, replicaStore *model.ReplicaStoreModel) gopter.Gen

TxnCommand returns a generator that generates txn commands that are valid for the replica store

func ValidOperator

func ValidOperator() gopter.Gen

ValidOperator generates a comparison that has a valid value

func ValidTarget

func ValidTarget(replicaStore *model.ReplicaStoreModel) gopter.Gen

ValidTarget generates a valid combination of target and target union

func Value

func Value(replicaStore *model.ReplicaStoreModel) gopter.Gen

Value generates random values and existing values from the replica store

Types

type ReplicaStoreSet

type ReplicaStoreSet interface {
	Get(i int) storage.ReplicaStore
}

ReplicaStoreSet can be implemented by a system under test to test a set of replica stores at the same time

Jump to

Keyboard shortcuts

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