tester

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// InactiveFailureLookbackWindow is the size of each window to check
	// for missing ops. If a block with missing ops is not found in this
	// window, another window is created with the preceding
	// InactiveFailureLookbackWindow blocks (this process continues
	// until the client halts the search or the block is found).
	InactiveFailureLookbackWindow = 250

	// PeriodicLoggingFrequency is the frequency that stats are printed
	// to the terminal.
	PeriodicLoggingFrequency = periodicLoggingSeconds * time.Second

	// EndAtTipCheckInterval is the frequency that EndAtTip condition
	// is evaluated
	EndAtTipCheckInterval = 10 * time.Second

	//MinTableSize unit is GB
	MinTableSize = int64(1)

	//MaxTableSize unit is GB
	MaxTableSize = int64(100)

	//MinTableSize unit is MB
	MinValueLogFileSize = int64(128)

	//MaxTableSize unit is MB
	MaxValueLogFileSize = int64(2048)

	// empty requestUUID
	EmptyRequestUUID = ""
)
View Source
const (
	// MemoryLoggingFrequency is the frequency that memory
	// usage stats are logged to the terminal.
	MemoryLoggingFrequency = 10 * time.Second

	// ReadHeaderTimeout is the header timeout for server
	ReadHeaderTimeout = 5 * time.Second
)

Variables

This section is empty.

Functions

func BmarkAccountBalance added in v0.7.7

func BmarkAccountBalance(ctx context.Context, config *configuration.Configuration, fetcher *fetcher.Fetcher, timer func() time.Duration, elapsed chan time.Duration, rawStats *results.CheckPerfRawStats) error

Benchmark the asset issuers /account/balance endpoint

func BmarkBlock added in v0.7.7

func BmarkBlock(ctx context.Context, config *configuration.Configuration, fetcher *fetcher.Fetcher, timer func() time.Duration, elapsed chan time.Duration, rawStats *results.CheckPerfRawStats) error

Benchmark the asset issuer's /block endpoint

func LogMemoryLoop added in v0.5.5

func LogMemoryLoop(
	ctx context.Context,
) error

LogMemoryLoop runs a loop that logs memory usage.

func SetupBenchmarking added in v0.7.7

func SetupBenchmarking(config *configuration.Configuration) (*fetcher.Fetcher, func() time.Duration, chan time.Duration)

func StartServer added in v0.5.6

func StartServer(
	ctx context.Context,
	name string,
	handler http.Handler,
	port uint,
) error

StartServer stats a server at a port with a particular handler. This is often used to support a status endpoint for a particular test.

Types

type ConstructionTester

type ConstructionTester struct {
	// contains filtered or unexported fields
}

ConstructionTester coordinates the `check:construction` test.

func InitializeConstruction

func InitializeConstruction(
	ctx context.Context,
	config *configuration.Configuration,
	network *types.NetworkIdentifier,
	onlineFetcher *fetcher.Fetcher,
	cancel context.CancelFunc,
	signalReceived *bool,
) (*ConstructionTester, error)

InitializeConstruction initiates the construction API tester.

func (*ConstructionTester) CloseDatabase

func (t *ConstructionTester) CloseDatabase(ctx context.Context)

CloseDatabase closes the database used by ConstructionTester.

func (*ConstructionTester) HandleErr added in v0.5.0

func (t *ConstructionTester) HandleErr(
	err error,
	sigListeners *[]context.CancelFunc,
) error

HandleErr is called when `check:construction` returns an error.

func (*ConstructionTester) PerformBroadcasts

func (t *ConstructionTester) PerformBroadcasts(ctx context.Context) error

PerformBroadcasts attempts to rebroadcast all pending transactions if the RebroadcastAll configuration is set to true.

func (*ConstructionTester) ServeHTTP added in v0.5.6

func (t *ConstructionTester) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves a CheckDataStatus response on all paths.

func (*ConstructionTester) StartConstructor

func (t *ConstructionTester) StartConstructor(
	ctx context.Context,
) error

StartConstructor uses the tester's constructor to begin generating addresses and constructing transactions.

func (*ConstructionTester) StartPeriodicLogger

func (t *ConstructionTester) StartPeriodicLogger(
	ctx context.Context,
) error

StartPeriodicLogger prints out periodic stats about a run of `check:construction`.

func (*ConstructionTester) StartSyncer

func (t *ConstructionTester) StartSyncer(
	ctx context.Context,
	cancel context.CancelFunc,
) error

StartSyncer uses the tester's stateful syncer to compute balance changes and track transactions for confirmation on-chain.

func (*ConstructionTester) WatchEndConditions added in v0.5.0

