spec

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2021 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrResolversInconsistent = fmt.Errorf("inconsistent resolvers")

ErrResolversInconsistent indicates two resolvers honored a resolution request, but gave differing responses

Functions

func AssertLoaderSpec

func AssertLoaderSpec(t *testing.T, r dsref.Loader, putFunc PutDatasetFunc)

AssertLoaderSpec confirms the expected behaviour of a dsref.Loader Interface implementation. In addition to this test passing, implementations MUST be nil-callable. Please add a nil-callable test for each implementation

TODO(b5) - this test isn't working network sources. At the moment it confirms only basic requirements of a local loader function

func AssertResolverSpec

func AssertResolverSpec(t *testing.T, r dsref.Resolver, putFunc PutRefFunc)

AssertResolverSpec confirms the expected behaviour of a dsref.Resolver Interface implementation. In addition to this test passing, implementations MUST be nil-callable. Please add a nil-callable test for each implementation

func ConsistentResolvers

func ConsistentResolvers(t *testing.T, ref dsref.Ref, resolvers ...dsref.Resolver) error

ConsistentResolvers checks that a set of resolvers return equivalent values for a given reference this function will not fail the test on error, only write warnings via t.Log

func ForeignLogbook

func ForeignLogbook(t *testing.T, username string) *logbook.Book

ForeignLogbook creates a logbook to use as an external source of oplog data

func GenerateExampleDataset

func GenerateExampleDataset(ctx context.Context) (*dataset.Dataset, error)

GenerateExampleDataset creates an example dataset document

func GenerateExampleOplog

func GenerateExampleOplog(ctx context.Context, journal *logbook.Book, dsname, headPath string) (string, *oplog.Log, error)

GenerateExampleOplog makes an example dataset history on a given journal, returning the initID and a signed log

func InconsistentResolvers

func InconsistentResolvers(t *testing.T, ref dsref.Ref, a, b dsref.Resolver) error

InconsistentResolvers confirms two resolvers have different responses for the same reference this function will not fail the test on error, only write warnings via t.Log

Types

type PutDatasetFunc

type PutDatasetFunc func(ds *dataset.Dataset) (ref *dsref.Ref, err error)

PutDatasetFunc adds a dataset to a system that stores datasets PutDatasetFunc is required to run the LoaderSpec test. When called the Loader should retain the dataset for later loading by the spec test, and return a full reference to the saved version

type PutRefFunc

type PutRefFunc func(ref dsref.Ref, author profile.Author, log *oplog.Log) error

PutRefFunc adds a reference to a system that retains references PutRefFunc is required to run the ResolverSpec test, when called the Resolver should retain the reference for later retrieval by the spec test. PutRefFunc also passes the author & oplog that back the reference

Jump to

Keyboard shortcuts

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