unusedtest

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDiskNotFound = errors.New("disk not found")

Functions

func AssertEqualMeta

func AssertEqualMeta(p, q unused.Meta) error

AssertEqualMeta returns nil if both unused.Meta arguments are equal.

func TestProviderMeta

func TestProviderMeta(newProvider func(meta unused.Meta) (unused.Provider, error)) error

TestProviderMeta returns nil if the provider properly implements storing metadata.

It accepts a constructor function that should return a valid unused.Provider or an error when it isn't compliant with the semantics of creating a provider.

Types

type Disk

type Disk struct {
	// contains filtered or unexported fields
}

Disk implements unused.Disk for testing purposes.

func NewDisk

func NewDisk(name string, provider unused.Provider, createdAt time.Time) Disk

NewDisk returns a new test disk.

func (Disk) CreatedAt

func (d Disk) CreatedAt() time.Time

func (Disk) DiskType added in v0.0.2

func (d Disk) DiskType() unused.DiskType

func (Disk) ID

func (d Disk) ID() string

func (Disk) LastUsedAt

func (d Disk) LastUsedAt() time.Time

func (Disk) Meta

func (d Disk) Meta() unused.Meta

func (Disk) Name

func (d Disk) Name() string

func (Disk) Provider

func (d Disk) Provider() unused.Provider

func (Disk) SizeGB added in v0.0.2

func (d Disk) SizeGB() int

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider implements unused.Provider for testing purposes.

func NewProvider

func NewProvider(name string, meta unused.Meta, disks ...unused.Disk) *Provider

NewProvider returns a new test provider that return the given disks as unused.

func (*Provider) Delete

func (p *Provider) Delete(ctx context.Context, disk unused.Disk) error

func (*Provider) ListUnusedDisks

func (p *Provider) ListUnusedDisks(ctx context.Context) (unused.Disks, error)

func (*Provider) Meta

func (p *Provider) Meta() unused.Meta

func (*Provider) Name

func (p *Provider) Name() string

func (*Provider) SetMeta

func (p *Provider) SetMeta(meta unused.Meta)

Jump to

Keyboard shortcuts

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