func (t *ConstructionTester) WatchEndConditions(
	ctx context.Context,
) error

WatchEndConditions cancels check:construction once all end conditions are met (provided workflows are executed at least minOccurences).

type DataTester

type DataTester struct {
	// contains filtered or unexported fields
}

DataTester coordinates the `check:data` test.

func InitializeData

func InitializeData(
	ctx context.Context,
	config *configuration.Configuration,
	network *types.NetworkIdentifier,
	fetcher *fetcher.Fetcher,
	cancel context.CancelFunc,
	genesisBlock *types.BlockIdentifier,
	interestingAccount *types.AccountCurrency,
	signalReceived *bool,
) (*DataTester, error)

InitializeData returns a new *DataTester.

func (*DataTester) CloseDatabase

func (t *DataTester) CloseDatabase(ctx context.Context)

CloseDatabase closes the database used by DataTester.

func (*DataTester) CompleteReconciliations added in v0.5.15

func (t *DataTester) CompleteReconciliations(ctx context.Context) (int64, error)

CompleteReconciliations returns the sum of all failed, exempt, and successful reconciliations.

func (*DataTester) DrainReconcilerQueue added in v0.5.15

func (t *DataTester) DrainReconcilerQueue(
	ctx context.Context,
	sigListeners *[]context.CancelFunc,
) error

DrainReconcilerQueue returns once the reconciler queue has been drained or an error is encountered.

func (*DataTester) EndAtTipLoop added in v0.5.0

func (t *DataTester) EndAtTipLoop(
	ctx context.Context,
)

EndAtTipLoop runs a loop that evaluates end condition EndAtTip

func (*DataTester) EndDurationLoop added in v0.5.0

func (t *DataTester) EndDurationLoop(
	ctx context.Context,
	duration time.Duration,
)

EndDurationLoop runs a loop that evaluates end condition EndDuration.

func (*DataTester) EndReconciliationCoverage added in v0.5.8

func (t *DataTester) EndReconciliationCoverage(
	ctx context.Context,
	reconciliationCoverage *configuration.ReconciliationCoverage,
)

EndReconciliationCoverage runs a loop that evaluates ReconciliationEndCondition

func (*DataTester) FindMissingOps

func (t *DataTester) FindMissingOps(
	ctx context.Context,
	originalErr error,
	sigListeners *[]context.CancelFunc,
) error

FindMissingOps logs the types.BlockIdentifier of a block that is missing balance-changing operations for a *types.AccountCurrency.

func (*DataTester) HandleErr

func (t *DataTester) HandleErr(err error, sigListeners *[]context.CancelFunc) error

HandleErr is called when `check:data` returns an error. If historical balance lookups are enabled, HandleErr will attempt to automatically find any missing balance-changing operations.

func (*DataTester) PruneableIndex added in v0.5.13

func (t *DataTester) PruneableIndex(
	ctx context.Context,
	headIndex int64,
) (int64, error)

PruneableIndex is the index that is safe for pruning.

func (*DataTester) ServeHTTP added in v0.5.6

func (t *DataTester) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves a CheckDataStatus response on all paths.

func (*DataTester) StartPeriodicLogger

func (t *DataTester) StartPeriodicLogger(
	ctx context.Context,
) error

StartPeriodicLogger prints out periodic stats about a run of `check:data`.

func (*DataTester) StartPruning added in v0.5.3

func (t *DataTester) StartPruning(
	ctx context.Context,
) error

StartPruning attempts to prune block storage every 10 seconds.

func (*DataTester) StartReconciler

func (t *DataTester) StartReconciler(
	ctx context.Context,
) error

StartReconciler starts the reconciler if reconciliation is enabled.

func (*DataTester) StartReconcilerCountUpdater added in v0.6.1

func (t *DataTester) StartReconcilerCountUpdater(
	ctx context.Context,
) error

StartReconcilerCountUpdater attempts to periodically write cached reconciler count updates to storage.

func (*DataTester) StartSyncing

func (t *DataTester) StartSyncing(
	ctx context.Context,
) error

StartSyncing syncs from startIndex to endIndex. If startIndex is -1, it will start from the last saved block. If endIndex is -1, it will sync continuously (or until an error).

func (*DataTester) WaitForEmptyQueue added in v0.5.15

func (t *DataTester) WaitForEmptyQueue(
	ctx context.Context,
) error

WaitForEmptyQueue exits once the active reconciler queue is empty and all reconciler goroutines are idle.

func (*DataTester) WatchEndConditions

func (t *DataTester) WatchEndConditions(
	ctx context.Context,
) error

WatchEndConditions starts go routines to watch the end conditions

Jump to

Keyboard shortcuts

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