indextest

package
v0.0.0-...-a5a65f0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2017 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package indextest contains the unit tests for the indexer so they can be re-used for each specific implementation of the index Storage interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(t *testing.T, initIdx func() *index.Index)

func EdgesTo

func EdgesTo(t *testing.T, initIdx func() *index.Index)

func EnumStat

func EnumStat(t *testing.T, initIdx func() *index.Index)

func Files

func Files(t *testing.T, initIdx func() *index.Index)

func Index

func Index(t *testing.T, initIdx func() *index.Index)

func MustNew

func MustNew(t *testing.T, s sorted.KeyValue) *index.Index

MustNew wraps index.New and fails with a Fatal error on t if New returns an error.

func PathsOfSignerTarget

func PathsOfSignerTarget(t *testing.T, initIdx func() *index.Index)

func Reindex

func Reindex(t *testing.T, initIdx func() *index.Index)

func ShowReindexRace

func ShowReindexRace(t *testing.T, initIdx func() *index.Index)

Types

type Fataler

type Fataler interface {
	Fatalf(format string, args ...interface{})
}

type IndexDeps

type IndexDeps struct {
	Index *index.Index

	BlobSource *test.Fetcher

	// Following three needed for signing:
	PublicKeyFetcher *test.Fetcher
	EntityFetcher    jsonsign.EntityFetcher // fetching decrypted openpgp entities
	SignerBlobRef    blob.Ref

	Fataler // optional means of failing.
	// contains filtered or unexported fields
}

An IndexDeps is a helper for populating and querying an Index for tests.

func NewIndexDeps

func NewIndexDeps(index *index.Index) *IndexDeps

NewIndexDeps returns an IndexDeps helper for populating and working with the provided index for tests.

func (*IndexDeps) AddAttribute

func (id *IndexDeps) AddAttribute(permaNode blob.Ref, attr, value string) blob.Ref

func (*IndexDeps) DelAttribute

func (id *IndexDeps) DelAttribute(permaNode blob.Ref, attr, value string) blob.Ref

func (*IndexDeps) Delete

func (id *IndexDeps) Delete(target blob.Ref) blob.Ref

func (*IndexDeps) DumpIndex

func (id *IndexDeps) DumpIndex(t *testing.T)

func (*IndexDeps) Get

func (id *IndexDeps) Get(key string) string

func (*IndexDeps) LastTime

func (id *IndexDeps) LastTime() time.Time

LastTime returns the time of the most recent mutation (claim).

func (*IndexDeps) NewPermanode

func (id *IndexDeps) NewPermanode() blob.Ref

NewPermanode creates (& signs) a new permanode and adds it to the index, returning its blobref.

func (*IndexDeps) NewPlannedPermanode

func (id *IndexDeps) NewPlannedPermanode(key string) blob.Ref

NewPermanode creates (& signs) a new planned permanode and adds it to the index, returning its blobref.

func (*IndexDeps) Set

func (id *IndexDeps) Set(key, value string) error

func (*IndexDeps) SetAttribute

func (id *IndexDeps) SetAttribute(permaNode blob.Ref, attr, value string) blob.Ref

func (*IndexDeps) SetAttribute_NoTimeMove

func (id *IndexDeps) SetAttribute_NoTimeMove(permaNode blob.Ref, attr, value string) blob.Ref

func (*IndexDeps) UploadDir

func (id *IndexDeps) UploadDir(dirName string, children []blob.Ref, modTime time.Time) blob.Ref

If modTime is zero, it's not used.

func (*IndexDeps) UploadFile

func (id *IndexDeps) UploadFile(fileName string, contents string, modTime time.Time) (fileRef, wholeRef blob.Ref)

If modTime is zero, it's not used.

func (*IndexDeps) UploadString

func (id *IndexDeps) UploadString(v string) blob.Ref

Jump to

Keyboard shortcuts

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