testsetups

package
v0.0.0-...-e21be2a Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 55 Imported by: 1

Documentation

Overview

Package testsetups compresses common test setups and more complicated setups like performance and chaos tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainlinkProfileTest

type ChainlinkProfileTest struct {
	Inputs       ChainlinkProfileTestInputs
	TestReporter testreporters.ChainlinkProfileTestReporter
	// contains filtered or unexported fields
}

ChainlinkProfileTest runs a piece of code on Chainlink nodes with PPROF enabled, then downloads the PPROF results

func NewChainlinkProfileTest

func NewChainlinkProfileTest(inputs ChainlinkProfileTestInputs) *ChainlinkProfileTest

NewChainlinkProfileTest prepares a new keeper Chainlink profiling test to be run

func (*ChainlinkProfileTest) Run

func (c *ChainlinkProfileTest) Run()

Run runs the profiling test

func (*ChainlinkProfileTest) Setup

Setup prepares contracts for the test

func (*ChainlinkProfileTest) TearDownVals

Networks returns the networks that the test is running on

type ChainlinkProfileTestInputs

type ChainlinkProfileTestInputs struct {
	ProfileFunction func(*client.ChainlinkClient)
	ProfileDuration time.Duration
	ChainlinkNodes  []*client.ChainlinkK8sClient
}

ChainlinkProfileTestInputs are the inputs necessary to run a profiling tests

type DonChain

type DonChain struct {
	EVMClient         blockchain.EVMClient
	EVMNetwork        *blockchain.EVMNetwork
	ContractDeployer  contracts.ContractDeployer
	LinkTokenContract contracts.LinkToken
	ChainlinkNodes    []*client.ChainlinkK8sClient
	Mockserver        *ctfClient.MockserverClient
	// contains filtered or unexported fields
}

func NewDonChain

func NewDonChain(conf *DonChainConfig, logger zerolog.Logger) *DonChain

func (*DonChain) Deploy

func (s *DonChain) Deploy()

type DonChainConfig

type DonChainConfig struct {
	T               *testing.T
	Env             *e.Environment
	EVMNetwork      *blockchain.EVMNetwork
	EthereumProps   *ethereum.Props
	ChainlinkValues map[string]interface{}
}

type KeeperBenchmarkTest

type KeeperBenchmarkTest struct {
	Inputs       KeeperBenchmarkTestInputs
	TestReporter testreporters.KeeperBenchmarkTestReporter
	// contains filtered or unexported fields
}

KeeperBenchmarkTest builds a test to check that chainlink nodes are able to upkeep a specified amount of Upkeep contracts within a certain block time

func NewKeeperBenchmarkTest

func NewKeeperBenchmarkTest(t *testing.T, inputs KeeperBenchmarkTestInputs) *KeeperBenchmarkTest

NewKeeperBenchmarkTest prepares a new keeper benchmark test to be run

func (*KeeperBenchmarkTest) DeployBenchmarkKeeperContracts

func (k *KeeperBenchmarkTest) DeployBenchmarkKeeperContracts(index int)

DeployBenchmarkKeeperContracts deploys a set amount of keeper Benchmark contracts registered to a single registry

func (*KeeperBenchmarkTest) DeployKeeperConsumersBenchmark

func (k *KeeperBenchmarkTest) DeployKeeperConsumersBenchmark() contracts.AutomationConsumerBenchmark

func (*KeeperBenchmarkTest) Run

func (k *KeeperBenchmarkTest) Run()

Run runs the keeper benchmark test

func (*KeeperBenchmarkTest) SendSlackNotification

func (k *KeeperBenchmarkTest) SendSlackNotification(slackClient *slack.Client, config tt.KeeperBenchmarkTestConfig) error

func (*KeeperBenchmarkTest) Setup

Setup prepares contracts for the test

func (*KeeperBenchmarkTest) TearDownVals

TearDownVals returns the networks that the test is running on

type KeeperBenchmarkTestInputs

type KeeperBenchmarkTestInputs struct {
	BlockchainClient       blockchain.EVMClient              // Client for the test to connect to the blockchain with
	KeeperRegistrySettings *contracts.KeeperRegistrySettings // Settings of each keeper contract
	Upkeeps                *UpkeepConfig
	Contracts              *PreDeployedContracts
	Timeout                time.Duration                    // Timeout for the test
	ChainlinkNodeFunding   *big.Float                       // Amount of ETH to fund each chainlink node with
	UpkeepSLA              int64                            // SLA in number of blocks for an upkeep to be performed once it becomes eligible
	RegistryVersions       []ethereum.KeeperRegistryVersion // Registry version to use
	ForceSingleTxnKey      bool
	BlockTime              time.Duration
	DeltaStage             time.Duration
	DeleteJobsOnEnd        bool
}

