Documentation ¶
Overview ¶
Package cloudtest provides utilities for testing, e.g. cloud service tests using mock http Transport, fake storage client, etc.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BucketHandle ¶
type BucketHandle struct { stiface.BucketHandle ObjAttrs []*storage.ObjectAttrs // Objects that will be returned by iterator Objs map[string]*ObjectHandle WritesMustFail bool ClosesMustFail bool }
BucketHandle provides a fake BucketHandle implementation for testing.
func NewBucketHandle ¶ added in v0.1.44
func NewBucketHandle() *BucketHandle
NewBucketHandle creates a new empty BucketHandle.
func (*BucketHandle) Attrs ¶
func (bh *BucketHandle) Attrs(ctx context.Context) (*storage.BucketAttrs, error)
Attrs implements trivial stiface.BucketHandle.Attrs
func (*BucketHandle) Object ¶ added in v0.1.44
func (bh *BucketHandle) Object(name string) stiface.ObjectHandle
Object returns an ObjectHandle for the specified object name if it exists in this bucket, or a new ObjectHandle otherwise.
func (*BucketHandle) Objects ¶
func (bh *BucketHandle) Objects(ctx context.Context, q *storage.Query) stiface.ObjectIterator
Objects implements stiface.BucketHandle.Objects
type GCSClient ¶
GCSClient provides a fake storage client that can be customized with arbitrary fake bucket contents.
func (*GCSClient) AddTestBucket ¶
func (c *GCSClient) AddTestBucket(name string, bh *BucketHandle)
AddTestBucket adds a fake bucket for testing.
type ObjectHandle ¶ added in v0.1.44
type ObjectHandle struct { stiface.ObjectHandle Name string Bucket *BucketHandle Data *bytes.Buffer WritesMustFail bool ClosesMustFail bool }
ObjectHandle implements stiface.ObjectHandle