dependencies

package
v1.5.8 Latest Latest
Warning

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

Go to latest
Published: May 18, 2022 License: MIT Imports: 7 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 AccountingDisablePersistLoop

type AccountingDisablePersistLoop struct {
	modules.ProductionDependencies
}

AccountingDisablePersistLoop is a dependency that disables the background loop from updating and persisting the accounting information.

func (*AccountingDisablePersistLoop) Disrupt

Disrupt will prevent the Accounting module from launching the background persist loop.

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 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 DependencyDelayChunkDistribution

type DependencyDelayChunkDistribution struct {
	modules.ProductionDependencies
}

DependencyDelayChunkDistribution delays the chunk distribution in callAddUploadChunk by 1 second and skips the actual distribution.

func (*DependencyDelayChunkDistribution) Disrupt

Disrupt returns true if the correct string is provided.

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 DependencyDisableCriticalOnMaxBalance

type DependencyDisableCriticalOnMaxBalance struct {
	modules.ProductionDependencies
}

DependencyDisableCriticalOnMaxBalance prevents a build.Critical to be thrown when we encounter a `MaxBalanceExceeded` error on the host

func (*DependencyDisableCriticalOnMaxBalance) Disrupt

Disrupt returns true if the correct string is provided.

type DependencyDisableHostSiamux

type DependencyDisableHostSiamux struct {
	modules.ProductionDependencies
}

DependencyDisableHostSiamux will disable siamux in the host.

func (*DependencyDisableHostSiamux) Disrupt

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

Disrupt returns true if the correct string is provided.

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 DependencyDisableRepairAndHealthLoopsMulti

type DependencyDisableRepairAndHealthLoopsMulti struct {
	modules.ProductionDependencies
}

DependencyDisableRepairAndHealthLoopsMulti prevents the background loops for repairs and updating directory metadata from running in multiple places. This includes threadedUploadAndRepair, threadedStuckLoop, and threadedUpdateRenterHealth

func (*DependencyDisableRepairAndHealthLoopsMulti) 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 DependencyDisableWorker

type DependencyDisableWorker struct {
	modules.ProductionDependencies
}

DependencyDisableWorker will disable the worker's work loop, the health loop, the repair loop and the snapshot loop.

func (*DependencyDisableWorker) Disrupt

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

Disrupt returns true if the correct string is provided.

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 DependencyDontUpdateStuckStatusOnCleanup

type DependencyDontUpdateStuckStatusOnCleanup struct {
	modules.ProductionDependencies
}

DependencyDontUpdateStuckStatusOnCleanup will not set the chunk's stuck status when cleaning up the upload chunk.

func (*DependencyDontUpdateStuckStatusOnCleanup) Disrupt

Disrupt will ignore a failed repair.

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 DependencyInterruptCountOccurrences

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

DependencyInterruptCountOccurrences is a generic dependency that interrupts the flow of the program if the argument passed to Disrupt equals str and it keeps track of how many times this happened.

func (*DependencyInterruptCountOccurrences) Disrupt

Disrupt returns true if the correct string is provided. It keeps track of how many times this occurred.

func (*DependencyInterruptCountOccurrences) Occurrences

Occurrences returns the amount of time this dependency was successfully disrupted.

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 NewDependencyCorruptMDMOutput

func NewDependencyCorruptMDMOutput() *DependencyInterruptOnceOnKeyword

NewDependencyCorruptMDMOutput returns a dependency that can be used to manually corrupt the MDM output returned by hosts.

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 DependencyInvalidateStatsCache

type DependencyInvalidateStatsCache struct {
	modules.ProductionDependencies
}

DependencyInvalidateStatsCache invalidates the threadeInvalidateStatsCache loop.

func (*DependencyInvalidateStatsCache) Disrupt

Disrupt returns true if the correct string is provided.

type DependencyLegacyRenew

type DependencyLegacyRenew struct {
	modules.ProductionDependencies
}

DependencyLegacyRenew forces the contractor to use the legacy behavior when renewing a contract. This is useful for unit testing since it doesn't require a renter, workers etc.

func (*DependencyLegacyRenew) Disrupt

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

Disrupt returns 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 DependencyNoSnapshotSync

type DependencyNoSnapshotSync struct {
	modules.ProductionDependencies
}

DependencyNoSnapshotSync prevents the renter from syncing snapshots.

func (*DependencyNoSnapshotSync) Disrupt

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

Disrupt returns true if the correct string is provided.

type DependencyNoSnapshotSyncInterruptAccountSaveOnShutdown

type DependencyNoSnapshotSyncInterruptAccountSaveOnShutdown struct {
	modules.ProductionDependencies
}

DependencyNoSnapshotSyncInterruptAccountSaveOnShutdown will interrupt the account save when the renter shuts down and also disable the snapshot syncing thread.

func (*DependencyNoSnapshotSyncInterruptAccountSaveOnShutdown) Disrupt

Disrupt returns true if the correct string is provided.

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 DependencyReadRegistryBlocking

type DependencyReadRegistryBlocking struct {
	modules.ProductionDependencies
}

DependencyReadRegistryBlocking will block the read registry call by making it think that it got one more worker than it actually has. Therefore, waiting for a response that never comes.

func (*DependencyReadRegistryBlocking) Disrupt

Disrupt returns true if the correct string is provided.

