Documentation ¶
Overview ¶
Package fake implements mock virtual driver for testing purposes.
Index ¶
- Constants
- type Driver
- func (d *Driver) DriverCreateBucket(_ context.Context, req *cosi.DriverCreateBucketRequest) (*cosi.DriverCreateBucketResponse, error)
- func (d *Driver) DriverDeleteBucket(_ context.Context, req *cosi.DriverDeleteBucketRequest) (*cosi.DriverDeleteBucketResponse, error)
- func (d *Driver) DriverGrantBucketAccess(_ context.Context, req *cosi.DriverGrantBucketAccessRequest) (*cosi.DriverGrantBucketAccessResponse, error)
- func (d *Driver) DriverRevokeBucketAccess(_ context.Context, req *cosi.DriverRevokeBucketAccessRequest) (*cosi.DriverRevokeBucketAccessResponse, error)
- func (d *Driver) ID() string
Constants ¶
const ( // ForceFail constant can be used to forcefully fail any of the Driver* method from the Driver. // // DriverCreateBucket, DriverGrantBucketAccess will take this in request.Parameters: // // req := &cosi.DriverCreateBucketRequest{ // Parameters: map[string]string{ // fake.ForceFail: "x", // } // } // // DriverDeleteBucket, DriverRevokeBucketAccess expect this in BucketId: // // req := &cosi.DriverDeleteBucketRequest{ // BucketId: fmt.Sprintf("fake-%s", fake.ForceFail) // } // ForceFail = "X-TEST/force-fail" // KeyDriverID is used for retrieving the ID of the virtual driver a request comes to. It's retrieved from the // request's parameters, then a driver with such ID is being checked for existence. It's also used for controlling // tests flow, e.g. forcibly failing a test. KeyDriverID = "id" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver struct {
FakeID string
}
Driver is a mock implementation of virtualdriver.Driver interface.
func (*Driver) DriverCreateBucket ¶
func (d *Driver) DriverCreateBucket(_ context.Context, req *cosi.DriverCreateBucketRequest) (*cosi.DriverCreateBucketResponse, error)
DriverCreateBucket is implementation of method from virtualdriver.Driver interface.
To forcefully fail it, add parameter with Key "X-TEST/force-fail" and any non-zero value.
func (*Driver) DriverDeleteBucket ¶
func (d *Driver) DriverDeleteBucket(_ context.Context, req *cosi.DriverDeleteBucketRequest) (*cosi.DriverDeleteBucketResponse, error)
DriverDeleteBucket is implementation of method from virtualdriver.Driver interface.
To forcefully fail it set BucketId in request to contain string "X-TEST/force-fail".
func (*Driver) DriverGrantBucketAccess ¶
func (d *Driver) DriverGrantBucketAccess(_ context.Context, req *cosi.DriverGrantBucketAccessRequest) (*cosi.DriverGrantBucketAccessResponse, error)
DriverGrantBucketAccess is implementation of method from virtualdriver.Driver interface.
To forcefully fail it, add parameter with Key "X-TEST/force-fail" and any non-zero value.
func (*Driver) DriverRevokeBucketAccess ¶
func (d *Driver) DriverRevokeBucketAccess(_ context.Context, req *cosi.DriverRevokeBucketAccessRequest) (*cosi.DriverRevokeBucketAccessResponse, error)
DriverRevokeBucketAccess is implementation of method from virtualdriver.Driver interface.
To forcefully fail it set BucketId in request to contain string "X-TEST/force-fail".