Documentation ¶
Index ¶
- Constants
- Variables
- type CLClusterTestEnv
- func (te *CLClusterTestEnv) Cleanup(opts CleanupOpts) error
- func (te *CLClusterTestEnv) FundChainlinkNodes(amount *big.Float) error
- func (te *CLClusterTestEnv) GetEVMClient(chainId int64) (blockchain.EVMClient, error)
- func (te *CLClusterTestEnv) GetRpcProvider(chainId int64) (*test_env.RpcProvider, error)
- func (te *CLClusterTestEnv) GetSethClient(chainId int64) (*seth.Client, error)
- func (te *CLClusterTestEnv) GetSethClientForSelectedNetwork() (*seth.Client, error)
- func (te *CLClusterTestEnv) ParallelTransactions(enabled bool)
- func (te *CLClusterTestEnv) StartClCluster(nodeConfig *chainlink.Config, count int, secretsConfig string, ...) error
- func (te *CLClusterTestEnv) StartEthereumNetwork(cfg *ctf_config.EthereumNetworkConfig) (blockchain.EVMNetwork, test_env.RpcProvider, error)
- func (te *CLClusterTestEnv) StartMockAdapter() error
- func (te *CLClusterTestEnv) Terminate() error
- func (te *CLClusterTestEnv) WithTestEnvConfig(cfg *TestEnvConfig) *CLClusterTestEnv
- func (te *CLClusterTestEnv) WithTestInstance(t *testing.T) *CLClusterTestEnv
- type CLTestEnvBuilder
- func (b *CLTestEnvBuilder) Build() (*CLClusterTestEnv, error)
- func (b *CLTestEnvBuilder) WithCLNodeConfig(cfg *chainlink.Config) *CLTestEnvBuilderdeprecated
- func (b *CLTestEnvBuilder) WithCLNodeOptions(opt ...ClNodeOption) *CLTestEnvBuilder
- func (b *CLTestEnvBuilder) WithCLNodes(clNodesCount int) *CLTestEnvBuilder
- func (b *CLTestEnvBuilder) WithChainlinkNodeLogScanner(settings ChainlinkNodeLogScannerSettings) *CLTestEnvBuilder
- func (b *CLTestEnvBuilder) WithCustomCleanup(customFn func()) *CLTestEnvBuilder
- func (b *CLTestEnvBuilder) WithEVMNetworkOptions(opts ...EVMNetworkOption) *CLTestEnvBuilder
- func (b *CLTestEnvBuilder) WithFunding(eth *big.Float) *CLTestEnvBuilder
- func (b *CLTestEnvBuilder) WithMockAdapter() *CLTestEnvBuilder
- func (b *CLTestEnvBuilder) WithNonEVM() *CLTestEnvBuilder
- func (b *CLTestEnvBuilder) WithPrivateEthereumNetwork(en ctf_config.EthereumNetworkConfig) *CLTestEnvBuilder
- func (b *CLTestEnvBuilder) WithPrivateEthereumNetworks(ens []*ctf_config.EthereumNetworkConfig) *CLTestEnvBuilder
- func (b *CLTestEnvBuilder) WithSecretsConfig(secrets string) *CLTestEnvBuilder
- func (b *CLTestEnvBuilder) WithSeth() *CLTestEnvBuilder
- func (b *CLTestEnvBuilder) WithStandardCleanup() *CLTestEnvBuilder
- func (b *CLTestEnvBuilder) WithTestConfig(cfg ctf_config.GlobalTestConfig) *CLTestEnvBuilder
- func (b *CLTestEnvBuilder) WithTestEnv(te *CLClusterTestEnv) (*CLTestEnvBuilder, error)
- func (b *CLTestEnvBuilder) WithTestInstance(t *testing.T) *CLTestEnvBuilder
- func (b *CLTestEnvBuilder) WithoutChainlinkNodeLogScanner() *CLTestEnvBuilder
- func (b *CLTestEnvBuilder) WithoutCleanup() *CLTestEnvBuilder
- func (b *CLTestEnvBuilder) WithoutEvmClients() *CLTestEnvBuilder
- func (b *CLTestEnvBuilder) WithoutLogStream() *CLTestEnvBuilder
- type ChainlinkNodeLogScannerSettings
- type ClCluster
- func (c *ClCluster) CopyFolderFromNodes(ctx context.Context, srcPath, destPath string) error
- func (c *ClCluster) NodeAPIs() []*client.ChainlinkClient
- func (c *ClCluster) NodeAddresses() ([]common.Address, error)
- func (c *ClCluster) NodeCSAKeys() ([]string, error)
- func (c *ClCluster) Start() error
- func (c *ClCluster) Stop() error
- type ClNode
- func (n *ClNode) AddBootstrapJob(verifierAddr common.Address, chainId int64, feedId [32]byte) (*client.Job, error)
- func (n *ClNode) AddMercuryOCRJob(verifierAddr common.Address, fromBlock uint64, chainId int64, feedId [32]byte, ...) (*client.Job, error)
- func (n *ClNode) ChainlinkNodeAddress() (common.Address, error)
- func (n *ClNode) ExecGetVersion() (string, error)
- func (n *ClNode) Fund(evmClient blockchain.EVMClient, amount *big.Float) error
- func (n *ClNode) GetAPIClient() *client.ChainlinkClient
- func (n *ClNode) GetContainerName() string
- func (n *ClNode) GetNodeCSAKeys() (*client.CSAKeys, error)
- func (n *ClNode) GetPeerUrl() (string, error)
- func (n *ClNode) PrimaryETHAddress() (string, error)
- func (n *ClNode) Restart(cfg *chainlink.Config) error
- func (n *ClNode) RestartContainer() error
- func (n *ClNode) SetTestLogger(t *testing.T)
- func (n *ClNode) StartContainer() error
- func (n *ClNode) UpgradeVersion(newImage, newVersion string) error
- type ClNodeOption
- func WithDbContainerName(name string) ClNodeOption
- func WithImage(image string) ClNodeOption
- func WithLogStream(ls *logstream.LogStream) ClNodeOption
- func WithNodeContainerName(name string) ClNodeOption
- func WithNodeEnvVars(ev map[string]string) ClNodeOption
- func WithPgDBOptions(opts ...test_env.PostgresDbOption) ClNodeOption
- func WithSecrets(secretsTOML string) ClNodeOption
- func WithVersion(version string) ClNodeOption
- type CleanUpType
- type CleanupOpts
- type EVMNetworkOption
- type GethConfig
- type MockAdapterConfig
- type TestEnvConfig
Constants ¶
const ( RestartContainer = true StartNewContainer = false )
Variables ¶
var ( ErrConnectNodeClient = "could not connect Node HTTP Client" ErrStartCLNodeContainer = "failed to start CL node container" )
var DefaultAllowedMessages = []testreporters.AllowedLogMessage{ testreporters.NewAllowedLogMessage("Failed to get LINK balance", "Happens only when we deploy LINK token for test purposes. Harmless.", zapcore.ErrorLevel, testreporters.WarnAboutAllowedMsgs_No), testreporters.NewAllowedLogMessage("Error stopping job service", "It's a known issue with lifecycle. There's ongoing work that will fix it.", zapcore.DPanicLevel, testreporters.WarnAboutAllowedMsgs_No), }
var DefaultChainlinkNodeLogScannerSettings = ChainlinkNodeLogScannerSettings{ FailingLogLevel: zapcore.DPanicLevel, Threshold: 1, AllowedMessages: DefaultAllowedMessages, }
var (
ErrFundCLNode = "failed to fund CL node"
)
var (
ErrGetNodeCSAKeys = "failed get CL node CSA keys"
)
Functions ¶
This section is empty.
Types ¶
type CLClusterTestEnv ¶
type CLClusterTestEnv struct { Cfg *TestEnvConfig DockerNetwork *tc.DockerNetwork LogStream *logstream.LogStream TestConfig ctf_config.GlobalTestConfig /* components */ ClCluster *ClCluster MockAdapter *test_env.Killgrave ContractDeployer contracts.ContractDeployer ContractLoader contracts.ContractLoader PrivateEthereumConfigs []*ctf_config.EthereumNetworkConfig EVMNetworks []*blockchain.EVMNetwork // contains filtered or unexported fields }
func NewTestEnv ¶
func NewTestEnv() (*CLClusterTestEnv, error)
func (*CLClusterTestEnv) Cleanup ¶
func (te *CLClusterTestEnv) Cleanup(opts CleanupOpts) error
Cleanup cleans the environment up after it's done being used, mainly for returning funds when on live networks and logs.
func (*CLClusterTestEnv) FundChainlinkNodes ¶
func (te *CLClusterTestEnv) FundChainlinkNodes(amount *big.Float) error
FundChainlinkNodes will fund all the provided Chainlink nodes with a set amount of native currency
func (*CLClusterTestEnv) GetEVMClient ¶
func (te *CLClusterTestEnv) GetEVMClient(chainId int64) (blockchain.EVMClient, error)
func (*CLClusterTestEnv) GetRpcProvider ¶
func (te *CLClusterTestEnv) GetRpcProvider(chainId int64) (*test_env.RpcProvider, error)
func (*CLClusterTestEnv) GetSethClient ¶
func (te *CLClusterTestEnv) GetSethClient(chainId int64) (*seth.Client, error)
func (*CLClusterTestEnv) GetSethClientForSelectedNetwork ¶
func (te *CLClusterTestEnv) GetSethClientForSelectedNetwork() (*seth.Client, error)
func (*CLClusterTestEnv) ParallelTransactions ¶
func (te *CLClusterTestEnv) ParallelTransactions(enabled bool)
func (*CLClusterTestEnv) StartClCluster ¶
func (te *CLClusterTestEnv) StartClCluster(nodeConfig *chainlink.Config, count int, secretsConfig string, testconfig ctf_config.GlobalTestConfig, opts ...ClNodeOption) error
pass config here
func (*CLClusterTestEnv) StartEthereumNetwork ¶
func (te *CLClusterTestEnv) StartEthereumNetwork(cfg *ctf_config.EthereumNetworkConfig) (blockchain.EVMNetwork, test_env.RpcProvider, error)
func (*CLClusterTestEnv) StartMockAdapter ¶
func (te *CLClusterTestEnv) StartMockAdapter() error
func (*CLClusterTestEnv) Terminate ¶
func (te *CLClusterTestEnv) Terminate() error
func (*CLClusterTestEnv) WithTestEnvConfig ¶
func (te *CLClusterTestEnv) WithTestEnvConfig(cfg *TestEnvConfig) *CLClusterTestEnv
WithTestEnvConfig sets the test environment cfg. Sets up private ethereum chain and MockAdapter containers with the provided cfg.
func (*CLClusterTestEnv) WithTestInstance ¶
func (te *CLClusterTestEnv) WithTestInstance(t *testing.T) *CLClusterTestEnv
type CLTestEnvBuilder ¶
type CLTestEnvBuilder struct { /* funding */ ETHFunds *big.Float // contains filtered or unexported fields }
func NewCLTestEnvBuilder ¶
func NewCLTestEnvBuilder() *CLTestEnvBuilder
func (*CLTestEnvBuilder) Build ¶
func (b *CLTestEnvBuilder) Build() (*CLClusterTestEnv, error)
func (*CLTestEnvBuilder) WithCLNodeConfig
deprecated
func (b *CLTestEnvBuilder) WithCLNodeConfig(cfg *chainlink.Config) *CLTestEnvBuilder
Deprecated: Use TOML instead
func (*CLTestEnvBuilder) WithCLNodeOptions ¶
func (b *CLTestEnvBuilder) WithCLNodeOptions(opt ...ClNodeOption) *CLTestEnvBuilder
func (*CLTestEnvBuilder) WithCLNodes ¶
func (b *CLTestEnvBuilder) WithCLNodes(clNodesCount int) *CLTestEnvBuilder
func (*CLTestEnvBuilder) WithChainlinkNodeLogScanner ¶
func (b *CLTestEnvBuilder) WithChainlinkNodeLogScanner(settings ChainlinkNodeLogScannerSettings) *CLTestEnvBuilder
func (*CLTestEnvBuilder) WithCustomCleanup ¶
func (b *CLTestEnvBuilder) WithCustomCleanup(customFn func()) *CLTestEnvBuilder
func (*CLTestEnvBuilder) WithEVMNetworkOptions ¶
func (b *CLTestEnvBuilder) WithEVMNetworkOptions(opts ...EVMNetworkOption) *CLTestEnvBuilder
WithEVMNetworkOptions sets the options for the EVM network. This is especially useful for simulated networks, which by usually use default options, so if we want to change any of them before the configuration is passed to evm client or Chainlnik node, we can do it here.
func (*CLTestEnvBuilder) WithFunding ¶
func (b *CLTestEnvBuilder) WithFunding(eth *big.Float) *CLTestEnvBuilder
func (*CLTestEnvBuilder) WithMockAdapter ¶
func (b *CLTestEnvBuilder) WithMockAdapter() *CLTestEnvBuilder
func (*CLTestEnvBuilder) WithNonEVM ¶
func (b *CLTestEnvBuilder) WithNonEVM() *CLTestEnvBuilder
WithNonEVM sets the test environment to not use EVM when built.
func (*CLTestEnvBuilder) WithPrivateEthereumNetwork ¶
func (b *CLTestEnvBuilder) WithPrivateEthereumNetwork(en ctf_config.EthereumNetworkConfig) *CLTestEnvBuilder
func (*CLTestEnvBuilder) WithPrivateEthereumNetworks ¶
func (b *CLTestEnvBuilder) WithPrivateEthereumNetworks(ens []*ctf_config.EthereumNetworkConfig) *CLTestEnvBuilder
func (*CLTestEnvBuilder) WithSecretsConfig ¶
func (b *CLTestEnvBuilder) WithSecretsConfig(secrets string) *CLTestEnvBuilder
func (*CLTestEnvBuilder) WithSeth ¶
func (b *CLTestEnvBuilder) WithSeth() *CLTestEnvBuilder
func (*CLTestEnvBuilder) WithStandardCleanup ¶
func (b *CLTestEnvBuilder) WithStandardCleanup() *CLTestEnvBuilder
func (*CLTestEnvBuilder) WithTestConfig ¶
func (b *CLTestEnvBuilder) WithTestConfig(cfg ctf_config.GlobalTestConfig) *CLTestEnvBuilder
func (*CLTestEnvBuilder) WithTestEnv ¶
func (b *CLTestEnvBuilder) WithTestEnv(te *CLClusterTestEnv) (*CLTestEnvBuilder, error)
WithTestEnv sets the test environment to use for the test. If nil, a new test environment is created. If not nil, the test environment is used as-is. If TEST_ENV_CONFIG_PATH is set, the test environment is created with the config at that path.
func (*CLTestEnvBuilder) WithTestInstance ¶
func (b *CLTestEnvBuilder) WithTestInstance(t *testing.T) *CLTestEnvBuilder
WithTestLogger sets the test logger to use for the test. Useful for parallel tests so the logging will be separated correctly in the results views.
func (*CLTestEnvBuilder) WithoutChainlinkNodeLogScanner ¶
func (b *CLTestEnvBuilder) WithoutChainlinkNodeLogScanner() *CLTestEnvBuilder
func (*CLTestEnvBuilder) WithoutCleanup ¶
func (b *CLTestEnvBuilder) WithoutCleanup() *CLTestEnvBuilder
func (*CLTestEnvBuilder) WithoutEvmClients ¶
func (b *CLTestEnvBuilder) WithoutEvmClients() *CLTestEnvBuilder
func (*CLTestEnvBuilder) WithoutLogStream ¶
func (b *CLTestEnvBuilder) WithoutLogStream() *CLTestEnvBuilder
WithoutLogStream disables LogStream logging component
type ChainlinkNodeLogScannerSettings ¶
type ChainlinkNodeLogScannerSettings struct { FailingLogLevel zapcore.Level Threshold uint AllowedMessages []testreporters.AllowedLogMessage }
func GetDefaultChainlinkNodeLogScannerSettingsWithExtraAllowedMessages ¶
func GetDefaultChainlinkNodeLogScannerSettingsWithExtraAllowedMessages(extraAllowedMessages ...testreporters.AllowedLogMessage) ChainlinkNodeLogScannerSettings
type ClCluster ¶
type ClCluster struct {
Nodes []*ClNode `json:"nodes"`
}
func (*ClCluster) CopyFolderFromNodes ¶
func (*ClCluster) NodeAPIs ¶
func (c *ClCluster) NodeAPIs() []*client.ChainlinkClient
func (*ClCluster) NodeAddresses ¶
Return all the on-chain wallet addresses for a set of Chainlink nodes
func (*ClCluster) NodeCSAKeys ¶
type ClNode ¶
type ClNode struct { test_env.EnvComponent API *client.ChainlinkClient `json:"-"` NodeConfig *chainlink.Config `json:"-"` NodeSecretsConfigTOML string `json:"-"` PostgresDb *test_env.PostgresDb `json:"postgresDb"` UserEmail string `json:"userEmail"` UserPassword string `json:"userPassword"` AlwaysPullImage bool `json:"-"` // contains filtered or unexported fields }
func (*ClNode) AddBootstrapJob ¶
func (*ClNode) AddMercuryOCRJob ¶
func (*ClNode) ChainlinkNodeAddress ¶
func (*ClNode) ExecGetVersion ¶
func (*ClNode) GetAPIClient ¶
func (n *ClNode) GetAPIClient() *client.ChainlinkClient
func (*ClNode) GetContainerName ¶
func (*ClNode) GetPeerUrl ¶
func (*ClNode) PrimaryETHAddress ¶
func (*ClNode) RestartContainer ¶
func (*ClNode) SetTestLogger ¶
func (*ClNode) StartContainer ¶
func (*ClNode) UpgradeVersion ¶
UpgradeVersion restarts the cl node with new image and version
type ClNodeOption ¶
type ClNodeOption = func(c *ClNode)
func WithDbContainerName ¶
func WithDbContainerName(name string) ClNodeOption
Sets custom node db container name if name is not empty
func WithImage ¶
func WithImage(image string) ClNodeOption
func WithLogStream ¶
func WithLogStream(ls *logstream.LogStream) ClNodeOption
func WithNodeContainerName ¶
func WithNodeContainerName(name string) ClNodeOption
Sets custom node container name if name is not empty
func WithNodeEnvVars ¶
func WithNodeEnvVars(ev map[string]string) ClNodeOption
func WithPgDBOptions ¶
func WithPgDBOptions(opts ...test_env.PostgresDbOption) ClNodeOption
func WithSecrets ¶
func WithSecrets(secretsTOML string) ClNodeOption
func WithVersion ¶
func WithVersion(version string) ClNodeOption
type CleanUpType ¶
type CleanUpType string
const ( CleanUpTypeNone CleanUpType = "none" CleanUpTypeStandard CleanUpType = "standard" CleanUpTypeCustom CleanUpType = "custom" )
type CleanupOpts ¶
type CleanupOpts struct {
TestName string
}
type EVMNetworkOption ¶
type EVMNetworkOption = func(*blockchain.EVMNetwork) *blockchain.EVMNetwork
type GethConfig ¶
type GethConfig struct {
ContainerName string `json:"container_name"`
}
type MockAdapterConfig ¶
type TestEnvConfig ¶
type TestEnvConfig struct { Networks []string `json:"networks"` Geth GethConfig `json:"geth"` MockAdapter MockAdapterConfig `json:"mock_adapter"` ClCluster *ClCluster `json:"clCluster"` EthereumNetworkConfig *ctf_config.EthereumNetworkConfig `json:"private_ethereum_config"` }
func NewTestEnvConfigFromFile ¶
func NewTestEnvConfigFromFile(path string) (*TestEnvConfig, error)
func (*TestEnvConfig) Json ¶
func (c *TestEnvConfig) Json() string