package dmflakey
import "go.etcd.io/bbolt/tests/dmflakey"
Index ¶
- type FSType
- type FeatOpt
- func WithIntervalFeatOpt(interval time.Duration) FeatOpt
- func WithSyncFSFeatOpt(syncFS bool) FeatOpt
- type Flakey
Types ¶
type FSType ¶
type FSType string
FSType represents the filesystem name.
Supported filesystems.
type FeatOpt ¶
type FeatOpt func(*featCfg)
FeatOpt is used to configure failure feature.
func WithIntervalFeatOpt ¶
WithIntervalFeatOpt updates the up time for the feature.
func WithSyncFSFeatOpt ¶
WithSyncFSFeatOpt is to determine if the caller wants to synchronize filesystem before inject failure.
type Flakey ¶
type Flakey interface {
// DevicePath returns the flakey device path.
DevicePath() string
// Filesystem returns filesystem's type.
Filesystem() FSType
// AllowWrites allows write I/O.
AllowWrites(opts ...FeatOpt) error
// DropWrites drops all write I/O silently.
DropWrites(opts ...FeatOpt) error
// ErrorWrites drops all write I/O and returns error.
ErrorWrites(opts ...FeatOpt) error
// Teardown releases the flakey device.
Teardown() error
}
Flakey is to inject failure into device.
func InitFlakey ¶
func InitFlakey(flakeyDevice, dataStorePath string, fsType FSType, mkfsOpt string) (_ Flakey, retErr error)
InitFlakey creates an filesystem on a loopback device and returns Flakey on it.
The device-mapper device will be /dev/mapper/$flakeyDevice. And the filesystem image will be created at $dataStorePath/$flakeyDevice.img. By default, the device is available for 2 minutes and size is 10 GiB.
Source Files ¶
dmflakey.go dmsetup.go loopback.go
- Version
- v1.4.1
- Published
- Jun 10, 2025
- Platform
- linux/amd64
- Imports
- 10 packages
- Last checked
- 12 hours ago –
Tools for package owners.