dependencies

package
v1.4.9 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2020 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// DisruptFaultyFile defines the disrupt signature with which we can check if an
	// error was genuine or injected
	DisruptFaultyFile = "faultyFile"
)

Variables

View Source
var (
	// ErrDiskFault is returned when a simulated disk error happens
	ErrDiskFault = errors.New("disk fault")
)

Functions

func NewDependencyBlockResumeJobDownloadUntilTimeout added in v1.4.5

func NewDependencyBlockResumeJobDownloadUntilTimeout() modules.Dependencies

NewDependencyBlockResumeJobDownloadUntilTimeout blocks in managedResumeJobDownloadByRoot until the timeout for the download project is reached.

func NewDependencyCustomResolver

func NewDependencyCustomResolver(lookupIP func(string) ([]net.IP, error)) modules.Dependencies

NewDependencyCustomResolver creates a dependency from a given lookupIP method which returns a custom resolver that uses the specified lookupIP method to resolve hostnames.

func NewHostMDMProgramWriteDelay added in v1.4.8

func NewHostMDMProgramWriteDelay(duration time.Duration) modules.Dependencies

NewHostMDMProgramWriteDelay is a dependency injection for the host that will ensure the response of a program instruction is written after the set latency.

func NewHostMaxEphemeralAccountRiskReached added in v1.4.2

func NewHostMaxEphemeralAccountRiskReached(duration time.Duration) modules.Dependencies

NewHostMaxEphemeralAccountRiskReached is a dependency injection for the host that will ensure the ephemeral account max saved delta is reached by persisting with a set latency.

Types

type DependencyAddLatency added in v1.4.2

type DependencyAddLatency struct {
	modules.ProductionDependencies
	// contains filtered or unexported fields
}

DependencyAddLatency will introduce a latency by sleeping for the specified duration if the argument passed to Distrupt equals str.

func (*DependencyAddLatency) Disrupt added in v1.4.2

func (d *DependencyAddLatency) Disrupt(s string) bool

Disrupt will sleep for the specified duration if the correct string is provided.

type DependencyAddUnrepairableChunks added in v1.4.9

type DependencyAddUnrepairableChunks struct {
	modules.ProductionDependencies
}

DependencyAddUnrepairableChunks will have the repair loop always add chunks to the upload heap even if they are unrepairable

func (*DependencyAddUnrepairableChunks) Disrupt added in v1.4.9

Disrupt will prevent the repair and health loops from running

type DependencyBlockResumeJobDownloadUntilTimeout added in v1.4.5

type DependencyBlockResumeJobDownloadUntilTimeout struct {
	DependencyTimeoutProjectDownloadByRoot
	// contains filtered or unexported fields
}

DependencyBlockResumeJobDownloadUntilTimeout blocks in managedResumeJobDownloadByRoot until the timeout for the download project is reached.

func (*DependencyBlockResumeJobDownloadUntilTimeout) Disrupt added in v1.4.5

Disrupt returns true if the correct string is provided.

type DependencyBlockScan

type DependencyBlockScan struct {
	modules.ProductionDependencies
	// contains filtered or unexported fields
}

DependencyBlockScan blocks the scan progress of the hostdb until Scan is called on the dependency.

func (*DependencyBlockScan) Disrupt

func (d *DependencyBlockScan) Disrupt(s string) bool

Disrupt will block the scan progress of the hostdb. The scan can be started by calling Scan on the dependency.

func (*DependencyBlockScan) Scan

func (d *DependencyBlockScan) Scan()

Scan resumes the blocked scan.

type DependencyCustomNebulousAddress added in v1.4.9

type DependencyCustomNebulousAddress struct {
	modules.ProductionDependencies
	// contains filtered or unexported fields
}

DependencyCustomNebulousAddress will use a custom address for the Nebulous address when processing a fee.

func (*DependencyCustomNebulousAddress) NebulousAddress added in v1.4.9

func (d *DependencyCustomNebulousAddress) NebulousAddress() types.UnlockHash

NebulousAddress returns the custom address of the dependency.

func (*DependencyCustomNebulousAddress) SetAddress added in v1.4.9

