crdttest

package
v0.0.0-...-a4d05e0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DumpEnvelope

func DumpEnvelope(w io.Writer, env *v1.Envelope)

func DumpEvent

func DumpEvent(ev *types.Event) string

func RequireEventEqual

func RequireEventEqual(t *testing.T, exp, act *types.Event, msgAndArgs ...any)

func RequireEventsEqual

func RequireEventsEqual(t *testing.T, exp []*types.Event, act []*types.Event)

func RunBroadcasterTests

func RunBroadcasterTests(t *testing.T, broadcasterMaker TestBroadcasterMaker)

func RunStoreEventTests

func RunStoreEventTests(t *testing.T, topic string, storeMaker TestStoreMaker)

func RunStoreQueryTests

func RunStoreQueryTests(t *testing.T, topic string, storeMaker TestStoreMaker)

func RunSyncerTests

func RunSyncerTests(t *testing.T, syncerMaker TestSyncerMaker)

Types

type ITestBroadcaster

type ITestBroadcaster interface {
	crdt.Broadcaster

	AddPeer(t *testing.T, peer interface{})
}

type ITestStore

type ITestStore interface {
	crdt.Store

	Events(context.Context) ([]*types.Event, error)
	Heads(context.Context) ([]multihash.Multihash, error)
	InsertNewEvents(context.Context, []*types.Event) error

	Close() error
}

type ITestSyncer

type ITestSyncer interface {
	crdt.Syncer

	AddPeer(peer interface{})
	AddStoreEvents(context.Context, []*types.Event) error
}

type TestBroadcaster

type TestBroadcaster struct {
	ITestBroadcaster
	// contains filtered or unexported fields
}

func NewTestBroadcaster

func NewTestBroadcaster(ctx context.Context, bc ITestBroadcaster) *TestBroadcaster

type TestBroadcasterMaker

type TestBroadcasterMaker func(t *testing.T) *TestBroadcaster

type TestStore

type TestStore struct {
	ITestStore
	// contains filtered or unexported fields
}

func NewTestStore

func NewTestStore(ctx context.Context, store ITestStore) *TestStore

func (*TestStore) Seed

func (s *TestStore) Seed(t testing.TB, topic string, count int) []*types.Event

type TestStoreMaker

type TestStoreMaker func(t *testing.T) *TestStore

type TestSyncer

type TestSyncer struct {
	ITestSyncer
	// contains filtered or unexported fields
}

func NewTestSyncer

func NewTestSyncer(ctx context.Context, bc ITestSyncer) *TestSyncer

type TestSyncerMaker

type TestSyncerMaker func(t *testing.T) *TestSyncer

Jump to

Keyboard shortcuts

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