test

package
v1.1.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// AutopilotConfig is the autopilot used for testing unless a different
	// one is explicitly set.
	AutopilotConfig = api.AutopilotConfig{
		Contracts: api.ContractsConfig{
			Allowance:   types.Siacoins(1).Mul64(1e3),
			Amount:      3,
			Period:      144,
			RenewWindow: 72,

			Download: rhpv2.SectorSize * 500,
			Upload:   rhpv2.SectorSize * 500,
			Storage:  rhpv2.SectorSize * 5e3,

			Set:   ContractSet,
			Prune: false,
		},
		Hosts: api.HostsConfig{
			MaxDowntimeHours:      10,
			MinRecentScanFailures: 10,
			AllowRedundantIPs:     true,
		},
	}

	ContractSet         = "testset"
	ContractSetSettings = api.ContractSetSetting{
		Default: ContractSet,
	}

	GougingSettings = api.GougingSettings{
		MaxRPCPrice:      types.Siacoins(1).Div64(1000),
		MaxContractPrice: types.Siacoins(10),
		MaxDownloadPrice: types.Siacoins(1).Mul64(1000),
		MaxUploadPrice:   types.Siacoins(1).Mul64(1000),
		MaxStoragePrice:  types.Siacoins(1000).Div64(144 * 30),

		HostBlockHeightLeeway: 240,

		MinPriceTableValidity:         10 * time.Second,
		MinAccountExpiry:              time.Hour,
		MinMaxEphemeralAccountBalance: types.Siacoins(1),
	}

	PricePinSettings = api.DefaultPricePinSettings

	RedundancySettings = api.RedundancySettings{
		MinShards:   2,
		TotalShards: 3,
	}

	S3AccessKeyID     = "TESTINGYNHUWCPKOPSYQ"
	S3SecretAccessKey = "Rh30BNyj+qNI4ftYRteoZbHJ3X4Ln71QtZkRXzJ9"
	S3Credentials     = credentials.NewStaticV4(S3AccessKeyID, S3SecretAccessKey, "")
)

Functions

func NewHost added in v1.0.7

func NewHost(hk types.PublicKey, pt rhpv3.HostPriceTable, settings rhpv2.HostSettings) api.Host

func NewHostPriceTable added in v1.0.7

func NewHostPriceTable() rhpv3.HostPriceTable

func NewHostSettings added in v1.0.7

func NewHostSettings() rhpv2.HostSettings

func NewHosts added in v1.0.7

func NewHosts(n int) []api.Host

func RandomHostKey added in v1.0.7

func RandomHostKey() types.PublicKey

func Retry

func Retry(tries int, durationBetweenAttempts time.Duration, fn func() error) error

Types

type TT

type TT interface {
	TestingCommon

	AssertContains(err error, target string)
	AssertIs(err, target error)
	FailAll(vs ...interface{})
	OK(err error)
	OKAll(vs ...interface{})

	// Retry will call 'fn' 'tries' times, waiting 'durationBetweenAttempts'
	// between each attempt, returning 'nil' the first time that 'fn'
	// returns nil. If 'nil' is never returned, then the final error
	// returned by 'fn' is returned.
	Retry(tries int, durationBetweenAttempts time.Duration, fn func() error)
}

func NewTT

func NewTT(tc TestingCommon) TT

type TestingCommon

type TestingCommon interface {
	Log(args ...any)
	Logf(format string, args ...any)
	Error(args ...any)
	Errorf(format string, args ...any)
	Fatal(args ...any)
	Fatalf(format string, args ...any)
	Skip(args ...any)
	Skipf(format string, args ...any)
	SkipNow()
	Skipped() bool
	Helper()
	Cleanup(f func())
	TempDir() string
	Setenv(key, value string)
}

TestingCommon is an interface that describes the common methods of testing.T and testing.B ensuring this testutil can be used in both contexts.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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