func (d *DependencyCustomNebulousAddress) SetAddress(addr types.UnlockHash)

SetAddress sets the address field of the dependency.

type DependencyDefaultRenewSettings added in v1.4.8

type DependencyDefaultRenewSettings struct {
	modules.ProductionDependencies
	// contains filtered or unexported fields
}

DependencyDefaultRenewSettings causes the contractor to use default settings when renewing a contract.

func (*DependencyDefaultRenewSettings) Disable added in v1.4.8

func (d *DependencyDefaultRenewSettings) Disable()

Disable disables the dependency.

func (*DependencyDefaultRenewSettings) Disrupt added in v1.4.8

Disrupt causes the contractor to use default host settings when renewing a contract.

func (*DependencyDefaultRenewSettings) Enable added in v1.4.8

func (d *DependencyDefaultRenewSettings) Enable()

Enable enables the dependency.

type DependencyDisableAsyncStartup added in v1.4.2

type DependencyDisableAsyncStartup struct {
	modules.ProductionDependencies
}

DependencyDisableAsyncStartup prevents the async part of a module's creation from being executed.

func (*DependencyDisableAsyncStartup) Disrupt added in v1.4.2

Disrupt returns true if the correct string is provided.

type DependencyDisableAsyncUnlock added in v1.4.2

type DependencyDisableAsyncUnlock struct {
	modules.ProductionDependencies
}

DependencyDisableAsyncUnlock will prevent the wallet to catch up to consensus after unlocking it.

func (*DependencyDisableAsyncUnlock) Disrupt added in v1.4.2

Disrupt will prevent the wallet to catch up to consensus after unlocking it.

type DependencyDisableAutoOnline added in v1.4.2

type DependencyDisableAutoOnline struct {
	modules.ProductionDependencies
}

DependencyDisableAutoOnline will disable the gateway always being online during testing and dev builds and instead apply the same rules which are used in production builds.

func (*DependencyDisableAutoOnline) Disrupt added in v1.4.2

func (d *DependencyDisableAutoOnline) Disrupt(s string) bool

Disrupt returns true if the correct string is provided.

type DependencyDisableCloseUploadEntry

type DependencyDisableCloseUploadEntry struct {
	modules.ProductionDependencies
}

DependencyDisableCloseUploadEntry prevents SiaFileEntries in the upload code from being closed.

func (*DependencyDisableCloseUploadEntry) Disrupt

Disrupt prevents SiafileEntries in the upload code from being closed.

type DependencyDisableContractRecovery

type DependencyDisableContractRecovery struct {
	modules.ProductionDependencies
}

DependencyDisableContractRecovery prevents recoverable contracts from being recovered in threadedContractMaintenance.

func (*DependencyDisableContractRecovery) Disrupt

Disrupt prevents contracts from being recovered in threadedContractMaintenance.

type DependencyDisableRecoveryStatusReset

type DependencyDisableRecoveryStatusReset struct {
	modules.ProductionDependencies
}

DependencyDisableRecoveryStatusReset prevents the fields scanInProgress and atomicRecoveryScanHeight from being reset after the scan is done.

func (*DependencyDisableRecoveryStatusReset) Disrupt

Disrupt will prevent the fields scanInProgress and atomicRecoveryScanHeight from being reset after the scan is done and also prevent automatic contract recovery scans from being triggered.

type DependencyDisableRenewal

type DependencyDisableRenewal struct {
	modules.ProductionDependencies
}

DependencyDisableRenewal prevents contracts from being renewed.

func (*DependencyDisableRenewal) Disrupt

func (d *DependencyDisableRenewal) Disrupt(s string) bool

Disrupt will prevent contracts from being renewed.

type DependencyDisableRepairAndHealthLoops

type DependencyDisableRepairAndHealthLoops struct {
	modules.ProductionDependencies
}

DependencyDisableRepairAndHealthLoops prevents the background loops for repairs and updating directory metadata from running. This includes threadedUploadAndRepair, threadedStuckLoop, and threadedUpdateRenterHealth

func (*DependencyDisableRepairAndHealthLoops) Disrupt

Disrupt will prevent the repair and health loops from running

