robustness

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package robustness contains tests that that validate data stability over time. The package, while designed for Kopia, is written with abstractions that can be used to test other environments.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoOp is thrown when an action could not do anything useful.
	ErrNoOp = fmt.Errorf("no-op")

	// ErrCannotPerformIO is returned if the engine determines there is not enough space
	// to write files.
	ErrCannotPerformIO = fmt.Errorf("cannot perform i/o")

	// ErrNoActionPicked is returned if a random action could not be selected.
	ErrNoActionPicked = errors.New("unable to pick an action with the action control options provided")

	// ErrInvalidOption is returned if an option value is invalid or missing.
	ErrInvalidOption = errors.New("invalid option setting")

	// ErrKeyNotFound is returned when the store can't find the key provided.
	ErrKeyNotFound = errors.New("key not found")

	// ErrMetadataMissing is returned when the metadata can't be found.
	ErrMetadataMissing = errors.New("metadata missing")
)

Functions

func GetOptAsIntOrDefault

func GetOptAsIntOrDefault(key string, opts map[string]string, def int) int

GetOptAsIntOrDefault extracts an integer value from a configuration map if present, or else returns a default.

Types

type CreateSnapshotStats

type CreateSnapshotStats struct {
	SnapStartTime time.Time
	SnapEndTime   time.Time
	Raw           []byte
}

CreateSnapshotStats is a struct for returning various stats from the snapshot execution.

type FileWriter

type FileWriter interface {
	// DataDirectory returns the absolute path of the data directory configured.
	DataDirectory(ctx context.Context) string

	// DeleteDirectoryContents deletes some of the content of a random directory,
	// based on its input option values (none of which are required).
	// The method returns the effective option values used and the error if any.
	// ErrNoOp is returned if no directory is found.
	DeleteDirectoryContents(ctx context.Context, opts map[string]string) (map[string]string, error)

	// DeleteEverything deletes all content.
	DeleteEverything(ctx context.Context) error

	// DeleteRandomSubdirectory deletes a random directory, based
	// on its input option values (none of which are required).
	// The method returns the effective option values used and the error if any.
	// ErrNoOp is returned if no directory is found.
	DeleteRandomSubdirectory(ctx context.Context, opts map[string]string) (map[string]string, error)

	// WriteRandomFiles writes a number of files in a random directory, based
	// on its input option values (none of which are required).
	// The method returns the effective option values used and the error if any.
	WriteRandomFiles(ctx context.Context, opts map[string]string) (map[string]string, error)
}

FileWriter is an interface used for filesystem related actions.

type Persister

type Persister interface {
	Store
	LoadMetadata() error
	FlushMetadata() error
	GetPersistDir() string
}

Persister describes the ability to flush metadata to, and load it again, from a repository.

type Snapshotter

type Snapshotter interface {
	CreateSnapshot(ctx context.Context, sourceDir string, opts map[string]string) (snapID string, fingerprint []byte, stats *CreateSnapshotStats, err error)
	RestoreSnapshot(ctx context.Context, snapID, restoreDir string, opts map[string]string) ([]byte, error)
	RestoreSnapshotCompare(ctx context.Context, snapID, restoreDir string, validationData []byte, reportOut io.Writer, opts map[string]string) error
	DeleteSnapshot(ctx context.Context, snapID string, opts map[string]string) error
	RunGC(ctx context.Context, opts map[string]string) error
	ListSnapshots(ctx context.Context) ([]string, error)
}

Snapshotter is an interface that describes methods for taking, restoring, deleting snapshots, and tracking them by a string snapshot ID.

type Store

type Store interface {
	Store(ctx context.Context, key string, val []byte) error
	Load(ctx context.Context, key string) ([]byte, error)
	Delete(ctx context.Context, key string) error
}

Store describes the ability to store and retrieve a buffer of metadata, indexed by a string key.

Directories

Path Synopsis
Package checker defines the framework for creating and restoring snapshots with a data integrity check
Package checker defines the framework for creating and restoring snapshots with a data integrity check
Package engine provides the framework for a snapshot repository testing engine
Package engine provides the framework for a snapshot repository testing engine
Package fiofilewriter provides a FileWriter based on FIO.
Package fiofilewriter provides a FileWriter based on FIO.
multiclient_test
framework
Package framework contains tools to enable multiple clients to connect to a central repository server and run robustness tests concurrently.
Package framework contains tools to enable multiple clients to connect to a central repository server and run robustness tests concurrently.
Package pathlock defines a PathLocker interface and an implementation that will synchronize based on filepath.
Package pathlock defines a PathLocker interface and an implementation that will synchronize based on filepath.
Package snapmeta provides Kopia implementations of Persister and Snapshotter.
Package snapmeta provides Kopia implementations of Persister and Snapshotter.

Jump to

Keyboard shortcuts

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