dependencies

package
v1.4.13 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2021 License: MIT Imports: 8 Imported by: 0

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

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 NewHostMaxEphemeralAccountRiskReached

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

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

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

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

type DependencyAddUnrepairableChunks

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

Disrupt will prevent the repair and health loops from running

type DependencyBlockResumeJobDownloadUntilTimeout

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

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

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

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

NebulousAddress returns the custom address of the dependency.

func (*DependencyCustomNebulousAddress) SetAddress

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

SetAddress sets the address field of the dependency.

type DependencyDefaultRenewSettings

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

func (d *DependencyDefaultRenewSettings) Disable()

Disable disables the dependency.

func (*DependencyDefaultRenewSettings) Disrupt

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

func (*DependencyDefaultRenewSettings) Enable

func (d *DependencyDefaultRenewSettings) Enable()

Enable enables the dependency.

type DependencyDisableAsyncStartup

type DependencyDisableAsyncStartup struct {
	modules.ProductionDependencies
}

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

func (*DependencyDisableAsyncStartup) Disrupt

Disrupt returns true if the correct string is provided.

type DependencyDisableAsyncUnlock

type DependencyDisableAsyncUnlock struct {
	modules.ProductionDependencies
}

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

func (*DependencyDisableAsyncUnlock) Disrupt

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

type DependencyDisableAutoOnline

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

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

type DependencyDisableRotateFingerprintBuckets struct {
	modules.ProductionDependencies
}

DependencyDisableRotateFingerprintBuckets prevents rotation of the fingerprint buckets on disk.

func (*DependencyDisableRotateFingerprintBuckets) Disrupt

Disrupt returns true if the correct string is provided.

type DependencyDisableStreamClose

type DependencyDisableStreamClose struct {
	modules.ProductionDependencies
}

DependencyDisableStreamClose prevents the stream from being closed.

func (*DependencyDisableStreamClose) Disrupt

Disrupt returns true if the correct string is provided.

type DependencyDisableUploadGougingCheck

type DependencyDisableUploadGougingCheck struct {
	modules.ProductionDependencies
}

DependencyDisableUploadGougingCheck ignores the upload gouging check

func (*DependencyDisableUploadGougingCheck) Disrupt

Disrupt will prevent the uploads to fail due to upload gouging

type DependencyDoNotAcceptTxnSet

type DependencyDoNotAcceptTxnSet struct {
	modules.ProductionDependencies
}

DependencyDoNotAcceptTxnSet will not accept a transaction set.

func (*DependencyDoNotAcceptTxnSet) Disrupt

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

Disrupt returns true if the correct string is provided.

type DependencyFailUploadStreamFromReader

type DependencyFailUploadStreamFromReader struct {
	modules.ProductionDependencies
}

DependencyFailUploadStreamFromReader prevents SiaFileEntries in the upload code from being closed.

func (*DependencyFailUploadStreamFromReader) Disrupt

Disrupt prevents SiafileEntries in the upload code from being closed.

type DependencyFaultyDisk

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

DependencyFaultyDisk implements dependencies that simulate a faulty disk.

func NewFaultyDiskDependency

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

func (d *DependencyFaultyDisk) Disable()

Disable allows the caller to temporarily disable the dependency

func (*DependencyFaultyDisk) Disrupt

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

func (d *DependencyFaultyDisk) Enable()

Enable allows the caller to re-enable the dependency

func (*DependencyFaultyDisk) Open

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

Open is an os.Open replacement

func (*DependencyFaultyDisk) OpenFile

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

OpenFile is an os.OpenFile replacement

func (*DependencyFaultyDisk) Reset

func (d *DependencyFaultyDisk) Reset()

Reset resets the failDenominator and the failed flag of the dependency

type DependencyHighMinHostScore

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

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

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

func (*DependencyHighMinHostScore) ForceHighMinHostScore

func (d *DependencyHighMinHostScore) ForceHighMinHostScore(force bool)

ForceHighMinHostScore causes the dependency disrupt to activate.

type DependencyInterruptAccountSaveOnShutdown

type DependencyInterruptAccountSaveOnShutdown struct {
	modules.ProductionDependencies
}

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

func (*DependencyInterruptAccountSaveOnShutdown) Disrupt

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

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