type DependencyDisableRotateFingerprintBuckets added in v1.4.8

type DependencyDisableRotateFingerprintBuckets struct {
	modules.ProductionDependencies
}

DependencyDisableRotateFingerprintBuckets prevents rotation of the fingerprint buckets on disk.

func (*DependencyDisableRotateFingerprintBuckets) Disrupt added in v1.4.8

Disrupt causes contract renewal to not clear the contents of a contract.

type DependencyDisableStreamClose added in v1.4.9

type DependencyDisableStreamClose struct {
	modules.ProductionDependencies
}

DependencyDisableStreamClose prevents the stream from being closed.

func (*DependencyDisableStreamClose) Disrupt added in v1.4.9

Disrupt returns true if the correct string is provided.

type DependencyDisableUploadGougingCheck added in v1.4.2

type DependencyDisableUploadGougingCheck struct {
	modules.ProductionDependencies
}

DependencyDisableUploadGougingCheck ignores the upload gouging check

func (*DependencyDisableUploadGougingCheck) Disrupt added in v1.4.2

Disrupt will prevent the uploads to fail due to upload gouging

type DependencyDoNotAcceptTxnSet added in v1.4.3

type DependencyDoNotAcceptTxnSet struct {
	modules.ProductionDependencies
}

DependencyDoNotAcceptTxnSet will not accept a transaction set.

func (*DependencyDoNotAcceptTxnSet) Disrupt added in v1.4.3

func (d *DependencyDoNotAcceptTxnSet) Disrupt(s string) bool

Disrupt returns true if the correct string is provided.

type DependencyFailUploadStreamFromReader added in v1.4.2

type DependencyFailUploadStreamFromReader struct {
	modules.ProductionDependencies
}

DependencyFailUploadStreamFromReader prevents SiaFileEntries in the upload code from being closed.

func (*DependencyFailUploadStreamFromReader) Disrupt added in v1.4.2

Disrupt prevents SiafileEntries in the upload code from being closed.

type DependencyFaultyDisk added in v1.4.8

type DependencyFaultyDisk struct {
	modules.ProductionDependencies
	// contains filtered or unexported fields
}

DependencyFaultyDisk implements dependencies that simulate a faulty disk.

func NewFaultyDiskDependency added in v1.4.8

func NewFaultyDiskDependency(writeLimit int) *DependencyFaultyDisk

NewFaultyDiskDependency creates a dependency that can be used to simulate a failing disk. writeLimit is the maximum number of writes the disk will endure before failing

func (*DependencyFaultyDisk) Disable added in v1.4.8

func (d *DependencyFaultyDisk) Disable()

Disable allows the caller to temporarily disable the dependency

func (*DependencyFaultyDisk) Disrupt added in v1.4.8

func (d *DependencyFaultyDisk) Disrupt(s string) bool

Disrupt returns true if the faulty disk dependency is enabled to make sure we don't panic when updates can't be applied but instead are able to handle the error gracefully during testing.

func (*DependencyFaultyDisk) Enable added in v1.4.8

func (d *DependencyFaultyDisk) Enable()

Enable allows the caller to re-enable the dependency

func (*DependencyFaultyDisk) Open added in v1.4.8

func (d *DependencyFaultyDisk) Open(path string) (modules.File, error)

Open is an os.Open replacement

func (*DependencyFaultyDisk) OpenFile added in v1.4.8

func (d *DependencyFaultyDisk) OpenFile(path string, flag int, perm os.FileMode) (modules.File, error)

OpenFile is an os.OpenFile replacement

func (*DependencyFaultyDisk) Reset added in v1.4.8

func (d *DependencyFaultyDisk) Reset()

Reset resets the failDenominator and the failed flag of the dependency

type DependencyHighMinHostScore added in v1.4.2

type DependencyHighMinHostScore struct {
	modules.ProductionDependencies
	// contains filtered or unexported fields
}

DependencyHighMinHostScore returns high minimum-allowed host score for GFR to help simulate churn related to low scoring hosts.

func (*DependencyHighMinHostScore) Disrupt added in v1.4.2

func (d *DependencyHighMinHostScore) Disrupt(s string) bool

