Documentation
¶
Overview ¶
Package objectstoretest provides an in-memory objectstore.Store for tests that need to observe which external snapshots a flow created and released.
Index ¶
- type Fake
- func (f *Fake) Copy(_ context.Context, srcBucket, srcObject, dstBucket, dstObject string) error
- func (f *Fake) Delete(_ context.Context, bucket, object string) error
- func (f *Fake) List(_ context.Context, bucket, prefix string) ([]string, error)
- func (f *Fake) Objects() []string
- func (f *Fake) Prefix(t *testing.T, storagePrefix resources.StoragePrefix) []string
- func (f *Fake) Put(bucket, object, content string)
- func (f *Fake) PutSnapshot(t *testing.T, uri resources.SnapshotURI, names ...string)
- func (f *Fake) Snapshot(t *testing.T, uri resources.SnapshotURI) []string
- func (f *Fake) WriteSnapshot(snapshotURI string, names ...string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Fake ¶
type Fake struct {
// OnList, OnDelete and OnCopy, when set, run before the operation they name
// and fail it if they return an error. Set them before the Fake is handed
// to the code under test.
OnList func(bucket, prefix string) error
OnDelete func(bucket, object string) error
OnCopy func(srcBucket, srcObject, dstBucket, dstObject string) error
// contains filtered or unexported fields
}
Fake is an in-memory object store. It is safe for concurrent use, as the prefix helpers operate on several objects at once.
func (*Fake) Prefix ¶
Prefix returns the names, relative to prefix, of every object below it. It is how a test asserts on a whole owner's subtree: that deleting one resource collected all of its objects, or left another's alone.
func (*Fake) PutSnapshot ¶
PutSnapshot writes named objects into the external snapshot at uri, each holding its own name as content so a copy can be traced back to its source.