type DependencyLowFundsFormationFail struct {
	modules.ProductionDependencies
}

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

func (*DependencyLowFundsFormationFail) Disrupt

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

type DependencyLowFundsRefreshFail

type DependencyLowFundsRefreshFail struct {
	modules.ProductionDependencies
}

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

func (*DependencyLowFundsRefreshFail) Disrupt

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

type DependencyLowFundsRenewalFail

type DependencyLowFundsRenewalFail struct {
	modules.ProductionDependencies
}

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

func (*DependencyLowFundsRenewalFail) Disrupt

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

type DependencyPostponeWritePiecesRecovery

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

Disrupt returns true if the correct string is provided.

type DependencyPreventEARefill

type DependencyPreventEARefill struct {
	modules.ProductionDependencies
}

DependencyPreventEARefill prevents EAs from being refilled automatically.

func (*DependencyPreventEARefill) Disrupt

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

Disrupt returns true if the correct string is provided.

type DependencyRenewWithoutClear

type DependencyRenewWithoutClear struct {
	modules.ProductionDependencies
}

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

func (*DependencyRenewWithoutClear) Disrupt

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

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

type DependencySkipDeleteContractAfterRenewal

type DependencySkipDeleteContractAfterRenewal struct {
	modules.ProductionDependencies
}

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

func (*DependencySkipDeleteContractAfterRenewal) Disrupt

Disrupt returns true if the correct string is provided.

type DependencyTimeoutProjectDownloadByRoot

type DependencyTimeoutProjectDownloadByRoot struct {
	modules.ProductionDependencies
}

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

func (*DependencyTimeoutProjectDownloadByRoot) Disrupt

Disrupt forces an immediate timeout for DownloadByRoot projects.

type DependencyToggleWatchdogBroadcast

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

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

func (*DependencyToggleWatchdogBroadcast) DisableWatchdogBroadcast

func (d *DependencyToggleWatchdogBroadcast) DisableWatchdogBroadcast(disable bool)

DisableWatchdogBroadcast will prevent the watchdog from broadcating transactions.

func (*DependencyToggleWatchdogBroadcast) Disrupt

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

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

DependencyWithDisableAndEnable adds the ability to disable the dependency

func NewDependencyContractRenewalFail

func NewDependencyContractRenewalFail() *DependencyWithDisableAndEnable

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

func (*DependencyWithDisableAndEnable) Disable

func (d *DependencyWithDisableAndEnable) Disable()

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

func (*DependencyWithDisableAndEnable) Disrupt

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

func (*DependencyWithDisableAndEnable) Enable

func (d *DependencyWithDisableAndEnable) Enable()

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

type FaultyFile

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

FaultyFile implements a file that simulates a faulty disk.

func (*FaultyFile) Close

func (f *FaultyFile) Close() error

Close is a *File.Close replacement

func (*FaultyFile) Name

func (f *FaultyFile) Name() string

Name returns the name of the file

func (*FaultyFile) Read

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

Read is an *File.Read replacement

func (*FaultyFile) ReadAt

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

ReadAt is a *File.ReadAt replacement

func (*FaultyFile) Seek

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

Seek is a *File.Seek replacement

func (*FaultyFile) Stat

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

Stat is a *File.Stat replacement

func (*FaultyFile) Sync

func (f *FaultyFile) Sync() error

Sync is a *File.Sync replacement

func (*FaultyFile) Truncate

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

Truncate is a *File.Truncate replacement

func (*FaultyFile) Write

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

Write is a *File.Write replacement

func (*FaultyFile) WriteAt

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

WriteAt is a *File.WriteAt replacement

type HostExpireEphemeralAccounts

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

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 HostLowerDeposit

type HostLowerDeposit struct {
	modules.ProductionDependencies
}

HostLowerDeposit is a dependency injection for the host that will make the deposit amount substantially lower. This allows us to verify the renter has synced its account balance with the host's balance after an unclean shutdown.

func (*HostLowerDeposit) Disrupt

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

Disrupt returns true if the correct string is provided.

type HostMDMProgramDelayedWrite

type HostMDMProgramDelayedWrite struct {
	modules.ProductionDependencies
}

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

func (*HostMDMProgramDelayedWrite) Disrupt

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

Disrupt returns true if the correct string is provided.

type HostRejectAllSessionLocks

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

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

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