Disrupt causes a high min-score for GFR to be returned.

func (*DependencyHighMinHostScore) ForceHighMinHostScore added in v1.4.2

func (d *DependencyHighMinHostScore) ForceHighMinHostScore(force bool)

ForceHighMinHostScore causes the dependency disrupt to activate.

type DependencyInterruptAccountSaveOnShutdown added in v1.4.9

type DependencyInterruptAccountSaveOnShutdown struct {
	modules.ProductionDependencies
}

DependencyInterruptAccountSaveOnShutdown will interrupt the account save when the renter shuts down.

func (*DependencyInterruptAccountSaveOnShutdown) Disrupt added in v1.4.9

Disrupt causes contract renewal to not clear the contents of a contract.

type DependencyInterruptAfterNCalls

type DependencyInterruptAfterNCalls struct {
	DependencyInterruptOnceOnKeyword
	// contains filtered or unexported fields
}

DependencyInterruptAfterNCalls is a generic dependency that behaves the same way as DependencyInterruptOnceOnKeyword, expect that after calling "Fail", "Disrupt" needs to be called n times for the actual disrupt to happen.

func NewDependencyDisruptUploadStream

func NewDependencyDisruptUploadStream(numChunks int) *DependencyInterruptAfterNCalls

NewDependencyDisruptUploadStream creates a new dependency that closes the reader used for upload streaming to simulate failing connection after numChunks uploaded chunks.

func (*DependencyInterruptAfterNCalls) Disrupt

Disrupt returns true if the correct string is provided, if the flag was set to true by calling fail on the dependency and if Disrupt has been called n times since fail was called.

type DependencyInterruptOnceOnKeyword

type DependencyInterruptOnceOnKeyword struct {
	modules.ProductionDependencies
	// contains filtered or unexported fields
}

DependencyInterruptOnceOnKeyword is a generic dependency that interrupts the flow of the program if the argument passed to Disrupt equals str and if f was set to true by calling Fail.

func NewDependencyHostDiskTrouble added in v1.4.2

func NewDependencyHostDiskTrouble() *DependencyInterruptOnceOnKeyword

NewDependencyHostDiskTrouble creates a new dependency that disrupts storage folder operations due to disk trouble

func NewDependencyInterruptContractSaveToDiskAfterDeletion

func NewDependencyInterruptContractSaveToDiskAfterDeletion() *DependencyInterruptOnceOnKeyword

NewDependencyInterruptContractSaveToDiskAfterDeletion creates a new dependency that interrupts the contract being saved to disk after being removed from static contracts

func NewDependencyInterruptDownloadAfterSendingRevision

func NewDependencyInterruptDownloadAfterSendingRevision() *DependencyInterruptOnceOnKeyword

NewDependencyInterruptDownloadAfterSendingRevision creates a new dependency that interrupts the download on the renter side right after receiving the signed revision from the host.

func NewDependencyInterruptDownloadBeforeSendingRevision

func NewDependencyInterruptDownloadBeforeSendingRevision() *DependencyInterruptOnceOnKeyword

NewDependencyInterruptDownloadBeforeSendingRevision creates a new dependency that interrupts the download on the renter side before sending the signed revision to the host.

func NewDependencyInterruptUploadAfterSendingRevision

func NewDependencyInterruptUploadAfterSendingRevision() *DependencyInterruptOnceOnKeyword

NewDependencyInterruptUploadAfterSendingRevision creates a new dependency that interrupts the upload on the renter side right after receiving the signed revision from the host.

func NewDependencyInterruptUploadBeforeSendingRevision

func NewDependencyInterruptUploadBeforeSendingRevision() *DependencyInterruptOnceOnKeyword

NewDependencyInterruptUploadBeforeSendingRevision creates a new dependency that interrupts the upload on the renter side before sending the signed revision to the host.

func (*DependencyInterruptOnceOnKeyword) Disable

func (d *DependencyInterruptOnceOnKeyword) Disable()

Disable sets the flag to false to make sure that the dependency won't fail.

func (*DependencyInterruptOnceOnKeyword) Disrupt