type DependencyRegistryUpdateLyingHost

type DependencyRegistryUpdateLyingHost struct {
	modules.ProductionDependencies
}

DependencyRegistryUpdateLyingHost causes RegistryUpdate to return the most recent known value for a lookup together with a ErrSameRevNum error.

func (*DependencyRegistryUpdateLyingHost) Disrupt

Disrupt returns true if the correct string is provided.

type DependencyRenewFail

type DependencyRenewFail struct {
	modules.ProductionDependencies
}

DependencyRenewFail causes the renewal to fail on the host side.

func (*DependencyRenewFail) Disrupt

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

Disrupt returns true if the correct string is provided.

type DependencyResolveSkylinkToFixture

type DependencyResolveSkylinkToFixture struct {
	modules.ProductionDependencies
}

DependencyResolveSkylinkToFixture will disable downloading skylinks and will replace it with fetching from a set of predefined fixtures.

func (*DependencyResolveSkylinkToFixture) Disrupt

Disrupt causes skylink data to be loaded from fixtures instead of downloaded.

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 DependencySkipPrepareNextChunk

type DependencySkipPrepareNextChunk struct {
	modules.ProductionDependencies
}

DependencySkipPrepareNextChunk skips the managedPrepareNextChunk step when calling managedPushChunkForRepair.

func (*DependencySkipPrepareNextChunk) Disrupt

Disrupt forces an immediate timeout for DownloadByRoot projects.

type DependencyStorageObligationNotFound

type DependencyStorageObligationNotFound struct {
	modules.ProductionDependencies
}

DependencyStorageObligationNotFound will cause the host to return that it wasn't able to find a storage obligation in managedPayByContract.

func (*DependencyStorageObligationNotFound) Disrupt

Disrupt returns true if the correct string is provided.

type DependencyTimeoutOnHostGET

type DependencyTimeoutOnHostGET struct {
	modules.ProductionDependencies
}

DependencyTimeoutOnHostGET times out when the client performs the HTTP call to GET /host.

func (*DependencyTimeoutOnHostGET) Disrupt

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

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 DependencyToggleDisableDeleteBlockedFiles

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

DependencyToggleDisableDeleteBlockedFiles can toggle the renter's ability to delete blocked files in the health loop.

func (*DependencyToggleDisableDeleteBlockedFiles) DisableDeleteBlockedFiles

func (d *DependencyToggleDisableDeleteBlockedFiles) DisableDeleteBlockedFiles(disable bool)

DisableDeleteBlockedFiles will toggle the renter's ability to delete blocked files.

func (*DependencyToggleDisableDeleteBlockedFiles) Disrupt

Disrupt will prevent the renter from deleting blocked files when delete is disabled.

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 NewDependencyCorruptReadSector

func NewDependencyCorruptReadSector() *DependencyWithDisableAndEnable

NewDependencyCorruptReadSector returns a dependency that can be used to ensure ReadSector instructions on the host fail due to corruption of the MDM output.

NOTE: this dependency is very similar to 'NewDependencyCorruptMDMOutput' and even uses the same disrupt string, the difference is that this is an enable-disable, and not interrupt once.

func NewDependencyDisableCommitPaymentIntent

func NewDependencyDisableCommitPaymentIntent() *DependencyWithDisableAndEnable

NewDependencyDisableCommitPaymentIntent creates a new dependency that prevents the contractor for committing a payment intent, this essentially ensures the renter's revision is not in sync with the host's revision.

func NewDependencyHostBlockRPC

func NewDependencyHostBlockRPC() *DependencyWithDisableAndEnable

NewDependencyHostBlockRPC creates a new dependency that can be used to simulate an unresponsive host.

func NewDependencyHostLosePriceTable

func NewDependencyHostLosePriceTable() *DependencyWithDisableAndEnable

NewDependencyHostLosePriceTable creates a dependency, that causes the host to act is if it can not find a price table for given UID.

func NewDependencyInterruptNewStreamTimeout

func NewDependencyInterruptNewStreamTimeout() *DependencyWithDisableAndEnable

NewDependencyInterruptNewStreamTimeout a dependency that interrupts interaction with a stream by timing out on trying to create a new stream with the host.

func NewDependencyRegistryUpdateNoOp

func NewDependencyRegistryUpdateNoOp() *DependencyWithDisableAndEnable

NewDependencyRegistryUpdateNoOp creates a dependency, that causes RegistryUpdate to be a no-op.

func NewDependencySkyfileUploadFail

func NewDependencySkyfileUploadFail() *DependencyWithDisableAndEnable

NewDependencySkyfileUploadFail creates a new dependency that simulates getting an error while uploading a skyfile.

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 HostOutOfSyncInTest

type HostOutOfSyncInTest struct {
	modules.ProductionDependencies
}

HostOutOfSyncInTest is a dependency that allows for the host to be seen as out of sync in testing.

func (*HostOutOfSyncInTest) Disrupt

func (d *HostOutOfSyncInTest) 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.

type HostSlowDownload

type HostSlowDownload struct {
	modules.ProductionDependencies
}

HostSlowDownload is a dependency injection for the host that will insert a sleep on every read adding a latency to downloads.

func (*HostSlowDownload) Disrupt

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

Disrupt returns true if the correct string is provided.

Jump to

Keyboard shortcuts

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