Documentation ¶
Overview ¶
Package test provides common Camlistore test objects.
Index ¶
- func DependencyErrorOrSkip(t *testing.T)
- func MustRunCmd(t *testing.T, c *exec.Cmd) string
- func RunCmd(c *exec.Cmd) (output string, err error)
- func WaitFor(condition func() bool, maxWait, checkInterval time.Duration) bool
- type Blob
- type FakeIndex
- func (fi *FakeIndex) AddClaim(owner, permanode blob.Ref, claimType, attr, value string)
- func (fi *FakeIndex) AddMeta(blob blob.Ref, mime string, size int64)
- func (fi *FakeIndex) AddSignerAttrValue(signer blob.Ref, attr, val string, latest blob.Ref)
- func (fi *FakeIndex) EdgesTo(ref blob.Ref, opts *search.EdgesToOpts) ([]*search.Edge, error)
- func (fi *FakeIndex) ExistingFileSchemas(bytesRef blob.Ref) ([]blob.Ref, error)
- func (fi *FakeIndex) GetBlobMIMEType(blob blob.Ref) (mime string, size int64, err error)
- func (fi *FakeIndex) GetFileInfo(fileRef blob.Ref) (*search.FileInfo, error)
- func (fi *FakeIndex) GetImageInfo(fileRef blob.Ref) (*search.ImageInfo, error)
- func (fi *FakeIndex) GetOwnerClaims(permaNode, owner blob.Ref) (search.ClaimList, error)
- func (fi *FakeIndex) GetRecentPermanodes(dest chan *search.Result, owner blob.Ref, limit int) error
- func (fi *FakeIndex) PathLookup(signer, base blob.Ref, suffix string, at time.Time) (*search.Path, error)
- func (fi *FakeIndex) PathsLookup(signer, base blob.Ref, suffix string) ([]*search.Path, error)
- func (fi *FakeIndex) PathsOfSignerTarget(signer, target blob.Ref) ([]*search.Path, error)
- func (fi *FakeIndex) PermanodeOfSignerAttrValue(signer blob.Ref, attr, val string) (blob.Ref, error)
- func (fi *FakeIndex) SearchPermanodesWithAttr(dest chan<- blob.Ref, request *search.PermanodeByAttrRequest) error
- type Fetcher
- func (tf *Fetcher) AddBlob(b *Blob)
- func (tf *Fetcher) BlobContents(br blob.Ref) (contents string, ok bool)
- func (tf *Fetcher) BlobrefStrings() []string
- func (tf *Fetcher) EnumerateBlobs(dest chan<- blob.SizedRef, after string, limit int) error
- func (tf *Fetcher) Fetch(ref blob.Ref) (file types.ReadSeekCloser, size int64, err error)
- func (tf *Fetcher) FetchStreaming(ref blob.Ref) (file io.ReadCloser, size int64, err error)
- func (tf *Fetcher) ReceiveBlob(br blob.Ref, source io.Reader) (blob.SizedRef, error)
- func (tf *Fetcher) RemoveBlobs(blobs []blob.Ref) error
- func (tf *Fetcher) StatBlobs(dest chan<- blob.SizedRef, blobs []blob.Ref) error
- type World
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DependencyErrorOrSkip ¶
DependencyErrorOrSkip is called when a test's dependency isn't found. It either skips the current test (if SKIP_DEP_TESTS is set), or calls t.Error with an error.
func MustRunCmd ¶
MustRunCmd wraps RunCmd, failing t if RunCmd returns an error.
Types ¶
type Blob ¶
type Blob struct {
Contents string // the contents of the blob
}
Blob is a utility class for unit tests.
func (*Blob) BlobRefSlice ¶
func (*Blob) MustUpload ¶
func (tb *Blob) MustUpload(t *testing.T, ds blobserver.BlobReceiver)
type FakeIndex ¶
type FakeIndex struct {
// contains filtered or unexported fields
}
A FakeIndex implements parts of search.Index and provides methods to controls the results, such as AddMeta, AddClaim, AddSignerAttrValue.
func NewFakeIndex ¶
func NewFakeIndex() *FakeIndex
func (*FakeIndex) AddSignerAttrValue ¶
func (*FakeIndex) ExistingFileSchemas ¶
func (*FakeIndex) GetBlobMIMEType ¶
func (*FakeIndex) GetFileInfo ¶
func (*FakeIndex) GetImageInfo ¶
func (*FakeIndex) GetOwnerClaims ¶
func (*FakeIndex) GetRecentPermanodes ¶
func (*FakeIndex) PathLookup ¶
func (*FakeIndex) PathsLookup ¶
func (*FakeIndex) PathsOfSignerTarget ¶
func (*FakeIndex) PermanodeOfSignerAttrValue ¶
func (*FakeIndex) SearchPermanodesWithAttr ¶
func (fi *FakeIndex) SearchPermanodesWithAttr(dest chan<- blob.Ref, request *search.PermanodeByAttrRequest) error
TODO(mpl): write real tests
type Fetcher ¶
type Fetcher struct {
// contains filtered or unexported fields
}
Fetcher is an in-memory implementation of the blobserver Storage interface. It started as just a fetcher and grew. It also includes other convenience methods for testing.
func (*Fetcher) BlobContents ¶
func (*Fetcher) BlobrefStrings ¶
BlobrefStrings returns the sorted stringified blobrefs stored in this fetcher.
func (*Fetcher) EnumerateBlobs ¶
func (*Fetcher) FetchStreaming ¶
func (*Fetcher) ReceiveBlob ¶
type World ¶
type World struct {
// contains filtered or unexported fields
}
World defines an integration test world.
It's used to run the actual Camlistore binaries (camlistored, camput, camget, camtool, etc) together in large tests, including building them, finding them, and wiring the up in an isolated way.
func GetWorld ¶
GetWorld returns (creating if necessary) a test singleton world. It calls Fatal on the provided test if there are problems.
func GetWorldMaybe ¶
GetWorldMaybe returns the current World. It might be nil.
func NewWorld ¶
NewWorld returns a new test world. It requires that GOPATH is set to find the "camlistore.org" root.