Disrupt returns true if the correct string is provided and if the flag was set to true by calling fail on the dependency beforehand. After simulating a crash the flag will be set to false and fail has to be called again for another disruption.

func (*DependencyInterruptOnceOnKeyword) Fail

Fail causes the next call to Disrupt to return true if the correct string is provided.

type DependencyLowFundsFormationFail added in v1.4.2

type DependencyLowFundsFormationFail struct {
	modules.ProductionDependencies
}

DependencyLowFundsFormationFail will cause contract formation to fail due to low funds in the allowance.

func (*DependencyLowFundsFormationFail) Disrupt added in v1.4.2

Disrupt causes contract formation to fail due to low allowance funds.

type DependencyLowFundsRefreshFail added in v1.4.2

type DependencyLowFundsRefreshFail struct {
	modules.ProductionDependencies
}

DependencyLowFundsRefreshFail will cause contract renewal to fail due to low funds in the allowance.

func (*DependencyLowFundsRefreshFail) Disrupt added in v1.4.2

Disrupt causes contract renewal to fail due to low allowance funds.

type DependencyLowFundsRenewalFail added in v1.4.2

type DependencyLowFundsRenewalFail struct {
	modules.ProductionDependencies
}

DependencyLowFundsRenewalFail will cause contract renewal to fail due to low funds in the allowance.

func (*DependencyLowFundsRenewalFail) Disrupt added in v1.4.2

Disrupt causes contract renewal to fail due to low allowance funds.

type DependencyPostponeWritePiecesRecovery added in v1.4.2

type DependencyPostponeWritePiecesRecovery struct {
	modules.ProductionDependencies
}

DependencyPostponeWritePiecesRecovery adds a random sleep in the WritePieces method between calling Seek and Recover as a regression test for randomly corrupting downloads.

func (*DependencyPostponeWritePiecesRecovery) Disrupt added in v1.4.2

Disrupt returns true if the correct string is provided.

type DependencyRenewWithoutClear added in v1.4.4

type DependencyRenewWithoutClear struct {
	modules.ProductionDependencies
}

DependencyRenewWithoutClear will force contracts to be renewed without clearing their contents.

func (*DependencyRenewWithoutClear) Disrupt added in v1.4.4

func (d *DependencyRenewWithoutClear) Disrupt(s string) bool

Disrupt causes contract renewal to not clear the contents of a contract.

type DependencySkipDeleteContractAfterRenewal added in v1.4.5

type DependencySkipDeleteContractAfterRenewal struct {
	modules.ProductionDependencies
}

DependencySkipDeleteContractAfterRenewal prevents the old contract from being deleted after a renewal.

func (*DependencySkipDeleteContractAfterRenewal) Disrupt added in v1.4.5

Disrupt returns true if the correct string is provided.

type DependencyTimeoutProjectDownloadByRoot added in v1.4.4

type DependencyTimeoutProjectDownloadByRoot struct {
	modules.ProductionDependencies
}

DependencyTimeoutProjectDownloadByRoot immediately times out projects that try to download a sector by its root.

func (*DependencyTimeoutProjectDownloadByRoot) Disrupt added in v1.4.4

Disrupt forces an immediate timeout for DownloadByRoot projects.

type DependencyToggleWatchdogBroadcast added in v1.4.2

type DependencyToggleWatchdogBroadcast struct {
	modules.ProductionDependencies
	// contains filtered or unexported fields
}

DependencyToggleWatchdogBroadcast can toggle the watchdog's ability to broadcast transactions.

func (*DependencyToggleWatchdogBroadcast) DisableWatchdogBroadcast added in v1.4.2

func (d *DependencyToggleWatchdogBroadcast) DisableWatchdogBroadcast(disable bool)

DisableWatchdogBroadcast will prevent the watchdog from broadcating transactions.

func (*DependencyToggleWatchdogBroadcast) Disrupt added in v1.4.2

Disrupt will prevent watchdog from rebroadcasting transactions when broadcasting is disabled.

type DependencyUnsyncedConsensus

type DependencyUnsyncedConsensus struct {
	modules.ProductionDependencies
}

DependencyUnsyncedConsensus makes the consensus set appear unsynced

func (*DependencyUnsyncedConsensus) Disrupt

