Documentation
¶
Overview ¶
Package testsetups compresses common test setups and more complicated setups like performance and chaos tests.
Index ¶
- type ChainlinkProfileTest
- type ChainlinkProfileTestInputs
- type DonChain
- type DonChainConfig
- type KeeperBenchmarkTest
- func (k *KeeperBenchmarkTest) DeployBenchmarkKeeperContracts(index int)
- func (k *KeeperBenchmarkTest) DeployKeeperConsumersBenchmark() contracts.AutomationConsumerBenchmark
- func (k *KeeperBenchmarkTest) Run()
- func (k *KeeperBenchmarkTest) SendSlackNotification(slackClient *slack.Client, config tt.KeeperBenchmarkTestConfig) error
- func (k *KeeperBenchmarkTest) Setup(env *environment.Environment, config tt.KeeperBenchmarkTestConfig)
- func (k *KeeperBenchmarkTest) TearDownVals(t *testing.T) (*testing.T, string, []*client.ChainlinkK8sClient, reportModel.TestReporter, ...)
- type KeeperBenchmarkTestInputs
- type OCRSoakTest
- func (o *OCRSoakTest) DeployEnvironment(customChainlinkNetworkTOML string, ocrTestConfig tt.OcrTestConfig)
- func (o *OCRSoakTest) Environment() *environment.Environment
- func (o *OCRSoakTest) Interrupted() bool
- func (o *OCRSoakTest) LoadState() error
- func (o *OCRSoakTest) Resume()
- func (o *OCRSoakTest) Run()
- func (o *OCRSoakTest) SaveState() error
- func (o *OCRSoakTest) Setup(ocrTestConfig tt.OcrTestConfig)
- func (o *OCRSoakTest) TearDownVals(t *testing.T) (*testing.T, *seth.Client, string, []*client.ChainlinkK8sClient, ...)
- type OCRSoakTestState
- type PreDeployedContracts
- type UpkeepConfig
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) Setup ¶
func (c *ChainlinkProfileTest) Setup(env *environment.Environment)
Setup prepares contracts for the test
func (*ChainlinkProfileTest) TearDownVals ¶
func (c *ChainlinkProfileTest) TearDownVals() (*environment.Environment, []*client.ChainlinkK8sClient, reportModel.TestReporter, blockchain.EVMClient)
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
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 ¶
func (k *KeeperBenchmarkTest) Setup(env *environment.Environment, config tt.KeeperBenchmarkTestConfig)
Setup prepares contracts for the test
func (*KeeperBenchmarkTest) TearDownVals ¶
func (k *KeeperBenchmarkTest) TearDownVals(t *testing.T) ( *testing.T, string, []*client.ChainlinkK8sClient, reportModel.TestReporter, reportModel.GrafanaURLProvider, blockchain.EVMClient, )
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) 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 ¶
func (o *OCRSoakTest) TearDownVals(t *testing.T) ( *testing.T, *seth.Client, string, []*client.ChainlinkK8sClient, reportModel.TestReporter, reportModel.GrafanaURLProvider, )
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