KeeperBenchmarkTestInputs are all the required inputs for a Keeper Benchmark Test

type OCRSoakTest

type OCRSoakTest struct {
	Config                *tc.TestConfig
	TestReporter          testreporters.OCRSoakTestReporter
	OperatorForwarderFlow bool
	// contains filtered or unexported fields
}

OCRSoakTest defines a typical OCR soak test

func NewOCRSoakTest

func NewOCRSoakTest(t *testing.T, config *tc.TestConfig, forwarderFlow bool) (*OCRSoakTest, error)

NewOCRSoakTest creates a new OCR soak test to setup and run

func (*OCRSoakTest) DeployEnvironment

func (o *OCRSoakTest) DeployEnvironment(customChainlinkNetworkTOML string, ocrTestConfig tt.OcrTestConfig)

DeployEnvironment deploys the test environment, starting all Chainlink nodes and other components for the test

func (*OCRSoakTest) Environment

func (o *OCRSoakTest) Environment() *environment.Environment

Environment returns the full K8s test environment

func (*OCRSoakTest) Interrupted

func (o *OCRSoakTest) Interrupted() bool

Interrupted indicates whether the test was interrupted by something like a K8s rebalance or not

func (*OCRSoakTest) LoadState

func (o *OCRSoakTest) LoadState() error

LoadState loads the test state from a TOML file

func (*OCRSoakTest) Resume

func (o *OCRSoakTest) Resume()

func (*OCRSoakTest) Run

func (o *OCRSoakTest) Run()

Run starts the OCR soak test

func (*OCRSoakTest) SaveState

func (o *OCRSoakTest) SaveState() error

SaveState saves the current state of the test to a TOML file

func (*OCRSoakTest) Setup

func (o *OCRSoakTest) Setup(ocrTestConfig tt.OcrTestConfig)

func (*OCRSoakTest) TearDownVals

Networks returns the networks that the test is running on

type OCRSoakTestState

type OCRSoakTestState struct {
	Namespace            string                         `toml:"namespace"`
	OCRRoundStates       []*testreporters.OCRRoundState `toml:"ocrRoundStates"`
	TestIssues           []*testreporters.TestIssue     `toml:"testIssues"`
	StartingBlockNum     uint64                         `toml:"startingBlockNum"`
	StartTime            time.Time                      `toml:"startTime"`
	TimeRunning          time.Duration                  `toml:"timeRunning"`
	TestDuration         time.Duration                  `toml:"testDuration"`
	OCRContractAddresses []string                       `toml:"ocrContractAddresses"`
	OCRVersion           string                         `toml:"ocrVersion"`

	BootStrapNodeURL string   `toml:"bootstrapNodeURL"`
	WorkerNodeURLs   []string `toml:"workerNodeURLs"`
	ChainURL         string   `toml:"chainURL"`
	MockServerURL    string   `toml:"mockServerURL"`
}

OCRSoakTestState contains all the info needed by the test to recover from a K8s rebalance, assuming the test was in a running state

type PreDeployedContracts

type PreDeployedContracts struct {
	RegistryAddress  string
	RegistrarAddress string
	LinkTokenAddress string
	EthFeedAddress   string
	GasFeedAddress   string
}

PreDeployedContracts are contracts that are already deployed on a (usually) live testnet chain, so re-deployment in unnecessary

type UpkeepConfig

type UpkeepConfig struct {
	NumberOfUpkeeps     int   // Number of upkeep contracts
	BlockRange          int64 // How many blocks to run the test for
	BlockInterval       int64 // Interval of blocks that upkeeps are expected to be performed
	CheckGasToBurn      int64 // How much gas should be burned on checkUpkeep() calls
	PerformGasToBurn    int64 // How much gas should be burned on performUpkeep() calls
	UpkeepGasLimit      int64 // Maximum gas that can be consumed by the upkeeps
	FirstEligibleBuffer int64 // How many blocks to add to randomised first eligible block, set to 0 to disable randomised first eligible block
}

UpkeepConfig dictates details of how the test's upkeep contracts should be called and configured

Jump to

Keyboard shortcuts

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