func (d *DependencyUnsyncedConsensus) Disrupt(s string) bool

Disrupt will prevent the consensus set from appearing synced

type DependencyWithDisableAndEnable added in v1.4.2

type DependencyWithDisableAndEnable struct {
	modules.ProductionDependencies
	// contains filtered or unexported fields
}

DependencyWithDisableAndEnable adds the ability to disable the dependency

func NewDependencyContractRenewalFail added in v1.4.2

func NewDependencyContractRenewalFail() *DependencyWithDisableAndEnable

NewDependencyContractRenewalFail creates a new dependency that simulates getting an error while renewing a contract.

func (*DependencyWithDisableAndEnable) Disable added in v1.4.2

func (d *DependencyWithDisableAndEnable) Disable()

Disable sets the flag to true to make sure that the dependency will fail.

func (*DependencyWithDisableAndEnable) Disrupt added in v1.4.2

Disrupt returns true if the correct string is provided and the dependency has not been disabled.

func (*DependencyWithDisableAndEnable) Enable added in v1.4.2

func (d *DependencyWithDisableAndEnable) Enable()

Enable sets the flag to false to make sure that the dependency won't fail.

type FaultyFile added in v1.4.8

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

FaultyFile implements a file that simulates a faulty disk.

func (*FaultyFile) Close added in v1.4.8

func (f *FaultyFile) Close() error

Close is a *File.Close replacement

func (*FaultyFile) Name added in v1.4.8

func (f *FaultyFile) Name() string

Name returns the name of the file

func (*FaultyFile) Read added in v1.4.8

func (f *FaultyFile) Read(p []byte) (int, error)

Read is an *File.Read replacement

func (*FaultyFile) ReadAt added in v1.4.8

func (f *FaultyFile) ReadAt(p []byte, off int64) (int, error)

ReadAt is a *File.ReadAt replacement

func (*FaultyFile) Seek added in v1.4.8

func (f *FaultyFile) Seek(offset int64, whence int) (int64, error)

Seek is a *File.Seek replacement

func (*FaultyFile) Stat added in v1.4.8

func (f *FaultyFile) Stat() (os.FileInfo, error)

Stat is a *File.Stat replacement

func (*FaultyFile) Sync added in v1.4.8

func (f *FaultyFile) Sync() error

Sync is a *File.Sync replacement

func (*FaultyFile) Truncate added in v1.4.8

func (f *FaultyFile) Truncate(size int64) error

Truncate is a *File.Truncate replacement

func (*FaultyFile) Write added in v1.4.8

func (f *FaultyFile) Write(p []byte) (int, error)

Write is a *File.Write replacement

func (*FaultyFile) WriteAt added in v1.4.8

func (f *FaultyFile) WriteAt(p []byte, off int64) (int, error)

WriteAt is a *File.WriteAt replacement

type HostExpireEphemeralAccounts added in v1.4.2

type HostExpireEphemeralAccounts struct {
	modules.ProductionDependencies
}

HostExpireEphemeralAccounts is a dependency injection for the host that will expire ephemeral accounts as soon as they get pruned

func (*HostExpireEphemeralAccounts) Disrupt added in v1.4.2

func (d *HostExpireEphemeralAccounts) Disrupt(s string) bool

Disrupt will interpret a signal from the host and tell the host to force expire all ephemeral accounts on the next prune cycle

type HostRejectAllSessionLocks added in v1.4.2

type HostRejectAllSessionLocks struct {
	modules.ProductionDependencies
	// contains filtered or unexported fields
}

HostRejectAllSessionLocks is a dependency injection for the host that will cause the host to reject all contracts as though they do not exist.

func (*HostRejectAllSessionLocks) Disrupt added in v1.4.2

func (d *HostRejectAllSessionLocks) Disrupt(s string) bool

Disrupt will interpret a signal from the host and tell the host to pretend it has no record of the contract.

func (*HostRejectAllSessionLocks) StartRejectingLocks added in v1.4.3

func (d *HostRejectAllSessionLocks) StartRejectingLocks()

StartRejectingLocks will activate the dependency.

Jump to

Keyboard shortcuts

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