test_env

package
v0.0.0-...-692deea Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: MIT Imports: 50 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	RestartContainer  = true
	StartNewContainer = false
)

Variables

View Source
var (
	ErrConnectNodeClient    = "could not connect Node HTTP Client"
	ErrStartCLNodeContainer = "failed to start CL node container"
)
View Source
var (
	ErrFundCLNode = "failed to fund CL node"
)
View Source
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) 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 (*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) EVMClientNetworkOptions

func (b *CLTestEnvBuilder) EVMClientNetworkOptions(opts ...EVMClientNetworkOption) *CLTestEnvBuilder

func (*CLTestEnvBuilder) WithCLNodeConfig

func (b *CLTestEnvBuilder) WithCLNodeConfig(cfg *chainlink.Config) *CLTestEnvBuilder

func (*CLTestEnvBuilder) WithCLNodeOptions

func (b *CLTestEnvBuilder) WithCLNodeOptions(opt ...ClNodeOption) *CLTestEnvBuilder

func (*CLTestEnvBuilder) WithCLNodes

func (b *CLTestEnvBuilder) WithCLNodes(clNodesCount int) *CLTestEnvBuilder

func (*CLTestEnvBuilder) WithChainOptions

func (b *CLTestEnvBuilder) WithChainOptions(opts ...ChainOption) *CLTestEnvBuilder

func (*CLTestEnvBuilder) WithCustomCleanup

func (b *CLTestEnvBuilder) WithCustomCleanup(customFn func()) *CLTestEnvBuilder

func (*CLTestEnvBuilder) WithForwarders

func (b *CLTestEnvBuilder) WithForwarders() *CLTestEnvBuilder

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 (*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) WithoutCleanup

func (b *CLTestEnvBuilder) WithoutCleanup() *CLTestEnvBuilder

func (*CLTestEnvBuilder) WithoutLogStream

func (b *CLTestEnvBuilder) WithoutLogStream() *CLTestEnvBuilder

WithoutLogStream disables LogStream logging component

type ChainOption

type ChainOption = func(*evmcfg.Chain) *evmcfg.Chain

type ClCluster

type ClCluster struct {
	Nodes []*ClNode `json:"nodes"`
}

func (*ClCluster) CopyFolderFromNodes

func (c *ClCluster) CopyFolderFromNodes(ctx context.Context, srcPath, destPath string) error

func (*ClCluster) NodeAPIs

func (c *ClCluster) NodeAPIs() []*client.ChainlinkClient

func (*ClCluster) NodeAddresses

func (c *ClCluster) NodeAddresses() ([]common.Address, error)

Return all the on-chain wallet addresses for a set of Chainlink nodes

func (*ClCluster) NodeCSAKeys

func (c *ClCluster) NodeCSAKeys() ([]string, error)

func (*ClCluster) Start

func (c *ClCluster) Start() error

Start all nodes in the cluster./docker/tests/functional/api

func (*ClCluster) Stop

func (c *ClCluster) Stop() error

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 NewClNode

func NewClNode(networks []string, imageName, imageVersion string, nodeConfig *chainlink.Config, opts ...ClNodeOption) (*ClNode, error)

func (*ClNode) AddBootstrapJob

func (n *ClNode) AddBootstrapJob(verifierAddr common.Address, chainId int64,
	feedId [32]byte) (*client.Job, error)

func (*ClNode) AddMercuryOCRJob

func (n *ClNode) AddMercuryOCRJob(verifierAddr common.Address, fromBlock uint64, chainId int64,
	feedId [32]byte, customAllowedFaults *int, bootstrapUrl string,
	mercuryServerUrl string, mercuryServerPubKey string,
	eaUrls []*url.URL) (*client.Job, error)

func (*ClNode) ChainlinkNodeAddress

func (n *ClNode) ChainlinkNodeAddress() (common.Address, error)

func (*ClNode) ExecGetVersion

func (n *ClNode) ExecGetVersion() (string, error)

func (*ClNode) Fund

func (n *ClNode) Fund(evmClient blockchain.EVMClient, amount *big.Float) error

func (*ClNode) GetAPIClient

func (n *ClNode) GetAPIClient() *client.ChainlinkClient

func (*ClNode) GetContainerName

func (n *ClNode) GetContainerName() string

func (*ClNode) GetNodeCSAKeys

func (n *ClNode) GetNodeCSAKeys() (*client.CSAKeys, error)

func (*ClNode) GetPeerUrl

func (n *ClNode) GetPeerUrl() (string, error)

func (*ClNode) PrimaryETHAddress

func (n *ClNode) PrimaryETHAddress() (string, error)

func (*ClNode) Restart

func (n *ClNode) Restart(cfg *chainlink.Config) error

Restart restarts only CL node, DB container is reused

func (*ClNode) RestartContainer

func (n *ClNode) RestartContainer() error

func (*ClNode) SetTestLogger

func (n *ClNode) SetTestLogger(t *testing.T)

func (*ClNode) StartContainer

func (n *ClNode) StartContainer() error

func (*ClNode) UpgradeVersion

func (n *ClNode) UpgradeVersion(newImage, newVersion string) error

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 EVMClientNetworkOption

type EVMClientNetworkOption = func(*blockchain.EVMNetwork) *blockchain.EVMNetwork

type GethConfig

type GethConfig struct {
	ContainerName string `json:"container_name"`
}

type MockAdapterConfig

type MockAdapterConfig struct {
	ContainerName string `json:"container_name"`
	ImpostersPath string `json:"imposters_path"`
}

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

Jump to

Keyboard shortcuts

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