tests

package
v0.2300.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package tests is a collection of registry implementation test cases.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BulkPopulate

func BulkPopulate(t *testing.T, backend api.Backend, consensus consensusAPI.Backend, runtimes []*TestRuntime, seed []byte) []*node.Node

BulkPopulate bulk populates the registry for the given TestRuntimes.

func EnsureRegistryClean added in v0.2103.0

func EnsureRegistryClean(t *testing.T, backend api.Backend)

EnsureRegistryClean enforces that the registry is in a clean state before running the registry tests.

func RegistryImplementationTests

func RegistryImplementationTests(t *testing.T, backend api.Backend, consensus consensusAPI.Backend, validatorEntityID signature.PublicKey)

RegistryImplementationTests exercises the basic functionality of a registry backend.

WARNING: This assumes that the registry is empty, and will leave a Runtime registered.

Types

type TestEntity

type TestEntity struct {
	Entity *entity.Entity
	Signer signature.Signer

	SignedRegistration *entity.SignedEntity
	// contains filtered or unexported fields
}

TestEntity is a testing Entity and some common pre-generated/signed blobs useful for testing.

func NewTestEntities

func NewTestEntities(seed []byte, n int) ([]*TestEntity, error)

NewTestEntities returns the specified number of TestEntities, generated deterministically from the seed.

func (*TestEntity) Deregister

func (ent *TestEntity) Deregister(consensus consensusAPI.Backend) error

Deregister attempts to deregister the entity.

func (*TestEntity) NewTestNodes

func (ent *TestEntity) NewTestNodes(nCompute int, idNonce []byte, runtimes []*node.Runtime, expiration beacon.EpochTime, consensus consensusAPI.Backend) ([]*TestNode, error)

NewTestNodes returns the specified number of TestNodes, generated deterministically using the entity's public key as the seed.

func (*TestEntity) ProveFreshness added in v0.2202.0

func (ent *TestEntity) ProveFreshness(consensus consensusAPI.Backend) error

ProveFreshness attempts to prove freshness with zero value blob.

func (*TestEntity) Register

func (ent *TestEntity) Register(consensus consensusAPI.Backend, sigEnt *entity.SignedEntity) error

Register attempts to register an entity.

type TestNode

type TestNode struct {
	Entity *TestEntity

	Node        *node.Node
	UpdatedNode *node.Node
	Signer      signature.Signer

	SignedRegistration        *node.MultiSignedNode
	SignedValidReRegistration *node.MultiSignedNode
	// contains filtered or unexported fields
}

TestNode is a testing Node and some common pre-generated/signed blobs useful for testing.

func (*TestNode) Register

func (n *TestNode) Register(consensus consensusAPI.Backend, sigNode *node.MultiSignedNode) error

Register attempts to register a node.

type TestRuntime

type TestRuntime struct {
	Runtime *api.Runtime
	Signer  signature.Signer
	// contains filtered or unexported fields
}

TestRuntime is a testing Runtime and some common pre-generated/signed blobs useful for testing.

func NewTestRuntime

func NewTestRuntime(seed []byte, ent *TestEntity, isKeyManager bool) (*TestRuntime, error)

NewTestRuntime returns a pre-generated TestRuntime for use with various tests, generated deterministically from the seed.

func (*TestRuntime) Cleanup

func (rt *TestRuntime) Cleanup(t *testing.T, backend api.Backend, consensus consensusAPI.Backend)

Cleanup deregisteres the entity and nodes for a given TestRuntime.

func (*TestRuntime) MustNotRegister

func (rt *TestRuntime) MustNotRegister(t *testing.T, consensus consensusAPI.Backend)

MustNotRegister attempts to register the TestRuntime with the provided registry and expects failure.

func (*TestRuntime) MustRegister

func (rt *TestRuntime) MustRegister(t *testing.T, backend api.Backend, consensus consensusAPI.Backend)

MustRegister registers the TestRuntime with the provided registry.

func (*TestRuntime) Populate

func (rt *TestRuntime) Populate(t *testing.T, backend api.Backend, consensus consensusAPI.Backend, seed []byte) []*node.Node

Populate populates the registry for a given TestRuntime.

func (*TestRuntime) TestNodes

func (rt *TestRuntime) TestNodes() []*TestNode

TestNodes returns the test runtime's TestNodes.

Jump to

Keyboard shortcuts

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