fake

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package fake implements mock virtual driver for testing purposes.

Index

Constants

View Source
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

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

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

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

DriverRevokeBucketAccess 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) ID

func (d *Driver) ID() string

ID is implementation of method from virtualdriver.Driver interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL