Overview ▹
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
- Variables
- func Delete(t *testing.T, initIdx func() *index.Index)
- func EdgesTo(t *testing.T, initIdx func() *index.Index)
- func EnumStat(t *testing.T, initIdx func() *index.Index)
- func Files(t *testing.T, initIdx func() *index.Index)
- func Index(t *testing.T, initIdx func() *index.Index)
- func MustNew(t *testing.T, s sorted.KeyValue) *index.Index
- func PathsOfSignerTarget(t *testing.T, initIdx func() *index.Index)
- func Reindex(t *testing.T, initIdx func() *index.Index)
- type Fataler
- type IndexDeps
- func NewIndexDeps(index *index.Index) *IndexDeps
- func (id *IndexDeps) AddAttribute(permaNode blob.Ref, attr, value string) blob.Ref
- func (id *IndexDeps) DelAttribute(permaNode blob.Ref, attr, value string) blob.Ref
- func (id *IndexDeps) Delete(target blob.Ref) blob.Ref
- func (id *IndexDeps) DumpIndex(t *testing.T)
- func (id *IndexDeps) Get(key string) string
- func (id *IndexDeps) LastTime() time.Time
- func (id *IndexDeps) NewPermanode() blob.Ref
- func (id *IndexDeps) NewPlannedPermanode(key string) blob.Ref
- func (id *IndexDeps) Set(key, value string) error
- func (id *IndexDeps) SetAttribute(permaNode blob.Ref, attr, value string) blob.Ref
- func (id *IndexDeps) SetAttribute_NoTimeMove(permaNode blob.Ref, attr, value string) blob.Ref
- func (id *IndexDeps) Sign(m *schema.Builder) *test.Blob
- func (id *IndexDeps) Upload(tb *test.Blob) blob.Ref
- func (id *IndexDeps) UploadDir(dirName string, children []blob.Ref, modTime time.Time) blob.Ref
- func (id *IndexDeps) UploadFile(fileName string, contents string, modTime time.Time) (fileRef, wholeRef blob.Ref)
- func (id *IndexDeps) UploadString(v string) blob.Ref
Package files
Variables
var ( PubKey = &test.Blob{Contents: `-----BEGIN PGP PUBLIC KEY BLOCK----- xsBNBEzgoVsBCAC/56aEJ9BNIGV9FVP+WzenTAkg12k86YqlwJVAB/VwdMlyXxvi bCT1RVRfnYxscs14LLfcMWF3zMucw16mLlJCBSLvbZ0jn4h+/8vK5WuAdjw2YzLs WtBcjWn3lV6tb4RJz5gtD/o1w8VWxwAnAVIWZntKAWmkcChCRgdUeWso76+plxE5 aRYBJqdT1mctGqNEISd/WYPMgwnWXQsVi3x4z1dYu2tD9uO1dkAff12z1kyZQIBQ rexKYRRRh9IKAayD4kgS0wdlULjBU98aeEaMz1ckuB46DX3lAYqmmTEL/Rl9cOI0 Enpn/oOOfYFa5h0AFndZd1blMvruXfdAobjVABEBAAE= =28/7 -----END PGP PUBLIC KEY BLOCK-----`} KeyID = "2931A67C26F5ABDA" )
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)
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
NewPlannedPermanode 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) Sign
func (id *IndexDeps) Sign(m *schema.Builder) *test.Blob
func (*IndexDeps) Upload
func (id *IndexDeps) Upload(tb *test.Blob) 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