From a5e0ff9592ff7b47c5fdb6f6f0fef7bc237529fe Mon Sep 17 00:00:00 2001 From: Tate Date: Tue, 12 Sep 2023 14:32:48 -0600 Subject: [PATCH 1/8] [TT-591] Fix E2E Test Logging In Parallel Tests --- .../actions/automation_ocr_helpers_local.go | 33 ++++++++++--------- .../actions/keeper_helpers_local.go | 13 ++++---- integration-tests/docker/test_env/cl_node.go | 8 +++-- integration-tests/docker/test_env/test_env.go | 17 ++++++---- .../docker/test_env/test_env_builder.go | 14 ++++++-- integration-tests/smoke/automation_test.go | 8 +++-- integration-tests/smoke/cron_test.go | 1 + integration-tests/smoke/flux_test.go | 1 + integration-tests/smoke/forwarder_ocr_test.go | 1 + .../smoke/forwarders_ocr2_test.go | 1 + integration-tests/smoke/keeper_test.go | 31 +++++++++-------- integration-tests/smoke/ocr2_test.go | 1 + integration-tests/smoke/ocr_test.go | 1 + integration-tests/smoke/runlog_test.go | 1 + integration-tests/smoke/vrf_test.go | 1 + 15 files changed, 81 insertions(+), 51 deletions(-) diff --git a/integration-tests/actions/automation_ocr_helpers_local.go b/integration-tests/actions/automation_ocr_helpers_local.go index dce55e42275..86738b0247d 100644 --- a/integration-tests/actions/automation_ocr_helpers_local.go +++ b/integration-tests/actions/automation_ocr_helpers_local.go @@ -4,17 +4,14 @@ package actions import ( "encoding/json" "fmt" - "testing" "time" "github.com/ethereum/go-ethereum/common" "github.com/lib/pq" "github.com/pkg/errors" - "github.com/rs/zerolog/log" - "github.com/stretchr/testify/require" + "github.com/rs/zerolog" "gopkg.in/guregu/null.v4" - "github.com/smartcontractkit/chainlink-testing-framework/utils" "github.com/smartcontractkit/chainlink/integration-tests/client" "github.com/smartcontractkit/chainlink/integration-tests/contracts" "github.com/smartcontractkit/chainlink/integration-tests/contracts/ethereum" @@ -30,24 +27,23 @@ import ( ) func BuildAutoOCR2ConfigVarsLocal( - t *testing.T, + l zerolog.Logger, chainlinkNodes []*client.ChainlinkClient, registryConfig contracts.KeeperRegistrySettings, registrar string, deltaStage time.Duration, ) (contracts.OCRv2Config, error) { - return BuildAutoOCR2ConfigVarsWithKeyIndexLocal(t, chainlinkNodes, registryConfig, registrar, deltaStage, 0) + return BuildAutoOCR2ConfigVarsWithKeyIndexLocal(l, chainlinkNodes, registryConfig, registrar, deltaStage, 0) } func BuildAutoOCR2ConfigVarsWithKeyIndexLocal( - t *testing.T, + l zerolog.Logger, chainlinkNodes []*client.ChainlinkClient, registryConfig contracts.KeeperRegistrySettings, registrar string, deltaStage time.Duration, keyIndex int, ) (contracts.OCRv2Config, error) { - l := utils.GetTestLogger(t) S, oracleIdentities, err := GetOracleIdentitiesWithKeyIndexLocal(chainlinkNodes, keyIndex) if err != nil { return contracts.OCRv2Config{}, err @@ -136,13 +132,17 @@ func BuildAutoOCR2ConfigVarsWithKeyIndexLocal( var signers []common.Address for _, signer := range signerOnchainPublicKeys { - require.Equal(t, 20, len(signer), "OnChainPublicKey '%v' has wrong length for address", signer) + if len(signer) != 20 { + return contracts.OCRv2Config{}, fmt.Errorf("OnChainPublicKey '%v' has wrong length for address", signer) + } signers = append(signers, common.BytesToAddress(signer)) } var transmitters []common.Address for _, transmitter := range transmitterAccounts { - require.True(t, common.IsHexAddress(string(transmitter)), "TransmitAccount '%s' is not a valid Ethereum address", string(transmitter)) + if !common.IsHexAddress(string(transmitter)) { + return contracts.OCRv2Config{}, fmt.Errorf("TransmitAccount '%s' is not a valid Ethereum address", string(transmitter)) + } transmitters = append(transmitters, common.HexToAddress(string(transmitter))) } @@ -164,6 +164,7 @@ func BuildAutoOCR2ConfigVarsWithKeyIndexLocal( // CreateOCRKeeperJobs bootstraps the first node and to the other nodes sends ocr jobs func CreateOCRKeeperJobsLocal( + l zerolog.Logger, chainlinkNodes []*client.ChainlinkClient, registryAddr string, chainID int64, @@ -173,7 +174,7 @@ func CreateOCRKeeperJobsLocal( bootstrapNode := chainlinkNodes[0] bootstrapP2PIds, err := bootstrapNode.MustReadP2PKeys() if err != nil { - log.Error().Err(err).Msg("Shouldn't fail reading P2P keys from bootstrap node") + l.Error().Err(err).Msg("Shouldn't fail reading P2P keys from bootstrap node") return err } bootstrapP2PId := bootstrapP2PIds.Data[0].Attributes.PeerID @@ -201,7 +202,7 @@ func CreateOCRKeeperJobsLocal( } _, err = bootstrapNode.MustCreateJob(bootstrapSpec) if err != nil { - log.Error().Err(err).Msg("Shouldn't fail creating bootstrap job on bootstrap node") + l.Error().Err(err).Msg("Shouldn't fail creating bootstrap job on bootstrap node") return err } @@ -209,12 +210,12 @@ func CreateOCRKeeperJobsLocal( for nodeIndex := 1; nodeIndex < len(chainlinkNodes); nodeIndex++ { nodeTransmitterAddress, err := chainlinkNodes[nodeIndex].EthAddresses() if err != nil { - log.Error().Err(err).Msgf("Shouldn't fail getting primary ETH address from OCR node %d", nodeIndex+1) + l.Error().Err(err).Msgf("Shouldn't fail getting primary ETH address from OCR node %d", nodeIndex+1) return err } nodeOCRKeys, err := chainlinkNodes[nodeIndex].MustReadOCR2Keys() if err != nil { - log.Error().Err(err).Msgf("Shouldn't fail getting OCR keys from OCR node %d", nodeIndex+1) + l.Error().Err(err).Msgf("Shouldn't fail getting OCR keys from OCR node %d", nodeIndex+1) return err } var nodeOCRKeyId []string @@ -248,11 +249,11 @@ func CreateOCRKeeperJobsLocal( _, err = chainlinkNodes[nodeIndex].MustCreateJob(&autoOCR2JobSpec) if err != nil { - log.Error().Err(err).Msgf("Shouldn't fail creating OCR Task job on OCR node %d err: %+v", nodeIndex+1, err) + l.Error().Err(err).Msgf("Shouldn't fail creating OCR Task job on OCR node %d err: %+v", nodeIndex+1, err) return err } } - log.Info().Msg("Done creating OCR automation jobs") + l.Info().Msg("Done creating OCR automation jobs") return nil } diff --git a/integration-tests/actions/keeper_helpers_local.go b/integration-tests/actions/keeper_helpers_local.go index 6fc7ef43dbe..88d68e73282 100644 --- a/integration-tests/actions/keeper_helpers_local.go +++ b/integration-tests/actions/keeper_helpers_local.go @@ -3,12 +3,13 @@ package actions import ( "fmt" - "github.com/rs/zerolog/log" + "github.com/rs/zerolog" "github.com/smartcontractkit/chainlink/integration-tests/client" "github.com/smartcontractkit/chainlink/integration-tests/contracts" ) func CreateKeeperJobsLocal( + l zerolog.Logger, chainlinkNodes []*client.ChainlinkClient, keeperRegistry contracts.KeeperRegistry, ocrConfig contracts.OCRv2Config, @@ -17,12 +18,12 @@ func CreateKeeperJobsLocal( primaryNode := chainlinkNodes[0] primaryNodeAddress, err := primaryNode.PrimaryEthAddress() if err != nil { - log.Error().Err(err).Msg("Reading ETH Keys from Chainlink Client shouldn't fail") + l.Error().Err(err).Msg("Reading ETH Keys from Chainlink Client shouldn't fail") return nil, err } nodeAddresses, err := ChainlinkNodeAddressesLocal(chainlinkNodes) if err != nil { - log.Error().Err(err).Msg("Retrieving on-chain wallet addresses for chainlink nodes shouldn't fail") + l.Error().Err(err).Msg("Retrieving on-chain wallet addresses for chainlink nodes shouldn't fail") return nil, err } nodeAddressesStr, payees := make([]string, 0), make([]string, 0) @@ -32,14 +33,14 @@ func CreateKeeperJobsLocal( } err = keeperRegistry.SetKeepers(nodeAddressesStr, payees, ocrConfig) if err != nil { - log.Error().Err(err).Msg("Setting keepers in the registry shouldn't fail") + l.Error().Err(err).Msg("Setting keepers in the registry shouldn't fail") return nil, err } jobs := []*client.Job{} for _, chainlinkNode := range chainlinkNodes { chainlinkNodeAddress, err := chainlinkNode.PrimaryEthAddress() if err != nil { - log.Error().Err(err).Msg("Error retrieving chainlink node address") + l.Error().Err(err).Msg("Error retrieving chainlink node address") return nil, err } job, err := chainlinkNode.MustCreateJob(&client.KeeperJobSpec{ @@ -49,7 +50,7 @@ func CreateKeeperJobsLocal( MinIncomingConfirmations: 1, }) if err != nil { - log.Error().Err(err).Msg("Creating KeeperV2 Job shouldn't fail") + l.Error().Err(err).Msg("Creating KeeperV2 Job shouldn't fail") return nil, err } jobs = append(jobs, job) diff --git a/integration-tests/docker/test_env/cl_node.go b/integration-tests/docker/test_env/cl_node.go index 4c2213b03ee..f729cccbc0e 100644 --- a/integration-tests/docker/test_env/cl_node.go +++ b/integration-tests/docker/test_env/cl_node.go @@ -17,7 +17,7 @@ import ( "github.com/google/uuid" "github.com/pelletier/go-toml/v2" "github.com/pkg/errors" - "github.com/rs/zerolog/log" + "github.com/rs/zerolog" tc "github.com/testcontainers/testcontainers-go" tcwait "github.com/testcontainers/testcontainers-go/wait" @@ -48,6 +48,7 @@ type ClNode struct { lw *logwatch.LogWatch ContainerImage string ContainerVersion string + l zerolog.Logger } type ClNodeOption = func(c *ClNode) @@ -76,7 +77,7 @@ func WithLogWatch(lw *logwatch.LogWatch) ClNodeOption { } } -func NewClNode(networks []string, nodeConfig *chainlink.Config, opts ...ClNodeOption) *ClNode { +func NewClNode(networks []string, nodeConfig *chainlink.Config, logger zerolog.Logger, opts ...ClNodeOption) *ClNode { nodeDefaultCName := fmt.Sprintf("%s-%s", "cl-node", uuid.NewString()[0:8]) pgDefaultCName := fmt.Sprintf("pg-%s", nodeDefaultCName) pgDb := test_env.NewPostgresDb(networks, test_env.WithPostgresDbContainerName(pgDefaultCName)) @@ -87,6 +88,7 @@ func NewClNode(networks []string, nodeConfig *chainlink.Config, opts ...ClNodeOp }, NodeConfig: nodeConfig, PostgresDb: pgDb, + l: logger, } for _, opt := range opts { opt(n) @@ -258,7 +260,7 @@ func (n *ClNode) StartContainer() error { if err != nil { return err } - log.Info().Str("containerName", n.ContainerName). + n.l.Info().Str("containerName", n.ContainerName). Str("clEndpoint", clEndpoint). Str("clInternalIP", ip). Msg("Started Chainlink Node container") diff --git a/integration-tests/docker/test_env/test_env.go b/integration-tests/docker/test_env/test_env.go index e90bf5618ab..513372795d6 100644 --- a/integration-tests/docker/test_env/test_env.go +++ b/integration-tests/docker/test_env/test_env.go @@ -7,7 +7,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/keystore" "github.com/ethereum/go-ethereum/common" "github.com/pkg/errors" - "github.com/rs/zerolog/log" + "github.com/rs/zerolog" tc "github.com/testcontainers/testcontainers-go" "golang.org/x/sync/errgroup" @@ -40,9 +40,10 @@ type CLClusterTestEnv struct { EVMClient blockchain.EVMClient ContractDeployer contracts.ContractDeployer ContractLoader contracts.ContractLoader + l zerolog.Logger } -func NewTestEnv() (*CLClusterTestEnv, error) { +func NewTestEnv(l zerolog.Logger) (*CLClusterTestEnv, error) { utils.SetupCoreDockerEnvLogger() network, err := docker.CreateNetwork() if err != nil { @@ -53,22 +54,24 @@ func NewTestEnv() (*CLClusterTestEnv, error) { Network: network, Geth: test_env.NewGeth(networks), MockServer: test_env.NewMockServer(networks), + l: l, }, nil } -func NewTestEnvFromCfg(cfg *TestEnvConfig) (*CLClusterTestEnv, error) { +func NewTestEnvFromCfg(l zerolog.Logger, cfg *TestEnvConfig) (*CLClusterTestEnv, error) { utils.SetupCoreDockerEnvLogger() network, err := docker.CreateNetwork() if err != nil { return nil, err } networks := []string{network.Name} - log.Info().Interface("Cfg", cfg).Send() + l.Info().Interface("Cfg", cfg).Send() return &CLClusterTestEnv{ Cfg: cfg, Network: network, Geth: test_env.NewGeth(networks, test_env.WithContainerName(cfg.Geth.ContainerName)), MockServer: test_env.NewMockServer(networks, test_env.WithContainerName(cfg.MockServer.ContainerName)), + l: l, }, nil } @@ -130,7 +133,7 @@ func (te *CLClusterTestEnv) StartClNodes(nodeConfig *chainlink.Config, count int nodeContainerName = te.Cfg.Nodes[nodeIndex].NodeContainerName dbContainerName = te.Cfg.Nodes[nodeIndex].DbContainerName } - n := NewClNode([]string{te.Network.Name}, nodeConfig, + n := NewClNode([]string{te.Network.Name}, nodeConfig, te.l, WithNodeContainerName(nodeContainerName), WithDbContainerName(dbContainerName), ) @@ -199,7 +202,7 @@ func (te *CLClusterTestEnv) Terminate() error { // Cleanup cleans the environment up after it's done being used, mainly for returning funds when on live networks. // Intended to be used as part of t.Cleanup() in tests. func (te *CLClusterTestEnv) Cleanup() error { - log.Info().Msg("Attempting to return Chainlink node funds to default network wallets") + te.l.Info().Msg("Attempting to return Chainlink node funds to default network wallets") if te.EVMClient == nil { return errors.New("blockchain client is nil, unable to return funds from chainlink nodes") } @@ -207,7 +210,7 @@ func (te *CLClusterTestEnv) Cleanup() error { return errors.New("chainlink nodes are nil, unable to return funds from chainlink nodes") } if te.EVMClient.NetworkSimulated() { - log.Info().Str("Network Name", te.EVMClient.GetNetworkName()). + te.l.Info().Str("Network Name", te.EVMClient.GetNetworkName()). Msg("Network is a simulated network. Skipping fund return.") return nil } diff --git a/integration-tests/docker/test_env/test_env_builder.go b/integration-tests/docker/test_env/test_env_builder.go index 156ee0a9b8d..e263e41ec89 100644 --- a/integration-tests/docker/test_env/test_env_builder.go +++ b/integration-tests/docker/test_env/test_env_builder.go @@ -5,6 +5,7 @@ import ( "os" "github.com/pkg/errors" + "github.com/rs/zerolog" "github.com/rs/zerolog/log" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" @@ -29,6 +30,7 @@ type CLTestEnvBuilder struct { externalAdapterCount int customNodeCsaKeys []string defaultNodeCsaKeys []string + l zerolog.Logger /* funding */ ETHFunds *big.Float @@ -37,9 +39,15 @@ type CLTestEnvBuilder struct { func NewCLTestEnvBuilder() *CLTestEnvBuilder { return &CLTestEnvBuilder{ externalAdapterCount: 1, + l: log.Logger, } } +func (b *CLTestEnvBuilder) WithLogger(l zerolog.Logger) *CLTestEnvBuilder { + b.l = l + return b +} + func (b *CLTestEnvBuilder) WithLogWatcher() *CLTestEnvBuilder { b.hasLogWatch = true return b @@ -95,7 +103,7 @@ func (b *CLTestEnvBuilder) Build() (*CLClusterTestEnv, error) { } func (b *CLTestEnvBuilder) buildNewEnv(cfg *TestEnvConfig) (*CLClusterTestEnv, error) { - log.Info(). + b.l.Info(). Bool("hasGeth", b.hasGeth). Bool("hasMockServer", b.hasMockServer). Int("externalAdapterCount", b.externalAdapterCount). @@ -107,12 +115,12 @@ func (b *CLTestEnvBuilder) buildNewEnv(cfg *TestEnvConfig) (*CLClusterTestEnv, e var te *CLClusterTestEnv var err error if cfg != nil { - te, err = NewTestEnvFromCfg(cfg) + te, err = NewTestEnvFromCfg(b.l, cfg) if err != nil { return nil, err } } else { - te, err = NewTestEnv() + te, err = NewTestEnv(b.l) if err != nil { return nil, err } diff --git a/integration-tests/smoke/automation_test.go b/integration-tests/smoke/automation_test.go index 63d52d326ba..6b74ed23a40 100644 --- a/integration-tests/smoke/automation_test.go +++ b/integration-tests/smoke/automation_test.go @@ -882,7 +882,7 @@ func TestAutomationCheckPerformGasLimit(t *testing.T) { highCheckGasLimit := automationDefaultRegistryConfig highCheckGasLimit.CheckGasLimit = uint32(5000000) highCheckGasLimit.RegistryVersion = registryVersion - ocrConfig, err := actions.BuildAutoOCR2ConfigVarsLocal(t, nodesWithoutBootstrap, highCheckGasLimit, registrar.Address(), 30*time.Second) + ocrConfig, err := actions.BuildAutoOCR2ConfigVarsLocal(l, nodesWithoutBootstrap, highCheckGasLimit, registrar.Address(), 30*time.Second) require.NoError(t, err, "Error building OCR config") err = registry.SetConfig(highCheckGasLimit, ocrConfig) @@ -990,6 +990,7 @@ func setupAutomationTestDocker( contracts.KeeperRegistrar, *test_env.CLClusterTestEnv, ) { + l := utils.GetTestLogger(t) // Add registry version to config registryConfig.RegistryVersion = registryVersion network := networks.SelectedNetwork @@ -1008,6 +1009,7 @@ func setupAutomationTestDocker( // launch the environment env, err := test_env.NewCLTestEnvBuilder(). + WithLogger(l). WithGeth(). WithMockServer(1). WithCLNodes(5). @@ -1040,9 +1042,9 @@ func setupAutomationTestDocker( err = linkToken.Transfer(registry.Address(), big.NewInt(0).Mul(big.NewInt(1e18), big.NewInt(int64(defaultAmountOfUpkeeps)))) require.NoError(t, err, "Funding keeper registry contract shouldn't fail") - err = actions.CreateOCRKeeperJobsLocal(nodeClients, registry.Address(), network.ChainID, 0, registryVersion) + err = actions.CreateOCRKeeperJobsLocal(l, nodeClients, registry.Address(), network.ChainID, 0, registryVersion) require.NoError(t, err, "Error creating OCR Keeper Jobs") - ocrConfig, err := actions.BuildAutoOCR2ConfigVarsLocal(t, workerNodes, registryConfig, registrar.Address(), 30*time.Second) + ocrConfig, err := actions.BuildAutoOCR2ConfigVarsLocal(l, workerNodes, registryConfig, registrar.Address(), 30*time.Second) require.NoError(t, err, "Error building OCR config vars") err = registry.SetConfig(automationDefaultRegistryConfig, ocrConfig) require.NoError(t, err, "Registry config should be set successfully") diff --git a/integration-tests/smoke/cron_test.go b/integration-tests/smoke/cron_test.go index 0285e2d23c7..36895239af9 100644 --- a/integration-tests/smoke/cron_test.go +++ b/integration-tests/smoke/cron_test.go @@ -19,6 +19,7 @@ func TestCronBasic(t *testing.T) { l := utils.GetTestLogger(t) env, err := test_env.NewCLTestEnvBuilder(). + WithLogger(l). WithGeth(). WithMockServer(1). WithCLNodes(1). diff --git a/integration-tests/smoke/flux_test.go b/integration-tests/smoke/flux_test.go index c4cd02b857d..8106f5d89a7 100644 --- a/integration-tests/smoke/flux_test.go +++ b/integration-tests/smoke/flux_test.go @@ -25,6 +25,7 @@ func TestFluxBasic(t *testing.T) { l := utils.GetTestLogger(t) env, err := test_env.NewCLTestEnvBuilder(). + WithLogger(l). WithGeth(). WithMockServer(1). WithCLNodes(3). diff --git a/integration-tests/smoke/forwarder_ocr_test.go b/integration-tests/smoke/forwarder_ocr_test.go index e4cf5cb0527..1d4efdbfb4e 100644 --- a/integration-tests/smoke/forwarder_ocr_test.go +++ b/integration-tests/smoke/forwarder_ocr_test.go @@ -19,6 +19,7 @@ func TestForwarderOCRBasic(t *testing.T) { l := utils.GetTestLogger(t) env, err := test_env.NewCLTestEnvBuilder(). + WithLogger(l). WithGeth(). WithMockServer(1). WithForwarders(). diff --git a/integration-tests/smoke/forwarders_ocr2_test.go b/integration-tests/smoke/forwarders_ocr2_test.go index bf422b30faa..3361e717899 100644 --- a/integration-tests/smoke/forwarders_ocr2_test.go +++ b/integration-tests/smoke/forwarders_ocr2_test.go @@ -22,6 +22,7 @@ func TestForwarderOCR2Basic(t *testing.T) { l := utils.GetTestLogger(t) env, err := test_env.NewCLTestEnvBuilder(). + WithLogger(l). WithGeth(). WithMockServer(1). WithCLNodeConfig(node.NewConfig(node.NewBaseConfig(), diff --git a/integration-tests/smoke/keeper_test.go b/integration-tests/smoke/keeper_test.go index 35bb632c113..d4a2bd5a4b7 100644 --- a/integration-tests/smoke/keeper_test.go +++ b/integration-tests/smoke/keeper_test.go @@ -100,7 +100,7 @@ func TestKeeperBasicSmoke(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}) + _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -176,7 +176,7 @@ func TestKeeperBlockCountPerTurn(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}) + _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -265,6 +265,7 @@ func TestKeeperSimulation(t *testing.T) { registryVersion := rv t.Run(fmt.Sprintf("registry_1_%d", registryVersion), func(t *testing.T) { t.Parallel() + l := utils.GetTestLogger(t) chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t) registry, _, consumersPerformance, upkeepIDs := actions.DeployPerformanceKeeperContracts( t, @@ -283,7 +284,7 @@ func TestKeeperSimulation(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}) + _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -356,7 +357,7 @@ func TestKeeperCheckPerformGasLimit(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}) + _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -465,7 +466,7 @@ func TestKeeperRegisterUpkeep(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}) + _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -539,6 +540,7 @@ func TestKeeperAddFunds(t *testing.T) { registryVersion := rv t.Run(fmt.Sprintf("registry_1_%d", registryVersion), func(t *testing.T) { t.Parallel() + l := utils.GetTestLogger(t) chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t) registry, _, consumers, upkeepIDs := actions.DeployKeeperContracts( t, @@ -553,7 +555,7 @@ func TestKeeperAddFunds(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}) + _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -616,7 +618,7 @@ func TestKeeperRemove(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}) + _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -679,6 +681,7 @@ func TestKeeperPauseRegistry(t *testing.T) { registryVersion := rv t.Run(fmt.Sprintf("registry_1_%d", registryVersion), func(t *testing.T) { t.Parallel() + l := utils.GetTestLogger(t) chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t) registry, _, consumers, upkeepIDs := actions.DeployKeeperContracts( t, @@ -693,7 +696,7 @@ func TestKeeperPauseRegistry(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}) + _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -739,6 +742,7 @@ func TestKeeperPauseRegistry(t *testing.T) { func TestKeeperMigrateRegistry(t *testing.T) { t.Parallel() + l := utils.GetTestLogger(t) chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t) registry, _, consumers, upkeepIDs := actions.DeployKeeperContracts( t, @@ -753,7 +757,7 @@ func TestKeeperMigrateRegistry(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}) + _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -772,7 +776,7 @@ func TestKeeperMigrateRegistry(t *testing.T) { ) // Set the jobs for the second registry - _, err = actions.CreateKeeperJobsLocal(chainlinkNodes, secondRegistry, contracts.OCRv2Config{}) + _, err = actions.CreateKeeperJobsLocal(l, chainlinkNodes, secondRegistry, contracts.OCRv2Config{}) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -845,7 +849,7 @@ func TestKeeperNodeDown(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - jobs, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}) + jobs, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -951,7 +955,7 @@ func TestKeeperPauseUnPauseUpkeep(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}) + _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -1042,7 +1046,7 @@ func TestKeeperUpdateCheckData(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}) + _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -1103,6 +1107,7 @@ func setupKeeperTest(t *testing.T) ( l := utils.GetTestLogger(t) env, err := test_env.NewCLTestEnvBuilder(). + WithLogger(l). WithGeth(). WithMockServer(1). WithCLNodes(5). diff --git a/integration-tests/smoke/ocr2_test.go b/integration-tests/smoke/ocr2_test.go index 36d53b40676..b173b8f594a 100644 --- a/integration-tests/smoke/ocr2_test.go +++ b/integration-tests/smoke/ocr2_test.go @@ -32,6 +32,7 @@ func TestOCRv2Basic(t *testing.T) { l := utils.GetTestLogger(t) env, err := test_env.NewCLTestEnvBuilder(). + WithLogger(l). WithGeth(). WithMockServer(1). WithCLNodeConfig(node.NewConfig(node.NewBaseConfig(), diff --git a/integration-tests/smoke/ocr_test.go b/integration-tests/smoke/ocr_test.go index 50d6abe662b..070072e4d19 100644 --- a/integration-tests/smoke/ocr_test.go +++ b/integration-tests/smoke/ocr_test.go @@ -18,6 +18,7 @@ func TestOCRBasic(t *testing.T) { l := utils.GetTestLogger(t) env, err := test_env.NewCLTestEnvBuilder(). + WithLogger(l). WithGeth(). WithMockServer(1). WithCLNodes(6). diff --git a/integration-tests/smoke/runlog_test.go b/integration-tests/smoke/runlog_test.go index cd2a099b142..f79f9f266bb 100644 --- a/integration-tests/smoke/runlog_test.go +++ b/integration-tests/smoke/runlog_test.go @@ -22,6 +22,7 @@ func TestRunLogBasic(t *testing.T) { l := utils.GetTestLogger(t) env, err := test_env.NewCLTestEnvBuilder(). + WithLogger(l). WithGeth(). WithMockServer(1). WithCLNodes(1). diff --git a/integration-tests/smoke/vrf_test.go b/integration-tests/smoke/vrf_test.go index 0e12b185a6a..d4d980ec223 100644 --- a/integration-tests/smoke/vrf_test.go +++ b/integration-tests/smoke/vrf_test.go @@ -24,6 +24,7 @@ func TestVRFBasic(t *testing.T) { l := utils.GetTestLogger(t) env, err := test_env.NewCLTestEnvBuilder(). + WithLogger(l). WithGeth(). WithMockServer(1). WithCLNodes(1). From 4c809308f2bac5a8c4ec9343c0074af1cce3eeb0 Mon Sep 17 00:00:00 2001 From: Tate Date: Tue, 12 Sep 2023 14:56:20 -0600 Subject: [PATCH 2/8] triage why logs are not getting the correct test struct --- integration-tests/actions/actions.go | 5 +-- .../actions/automation_ocr_helpers.go | 6 ++-- integration-tests/actions/keeper_helpers.go | 14 ++++---- .../ocr2vrf_actions/ocr2vrf_config_helpers.go | 8 ++--- .../actions/ocr2vrf_actions/ocr2vrf_steps.go | 10 +++--- .../actions/operator_forwarder_helpers.go | 8 ++--- integration-tests/benchmark/keeper_test.go | 7 ++-- .../chaos/automation_chaos_test.go | 6 ++-- integration-tests/chaos/ocr2vrf_chaos_test.go | 6 ++-- integration-tests/chaos/ocr_chaos_test.go | 6 ++-- integration-tests/docker/test_env/cl_node.go | 22 +++++++++++-- integration-tests/docker/test_env/test_env.go | 33 +++++++++++++++---- .../docker/test_env/test_env_builder.go | 17 +++++++--- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 +-- .../performance/directrequest_test.go | 5 ++- integration-tests/performance/flux_test.go | 5 ++- integration-tests/performance/keeper_test.go | 5 ++- integration-tests/performance/vrf_test.go | 5 ++- .../reorg/automation_reorg_test.go | 6 ++-- integration-tests/smoke/automation_test.go | 24 +++++++------- integration-tests/smoke/cron_test.go | 6 ++-- integration-tests/smoke/flux_test.go | 6 ++-- integration-tests/smoke/forwarder_ocr_test.go | 6 ++-- .../smoke/forwarders_ocr2_test.go | 6 ++-- integration-tests/smoke/keeper_test.go | 30 ++++++++--------- integration-tests/smoke/ocr2_test.go | 7 ++-- integration-tests/smoke/ocr2vrf_test.go | 8 ++--- integration-tests/smoke/ocr_test.go | 6 ++-- integration-tests/smoke/runlog_test.go | 6 ++-- integration-tests/smoke/vrf_test.go | 6 ++-- integration-tests/smoke/vrfv2_test.go | 4 +-- integration-tests/smoke/vrfv2plus_test.go | 4 +-- integration-tests/soak/forwarder_ocr_test.go | 4 +-- integration-tests/soak/ocr_test.go | 4 +-- .../testsetups/keeper_benchmark.go | 12 +++---- integration-tests/testsetups/ocr.go | 4 +-- integration-tests/testsetups/vrfv2.go | 4 +-- 38 files changed, 181 insertions(+), 146 deletions(-) diff --git a/integration-tests/actions/actions.go b/integration-tests/actions/actions.go index 82187fd0cb8..e37c3738ff8 100644 --- a/integration-tests/actions/actions.go +++ b/integration-tests/actions/actions.go @@ -19,6 +19,7 @@ import ( "github.com/smartcontractkit/chainlink-env/environment" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" ctfClient "github.com/smartcontractkit/chainlink-testing-framework/client" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/testreporters" "github.com/smartcontractkit/chainlink-testing-framework/utils" @@ -251,7 +252,7 @@ func TeardownSuite( failingLogLevel zapcore.Level, // Examines logs after the test, and fails the test if any Chainlink logs are found at or above provided level clients ...blockchain.EVMClient, ) error { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) if err := testreporters.WriteTeardownLogs(t, env, optionalTestReporter, failingLogLevel); err != nil { return errors.Wrap(err, "Error dumping environment logs, leaving environment running for manual retrieval") } @@ -295,7 +296,7 @@ func TeardownRemoteSuite( optionalTestReporter testreporters.TestReporter, // Optionally pass in a test reporter to log further metrics client blockchain.EVMClient, ) error { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) var err error if err = testreporters.SendReport(t, namespace, "./", optionalTestReporter); err != nil { l.Warn().Err(err).Msg("Error writing test report") diff --git a/integration-tests/actions/automation_ocr_helpers.go b/integration-tests/actions/automation_ocr_helpers.go index bfea6ec302c..fb94d6109b4 100644 --- a/integration-tests/actions/automation_ocr_helpers.go +++ b/integration-tests/actions/automation_ocr_helpers.go @@ -13,7 +13,7 @@ import ( "github.com/lib/pq" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/chaintype" "github.com/smartcontractkit/chainlink/v2/core/store/models" @@ -48,7 +48,7 @@ func BuildAutoOCR2ConfigVarsWithKeyIndex( deltaStage time.Duration, keyIndex int, ) (contracts.OCRv2Config, error) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) S, oracleIdentities, err := GetOracleIdentitiesWithKeyIndex(chainlinkNodes, keyIndex) if err != nil { return contracts.OCRv2Config{}, err @@ -172,7 +172,7 @@ func CreateOCRKeeperJobs( keyIndex int, registryVersion ethereum.KeeperRegistryVersion, ) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) bootstrapNode := chainlinkNodes[0] bootstrapP2PIds, err := bootstrapNode.MustReadP2PKeys() require.NoError(t, err, "Shouldn't fail reading P2P keys from bootstrap node") diff --git a/integration-tests/actions/keeper_helpers.go b/integration-tests/actions/keeper_helpers.go index 98c9a51e1c8..22a65ed96bd 100644 --- a/integration-tests/actions/keeper_helpers.go +++ b/integration-tests/actions/keeper_helpers.go @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/require" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/integration-tests/client" "github.com/smartcontractkit/chainlink/integration-tests/contracts" @@ -335,7 +335,7 @@ func RegisterUpkeepContracts(t *testing.T, linkToken contracts.LinkToken, linkFu } func RegisterUpkeepContractsWithCheckData(t *testing.T, linkToken contracts.LinkToken, linkFunds *big.Int, client blockchain.EVMClient, upkeepGasLimit uint32, registry contracts.KeeperRegistry, registrar contracts.KeeperRegistrar, numberOfContracts int, upkeepAddresses []string, checkData [][]byte, isLogTrigger bool) []*big.Int { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) registrationTxHashes := make([]common.Hash, 0) upkeepIds := make([]*big.Int, 0) for contractCount, upkeepAddress := range upkeepAddresses { @@ -394,7 +394,7 @@ func RegisterUpkeepContractsWithCheckData(t *testing.T, linkToken contracts.Link } func DeployKeeperConsumers(t *testing.T, contractDeployer contracts.ContractDeployer, client blockchain.EVMClient, numberOfContracts int, isLogTrigger bool) []contracts.KeeperConsumer { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) keeperConsumerContracts := make([]contracts.KeeperConsumer, 0) for contractCount := 0; contractCount < numberOfContracts; contractCount++ { @@ -437,7 +437,7 @@ func DeployKeeperConsumersPerformance( checkGasToBurn, // How much gas should be burned on checkUpkeep() calls performGasToBurn int64, // How much gas should be burned on performUpkeep() calls ) []contracts.KeeperConsumerPerformance { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) upkeeps := make([]contracts.KeeperConsumerPerformance, 0) for contractCount := 0; contractCount < numberOfContracts; contractCount++ { @@ -474,7 +474,7 @@ func DeployPerformDataChecker( numberOfContracts int, expectedData []byte, ) []contracts.KeeperPerformDataChecker { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) upkeeps := make([]contracts.KeeperPerformDataChecker, 0) for contractCount := 0; contractCount < numberOfContracts; contractCount++ { @@ -506,7 +506,7 @@ func DeployUpkeepCounters( testRange *big.Int, interval *big.Int, ) []contracts.UpkeepCounter { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) upkeepCounters := make([]contracts.UpkeepCounter, 0) for contractCount := 0; contractCount < numberOfContracts; contractCount++ { @@ -539,7 +539,7 @@ func DeployUpkeepPerformCounterRestrictive( testRange *big.Int, averageEligibilityCadence *big.Int, ) []contracts.UpkeepPerformCounterRestrictive { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) upkeepCounters := make([]contracts.UpkeepPerformCounterRestrictive, 0) for contractCount := 0; contractCount < numberOfContracts; contractCount++ { diff --git a/integration-tests/actions/ocr2vrf_actions/ocr2vrf_config_helpers.go b/integration-tests/actions/ocr2vrf_actions/ocr2vrf_config_helpers.go index 05b983c2f1e..ce693964323 100644 --- a/integration-tests/actions/ocr2vrf_actions/ocr2vrf_config_helpers.go +++ b/integration-tests/actions/ocr2vrf_actions/ocr2vrf_config_helpers.go @@ -16,7 +16,7 @@ import ( "go.dedis.ch/kyber/v3/group/edwards25519" "gopkg.in/guregu/null.v4" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/chaintype" "github.com/smartcontractkit/libocr/offchainreporting2plus/confighelper" @@ -39,7 +39,7 @@ func CreateOCR2VRFJobs( chainID int64, keyIndex int, ) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) p2pV2Bootstrapper := createBootstrapJob(t, bootstrapNode, OCR2VRFPluginConfig.DKGConfig.DKGContractAddress, chainID) createNonBootstrapJobs(t, nonBootstrapNodes, OCR2VRFPluginConfig, chainID, keyIndex, p2pV2Bootstrapper) @@ -120,7 +120,7 @@ func BuildOCR2DKGConfigVars( t *testing.T, ocr2VRFPluginConfig *OCR2VRFPluginConfig, ) contracts.OCRv2Config { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) var onchainPublicKeys []common.Address for _, onchainPublicKey := range ocr2VRFPluginConfig.OCR2Config.OnchainPublicKeys { onchainPublicKeys = append(onchainPublicKeys, common.HexToAddress(onchainPublicKey)) @@ -272,7 +272,7 @@ func BuildOCR2VRFConfigVars( t *testing.T, ocr2VRFPluginConfig *OCR2VRFPluginConfig, ) contracts.OCRv2Config { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) var onchainPublicKeys []common.Address for _, onchainPublicKey := range ocr2VRFPluginConfig.OCR2Config.OnchainPublicKeys { onchainPublicKeys = append(onchainPublicKeys, common.HexToAddress(onchainPublicKey)) diff --git a/integration-tests/actions/ocr2vrf_actions/ocr2vrf_steps.go b/integration-tests/actions/ocr2vrf_actions/ocr2vrf_steps.go index c550fe73a22..c123aaff6a2 100644 --- a/integration-tests/actions/ocr2vrf_actions/ocr2vrf_steps.go +++ b/integration-tests/actions/ocr2vrf_actions/ocr2vrf_steps.go @@ -13,7 +13,7 @@ import ( ocr2vrftypes "github.com/smartcontractkit/ocr2vrf/types" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/chaintype" chainlinkutils "github.com/smartcontractkit/chainlink/v2/core/utils" @@ -25,7 +25,7 @@ import ( ) func SetAndWaitForVRFBeaconProcessToFinish(t *testing.T, ocr2VRFPluginConfig *OCR2VRFPluginConfig, vrfBeacon contracts.VRFBeacon) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) ocr2VrfConfig := BuildOCR2VRFConfigVars(t, ocr2VRFPluginConfig) l.Debug().Interface("OCR2 VRF Config", ocr2VrfConfig).Msg("OCR2 VRF Config prepared") @@ -45,7 +45,7 @@ func SetAndWaitForVRFBeaconProcessToFinish(t *testing.T, ocr2VRFPluginConfig *OC } func SetAndWaitForDKGProcessToFinish(t *testing.T, ocr2VRFPluginConfig *OCR2VRFPluginConfig, dkg contracts.DKG) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) ocr2DkgConfig := BuildOCR2DKGConfigVars(t, ocr2VRFPluginConfig) // set config for DKG OCR @@ -208,7 +208,7 @@ func RequestAndRedeemRandomness( confirmationDelay *big.Int, randomnessTransmissionEventTimeout time.Duration, ) *big.Int { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) receipt, err := consumer.RequestRandomness( numberOfRandomWordsToRequest, subscriptionID, @@ -244,7 +244,7 @@ func RequestRandomnessFulfillmentAndWaitForFulfilment( confirmationDelay *big.Int, randomnessTransmissionEventTimeout time.Duration, ) *big.Int { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) receipt, err := consumer.RequestRandomnessFulfillment( numberOfRandomWordsToRequest, subscriptionID, diff --git a/integration-tests/actions/operator_forwarder_helpers.go b/integration-tests/actions/operator_forwarder_helpers.go index 7add64fbe99..37b50c4fa9a 100644 --- a/integration-tests/actions/operator_forwarder_helpers.go +++ b/integration-tests/actions/operator_forwarder_helpers.go @@ -12,7 +12,7 @@ import ( "github.com/stretchr/testify/require" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/operator_factory" "github.com/smartcontractkit/chainlink/integration-tests/client" @@ -91,7 +91,7 @@ func ProcessNewEvent( contractABI *abi.ABI, chainClient blockchain.EVMClient, ) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) errorChan := make(chan error) eventConfirmed := make(chan bool) err := chainClient.ProcessEvent(eventDetails.Name, event, eventConfirmed, errorChan) @@ -138,7 +138,7 @@ func SubscribeOperatorFactoryEvents( chainClient blockchain.EVMClient, operatorFactoryInstance contracts.OperatorFactory, ) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) contractABI, err := operator_factory.OperatorFactoryMetaData.GetAbi() require.NoError(t, err, "Getting contract abi for OperatorFactory shouldn't fail") latestBlockNum, err := chainClient.LatestBlockNumber(context.Background()) @@ -186,7 +186,7 @@ func TrackForwarder( authorizedForwarder common.Address, node *client.ChainlinkK8sClient, ) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) chainID := chainClient.GetChainID() _, _, err := node.TrackForwarder(chainID, authorizedForwarder) require.NoError(t, err, "Forwarder track should be created") diff --git a/integration-tests/benchmark/keeper_test.go b/integration-tests/benchmark/keeper_test.go index fbabfab78cc..dca7b61bf83 100644 --- a/integration-tests/benchmark/keeper_test.go +++ b/integration-tests/benchmark/keeper_test.go @@ -18,8 +18,7 @@ import ( "github.com/smartcontractkit/chainlink-env/pkg/helm/ethereum" "github.com/smartcontractkit/chainlink-env/pkg/helm/reorg" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" - "github.com/smartcontractkit/chainlink-testing-framework/utils" - + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/networks" "github.com/smartcontractkit/chainlink/integration-tests/actions" @@ -142,7 +141,7 @@ type NetworkConfig struct { } func TestAutomationBenchmark(t *testing.T) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) testEnvironment, benchmarkNetwork := SetupAutomationBenchmarkEnv(t) if testEnvironment.WillUseRemoteRunner() { return @@ -299,7 +298,7 @@ func getEnv(key, fallback string) string { } func SetupAutomationBenchmarkEnv(t *testing.T) (*environment.Environment, blockchain.EVMNetwork) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) testNetwork := networks.SelectedNetwork // Environment currently being used to run benchmark test on blockTime := "1" networkDetailTOML := `MinIncomingConfirmations = 1` diff --git a/integration-tests/chaos/automation_chaos_test.go b/integration-tests/chaos/automation_chaos_test.go index bb7fe1b8f00..00ad8d3d41e 100644 --- a/integration-tests/chaos/automation_chaos_test.go +++ b/integration-tests/chaos/automation_chaos_test.go @@ -18,9 +18,9 @@ import ( "github.com/smartcontractkit/chainlink-env/pkg/helm/chainlink" "github.com/smartcontractkit/chainlink-env/pkg/helm/ethereum" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" - "github.com/smartcontractkit/chainlink-testing-framework/utils" - + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/networks" + "github.com/smartcontractkit/chainlink-testing-framework/utils" "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/client" @@ -109,7 +109,7 @@ const ( func TestAutomationChaos(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) testCases := map[string]struct { networkChart environment.ConnectedChart diff --git a/integration-tests/chaos/ocr2vrf_chaos_test.go b/integration-tests/chaos/ocr2vrf_chaos_test.go index 91c9084d408..876424626c0 100644 --- a/integration-tests/chaos/ocr2vrf_chaos_test.go +++ b/integration-tests/chaos/ocr2vrf_chaos_test.go @@ -16,9 +16,9 @@ import ( "github.com/smartcontractkit/chainlink-env/pkg/helm/chainlink" "github.com/smartcontractkit/chainlink-env/pkg/helm/ethereum" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" - "github.com/smartcontractkit/chainlink-testing-framework/utils" - + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/networks" + "github.com/smartcontractkit/chainlink-testing-framework/utils" "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/actions/ocr2vrf_actions" @@ -30,7 +30,7 @@ import ( func TestOCR2VRFChaos(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) loadedNetwork := networks.SelectedNetwork defaultOCR2VRFSettings := map[string]interface{}{ diff --git a/integration-tests/chaos/ocr_chaos_test.go b/integration-tests/chaos/ocr_chaos_test.go index 1e5b8451454..6a4ec63c309 100644 --- a/integration-tests/chaos/ocr_chaos_test.go +++ b/integration-tests/chaos/ocr_chaos_test.go @@ -20,9 +20,9 @@ import ( mockservercfg "github.com/smartcontractkit/chainlink-env/pkg/helm/mockserver-cfg" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" ctfClient "github.com/smartcontractkit/chainlink-testing-framework/client" - "github.com/smartcontractkit/chainlink-testing-framework/utils" - + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/networks" + "github.com/smartcontractkit/chainlink-testing-framework/utils" "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/client" @@ -59,7 +59,7 @@ func TestMain(m *testing.M) { func TestOCRChaos(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) testCases := map[string]struct { networkChart environment.ConnectedChart clChart environment.ConnectedChart diff --git a/integration-tests/docker/test_env/cl_node.go b/integration-tests/docker/test_env/cl_node.go index 354d38c81f6..5ad0c4ab800 100644 --- a/integration-tests/docker/test_env/cl_node.go +++ b/integration-tests/docker/test_env/cl_node.go @@ -10,6 +10,7 @@ import ( "os" "strings" "sync" + "testing" "time" "github.com/ethereum/go-ethereum" @@ -18,12 +19,14 @@ import ( "github.com/pelletier/go-toml/v2" "github.com/pkg/errors" "github.com/rs/zerolog" + "github.com/rs/zerolog/log" tc "github.com/testcontainers/testcontainers-go" tcwait "github.com/testcontainers/testcontainers-go/wait" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" "github.com/smartcontractkit/chainlink-testing-framework/docker" "github.com/smartcontractkit/chainlink-testing-framework/docker/test_env" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/logwatch" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/chaintype" @@ -49,6 +52,7 @@ type ClNode struct { lw *logwatch.LogWatch ContainerImage string ContainerVersion string + t *testing.T l zerolog.Logger } @@ -78,7 +82,7 @@ func WithLogWatch(lw *logwatch.LogWatch) ClNodeOption { } } -func NewClNode(networks []string, nodeConfig *chainlink.Config, logger zerolog.Logger, opts ...ClNodeOption) *ClNode { +func NewClNode(networks []string, nodeConfig *chainlink.Config, opts ...ClNodeOption) *ClNode { nodeDefaultCName := fmt.Sprintf("%s-%s", "cl-node", uuid.NewString()[0:8]) pgDefaultCName := fmt.Sprintf("pg-%s", nodeDefaultCName) pgDb := test_env.NewPostgresDb(networks, test_env.WithPostgresDbContainerName(pgDefaultCName)) @@ -89,7 +93,7 @@ func NewClNode(networks []string, nodeConfig *chainlink.Config, logger zerolog.L }, NodeConfig: nodeConfig, PostgresDb: pgDb, - l: logger, + l: log.Logger, } for _, opt := range opts { opt(n) @@ -97,6 +101,13 @@ func NewClNode(networks []string, nodeConfig *chainlink.Config, logger zerolog.L return n } +func (n *ClNode) WithTestLogger(t *testing.T) *ClNode { + n.l = logging.GetTestLogger(t) + n.t = t + n.PostgresDb.WithTestLogger(t) + return n +} + // Restart restarts only CL node, DB container is reused func (n *ClNode) Restart(cfg *chainlink.Config) error { if err := n.Container.Terminate(context.Background()); err != nil { @@ -240,10 +251,15 @@ func (n *ClNode) StartContainer() error { if err != nil { return err } - container, err := docker.StartContainerWithRetry(tc.GenericContainerRequest{ + l := tc.Logger + if n.t != nil { + l = tc.TestLogger(n.t) + } + container, err := docker.StartContainerWithRetry(n.l, tc.GenericContainerRequest{ ContainerRequest: *cReq, Started: true, Reuse: true, + Logger: l, }) if err != nil { return errors.Wrap(err, ErrStartCLNodeContainer) diff --git a/integration-tests/docker/test_env/test_env.go b/integration-tests/docker/test_env/test_env.go index db375089fc2..7e7ba0d3932 100644 --- a/integration-tests/docker/test_env/test_env.go +++ b/integration-tests/docker/test_env/test_env.go @@ -3,17 +3,20 @@ package test_env import ( "encoding/json" "math/big" + "testing" "github.com/ethereum/go-ethereum/accounts/keystore" "github.com/ethereum/go-ethereum/common" "github.com/pkg/errors" "github.com/rs/zerolog" + "github.com/rs/zerolog/log" tc "github.com/testcontainers/testcontainers-go" "golang.org/x/sync/errgroup" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" "github.com/smartcontractkit/chainlink-testing-framework/docker" "github.com/smartcontractkit/chainlink-testing-framework/docker/test_env" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/logwatch" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" @@ -41,11 +44,12 @@ type CLClusterTestEnv struct { ContractDeployer contracts.ContractDeployer ContractLoader contracts.ContractLoader l zerolog.Logger + t *testing.T } -func NewTestEnv(l zerolog.Logger) (*CLClusterTestEnv, error) { +func NewTestEnv() (*CLClusterTestEnv, error) { utils.SetupCoreDockerEnvLogger() - network, err := docker.CreateNetwork() + network, err := docker.CreateNetwork(log.Logger) if err != nil { return nil, err } @@ -54,13 +58,21 @@ func NewTestEnv(l zerolog.Logger) (*CLClusterTestEnv, error) { Network: network, Geth: test_env.NewGeth(networks), MockServer: test_env.NewMockServer(networks), - l: l, + l: log.Logger, }, nil } +func (te *CLClusterTestEnv) WithTestLogger(t *testing.T) *CLClusterTestEnv { + te.t = t + te.l = logging.GetTestLogger(t) + te.Geth.WithTestLogger(t) + te.MockServer.WithTestLogger(t) + return te +} + func NewTestEnvFromCfg(l zerolog.Logger, cfg *TestEnvConfig) (*CLClusterTestEnv, error) { utils.SetupCoreDockerEnvLogger() - network, err := docker.CreateNetwork() + network, err := docker.CreateNetwork(log.Logger) if err != nil { return nil, err } @@ -71,7 +83,7 @@ func NewTestEnvFromCfg(l zerolog.Logger, cfg *TestEnvConfig) (*CLClusterTestEnv, Network: network, Geth: test_env.NewGeth(networks, test_env.WithContainerName(cfg.Geth.ContainerName)), MockServer: test_env.NewMockServer(networks, test_env.WithContainerName(cfg.MockServer.ContainerName)), - l: l, + l: log.Logger, }, nil } @@ -83,7 +95,11 @@ func (te *CLClusterTestEnv) WithPrivateGethChain(evmNetworks []blockchain.EVMNet var chains []test_env.PrivateGethChain for _, evmNetwork := range evmNetworks { n := evmNetwork - chains = append(chains, test_env.NewPrivateGethChain(&n, []string{te.Network.Name})) + pgc := test_env.NewPrivateGethChain(&n, []string{te.Network.Name}) + if te.t != nil { + pgc.WithTestLogger(te.t) + } + chains = append(chains, pgc) } te.PrivateGethChain = chains return te @@ -133,10 +149,13 @@ func (te *CLClusterTestEnv) StartClNodes(nodeConfig *chainlink.Config, count int nodeContainerName = te.Cfg.Nodes[nodeIndex].NodeContainerName dbContainerName = te.Cfg.Nodes[nodeIndex].DbContainerName } - n := NewClNode([]string{te.Network.Name}, nodeConfig, te.l, + n := NewClNode([]string{te.Network.Name}, nodeConfig, WithNodeContainerName(nodeContainerName), WithDbContainerName(dbContainerName), ) + if te.t != nil { + n.WithTestLogger(te.t) + } err := n.StartContainer() if err != nil { return err diff --git a/integration-tests/docker/test_env/test_env_builder.go b/integration-tests/docker/test_env/test_env_builder.go index e263e41ec89..f8524663f7b 100644 --- a/integration-tests/docker/test_env/test_env_builder.go +++ b/integration-tests/docker/test_env/test_env_builder.go @@ -3,6 +3,7 @@ package test_env import ( "math/big" "os" + "testing" "github.com/pkg/errors" "github.com/rs/zerolog" @@ -10,10 +11,10 @@ import ( "github.com/smartcontractkit/chainlink-testing-framework/blockchain" "github.com/smartcontractkit/chainlink-testing-framework/docker/test_env" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/logwatch" - "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" - "github.com/smartcontractkit/chainlink-testing-framework/networks" + "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" "github.com/smartcontractkit/chainlink/integration-tests/contracts" "github.com/smartcontractkit/chainlink/integration-tests/types/config/node" @@ -31,6 +32,7 @@ type CLTestEnvBuilder struct { customNodeCsaKeys []string defaultNodeCsaKeys []string l zerolog.Logger + t *testing.T /* funding */ ETHFunds *big.Float @@ -43,8 +45,9 @@ func NewCLTestEnvBuilder() *CLTestEnvBuilder { } } -func (b *CLTestEnvBuilder) WithLogger(l zerolog.Logger) *CLTestEnvBuilder { - b.l = l +func (b *CLTestEnvBuilder) WithTestLogger(t *testing.T) *CLTestEnvBuilder { + b.t = t + b.l = logging.GetTestLogger(t) return b } @@ -120,12 +123,16 @@ func (b *CLTestEnvBuilder) buildNewEnv(cfg *TestEnvConfig) (*CLClusterTestEnv, e return nil, err } } else { - te, err = NewTestEnv(b.l) + te, err = NewTestEnv() if err != nil { return nil, err } } + if b.t != nil { + te.WithTestLogger(b.t) + } + if b.hasLogWatch { te.LogWatch, err = logwatch.NewLogWatch(nil, nil) if err != nil { diff --git a/integration-tests/go.mod b/integration-tests/go.mod index e49c989334a..4cc70633e4e 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -20,7 +20,7 @@ require ( github.com/rs/zerolog v1.30.0 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-env v0.36.0 - github.com/smartcontractkit/chainlink-testing-framework v1.16.8 + github.com/smartcontractkit/chainlink-testing-framework v1.16.9-0.20230913150728-98e8ec8d6561 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20230816220705-665e93233ae5 github.com/smartcontractkit/ocr2keepers v0.7.23 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 65874f345e0..46c80c77431 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -2258,8 +2258,8 @@ github.com/smartcontractkit/chainlink-solana v1.0.3-0.20230831134610-680240b97ac github.com/smartcontractkit/chainlink-solana v1.0.3-0.20230831134610-680240b97aca/go.mod h1:RIUJXn7EVp24TL2p4FW79dYjyno23x5mjt1nKN+5WEk= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20230901115736-bbabe542a918 h1:ByVauKFXphRlSNG47lNuxZ9aicu+r8AoNp933VRPpCw= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20230901115736-bbabe542a918/go.mod h1:/yp/sqD8Iz5GU5fcercjrw0ivJF7HDcupYg+Gjr7EPg= -github.com/smartcontractkit/chainlink-testing-framework v1.16.8 h1:YcjSYi6Pm2vOBToxNAmuCrUyb/yymLxjmIEffHUJuhA= -github.com/smartcontractkit/chainlink-testing-framework v1.16.8/go.mod h1:Ry6fRPr8TwrIsYVNEF1pguAgzE3QW1s54tbLWnFtfI4= +github.com/smartcontractkit/chainlink-testing-framework v1.16.9-0.20230913150728-98e8ec8d6561 h1:YYjZf4G1JXK+QntTFHdhMe0NyIdFfhGdzHc8EhDdjIo= +github.com/smartcontractkit/chainlink-testing-framework v1.16.9-0.20230913150728-98e8ec8d6561/go.mod h1:Ry6fRPr8TwrIsYVNEF1pguAgzE3QW1s54tbLWnFtfI4= github.com/smartcontractkit/go-plugin v0.0.0-20230605132010-0f4d515d1472 h1:x3kNwgFlDmbE/n0gTSRMt9GBDfsfGrs4X9b9arPZtFI= github.com/smartcontractkit/go-plugin v0.0.0-20230605132010-0f4d515d1472/go.mod h1:6/1TEzT0eQznvI/gV2CM29DLSkAK/e58mUWKVsPaph0= github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f h1:hgJif132UCdjo8u43i7iPN1/MFnu49hv7lFGFftCHKU= diff --git a/integration-tests/performance/directrequest_test.go b/integration-tests/performance/directrequest_test.go index dca84ab09c3..8e308176c94 100644 --- a/integration-tests/performance/directrequest_test.go +++ b/integration-tests/performance/directrequest_test.go @@ -18,8 +18,7 @@ import ( mockservercfg "github.com/smartcontractkit/chainlink-env/pkg/helm/mockserver-cfg" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" ctfClient "github.com/smartcontractkit/chainlink-testing-framework/client" - "github.com/smartcontractkit/chainlink-testing-framework/utils" - + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/networks" "github.com/smartcontractkit/chainlink/integration-tests/actions" @@ -31,7 +30,7 @@ import ( ) func TestDirectRequestPerformance(t *testing.T) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) testEnvironment := setupDirectRequestTest(t) if testEnvironment.WillUseRemoteRunner() { return diff --git a/integration-tests/performance/flux_test.go b/integration-tests/performance/flux_test.go index bc914c329b9..c9c32b047ba 100644 --- a/integration-tests/performance/flux_test.go +++ b/integration-tests/performance/flux_test.go @@ -19,8 +19,7 @@ import ( mockservercfg "github.com/smartcontractkit/chainlink-env/pkg/helm/mockserver-cfg" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" ctfClient "github.com/smartcontractkit/chainlink-testing-framework/client" - "github.com/smartcontractkit/chainlink-testing-framework/utils" - + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/networks" "github.com/smartcontractkit/chainlink/integration-tests/actions" @@ -30,7 +29,7 @@ import ( ) func TestFluxPerformance(t *testing.T) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) testEnvironment, testNetwork := setupFluxTest(t) if testEnvironment.WillUseRemoteRunner() { return diff --git a/integration-tests/performance/keeper_test.go b/integration-tests/performance/keeper_test.go index 384729dfab3..c9e105e9f4e 100644 --- a/integration-tests/performance/keeper_test.go +++ b/integration-tests/performance/keeper_test.go @@ -18,8 +18,7 @@ import ( "github.com/smartcontractkit/chainlink-env/pkg/helm/mockserver" mockservercfg "github.com/smartcontractkit/chainlink-env/pkg/helm/mockserver-cfg" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" - "github.com/smartcontractkit/chainlink-testing-framework/utils" - + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/networks" "github.com/smartcontractkit/chainlink/integration-tests/actions" @@ -45,7 +44,7 @@ var keeperDefaultRegistryConfig = contracts.KeeperRegistrySettings{ } func TestKeeperPerformance(t *testing.T) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) testEnvironment, chainClient, chainlinkNodes, contractDeployer, linkToken := setupKeeperTest(t, "basic-smoke") if testEnvironment.WillUseRemoteRunner() { return diff --git a/integration-tests/performance/vrf_test.go b/integration-tests/performance/vrf_test.go index 59eb5e3980b..a5e40265040 100644 --- a/integration-tests/performance/vrf_test.go +++ b/integration-tests/performance/vrf_test.go @@ -16,8 +16,7 @@ import ( "github.com/smartcontractkit/chainlink-env/pkg/helm/chainlink" "github.com/smartcontractkit/chainlink-env/pkg/helm/ethereum" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" - "github.com/smartcontractkit/chainlink-testing-framework/utils" - + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/networks" "github.com/smartcontractkit/chainlink/integration-tests/actions" @@ -28,7 +27,7 @@ import ( func TestVRFBasic(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) testEnvironment, testNetwork := setupVRFTest(t) if testEnvironment.WillUseRemoteRunner() { return diff --git a/integration-tests/reorg/automation_reorg_test.go b/integration-tests/reorg/automation_reorg_test.go index f3d3ed9369f..d0f08855da3 100644 --- a/integration-tests/reorg/automation_reorg_test.go +++ b/integration-tests/reorg/automation_reorg_test.go @@ -17,9 +17,9 @@ import ( "github.com/smartcontractkit/chainlink-env/pkg/helm/chainlink" "github.com/smartcontractkit/chainlink-env/pkg/helm/reorg" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" - "github.com/smartcontractkit/chainlink-testing-framework/utils" - + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/networks" + "github.com/smartcontractkit/chainlink-testing-framework/utils" "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/client" @@ -124,7 +124,7 @@ const ( * normal pace after the event. */ func TestAutomationReorg(t *testing.T) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) network := networks.SelectedNetwork cd, err := chainlink.NewDeployment(numberOfNodes, defaultAutomationSettings) diff --git a/integration-tests/smoke/automation_test.go b/integration-tests/smoke/automation_test.go index 6b74ed23a40..76ee75b21ba 100644 --- a/integration-tests/smoke/automation_test.go +++ b/integration-tests/smoke/automation_test.go @@ -13,17 +13,15 @@ import ( "github.com/onsi/gomega" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink-env/logging" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" - "github.com/smartcontractkit/chainlink-testing-framework/utils" - + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/networks" + "github.com/smartcontractkit/chainlink-testing-framework/utils" "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/client" "github.com/smartcontractkit/chainlink/integration-tests/contracts" "github.com/smartcontractkit/chainlink/integration-tests/contracts/ethereum" - "github.com/smartcontractkit/chainlink/integration-tests/docker/test_env" "github.com/smartcontractkit/chainlink/integration-tests/types/config/node" it_utils "github.com/smartcontractkit/chainlink/integration-tests/utils" @@ -98,7 +96,7 @@ func SetupAutomationBasic(t *testing.T, nodeUpgrade bool) { registryVersion := rv t.Run(name, func(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) var ( upgradeImage string @@ -214,7 +212,7 @@ func SetupAutomationBasic(t *testing.T, nodeUpgrade bool) { func TestSetUpkeepTriggerConfig(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) chainClient, _, contractDeployer, linkToken, registry, registrar, _ := setupAutomationTestDocker( t, "set-trigger-config", ethereum.RegistryVersion_2_1, defaultOCRRegistryConfig, false, @@ -440,7 +438,7 @@ func TestAutomationPauseUnPause(t *testing.T) { registryVersion := rv t.Run(name, func(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) chainClient, _, contractDeployer, linkToken, registry, registrar, _ := setupAutomationTestDocker( t, "pause-unpause", registryVersion, defaultOCRRegistryConfig, false, ) @@ -523,7 +521,7 @@ func TestAutomationRegisterUpkeep(t *testing.T) { registryVersion := rv t.Run(name, func(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) chainClient, _, contractDeployer, linkToken, registry, registrar, _ := setupAutomationTestDocker( t, "register-upkeep", registryVersion, defaultOCRRegistryConfig, false, ) @@ -652,7 +650,7 @@ func TestAutomationKeeperNodesDown(t *testing.T) { registryVersion := rv t.Run(name, func(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) chainClient, chainlinkNodes, contractDeployer, linkToken, registry, registrar, _ := setupAutomationTestDocker( t, "keeper-nodes-down", registryVersion, defaultOCRRegistryConfig, false, ) @@ -801,7 +799,7 @@ func TestAutomationCheckPerformGasLimit(t *testing.T) { registryVersion := rv t.Run(name, func(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) chainClient, chainlinkNodes, contractDeployer, linkToken, registry, registrar, _ := setupAutomationTestDocker( t, "gas-limit", registryVersion, defaultOCRRegistryConfig, false, ) @@ -914,7 +912,7 @@ func TestUpdateCheckData(t *testing.T) { registryVersion := rv t.Run(name, func(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) chainClient, _, contractDeployer, linkToken, registry, registrar, _ := setupAutomationTestDocker( t, "update-check-data", registryVersion, defaultOCRRegistryConfig, false, ) @@ -990,7 +988,7 @@ func setupAutomationTestDocker( contracts.KeeperRegistrar, *test_env.CLClusterTestEnv, ) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) // Add registry version to config registryConfig.RegistryVersion = registryVersion network := networks.SelectedNetwork @@ -1009,7 +1007,7 @@ func setupAutomationTestDocker( // launch the environment env, err := test_env.NewCLTestEnvBuilder(). - WithLogger(l). + WithTestLogger(t). WithGeth(). WithMockServer(1). WithCLNodes(5). diff --git a/integration-tests/smoke/cron_test.go b/integration-tests/smoke/cron_test.go index 36895239af9..31ea0fca449 100644 --- a/integration-tests/smoke/cron_test.go +++ b/integration-tests/smoke/cron_test.go @@ -8,7 +8,7 @@ import ( "github.com/onsi/gomega" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/integration-tests/client" "github.com/smartcontractkit/chainlink/integration-tests/docker/test_env" @@ -16,10 +16,10 @@ import ( func TestCronBasic(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) env, err := test_env.NewCLTestEnvBuilder(). - WithLogger(l). + WithTestLogger(t). WithGeth(). WithMockServer(1). WithCLNodes(1). diff --git a/integration-tests/smoke/flux_test.go b/integration-tests/smoke/flux_test.go index 8106f5d89a7..d34879a75d7 100644 --- a/integration-tests/smoke/flux_test.go +++ b/integration-tests/smoke/flux_test.go @@ -12,7 +12,7 @@ import ( "github.com/google/uuid" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/client" @@ -22,10 +22,10 @@ import ( func TestFluxBasic(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) env, err := test_env.NewCLTestEnvBuilder(). - WithLogger(l). + WithTestLogger(t). WithGeth(). WithMockServer(1). WithCLNodes(3). diff --git a/integration-tests/smoke/forwarder_ocr_test.go b/integration-tests/smoke/forwarder_ocr_test.go index 1d4efdbfb4e..1f3fb43846e 100644 --- a/integration-tests/smoke/forwarder_ocr_test.go +++ b/integration-tests/smoke/forwarder_ocr_test.go @@ -8,7 +8,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/docker/test_env" @@ -16,10 +16,10 @@ import ( func TestForwarderOCRBasic(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) env, err := test_env.NewCLTestEnvBuilder(). - WithLogger(l). + WithTestLogger(t). WithGeth(). WithMockServer(1). WithForwarders(). diff --git a/integration-tests/smoke/forwarders_ocr2_test.go b/integration-tests/smoke/forwarders_ocr2_test.go index 3361e717899..59276f936ab 100644 --- a/integration-tests/smoke/forwarders_ocr2_test.go +++ b/integration-tests/smoke/forwarders_ocr2_test.go @@ -10,7 +10,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/docker/test_env" @@ -19,10 +19,10 @@ import ( func TestForwarderOCR2Basic(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) env, err := test_env.NewCLTestEnvBuilder(). - WithLogger(l). + WithTestLogger(t). WithGeth(). WithMockServer(1). WithCLNodeConfig(node.NewConfig(node.NewBaseConfig(), diff --git a/integration-tests/smoke/keeper_test.go b/integration-tests/smoke/keeper_test.go index d4a2bd5a4b7..86eb477cb18 100644 --- a/integration-tests/smoke/keeper_test.go +++ b/integration-tests/smoke/keeper_test.go @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/require" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/v2/core/store/models" "github.com/smartcontractkit/chainlink/integration-tests/actions" @@ -85,7 +85,7 @@ func TestKeeperBasicSmoke(t *testing.T) { registryVersion := rv t.Run(fmt.Sprintf("registry_1_%d", registryVersion), func(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t) registry, _, consumers, upkeepIDs := actions.DeployKeeperContracts( t, @@ -161,7 +161,7 @@ func TestKeeperBlockCountPerTurn(t *testing.T) { registryVersion := rv t.Run(fmt.Sprintf("registry_1_%d", registryVersion), func(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t) registry, _, consumers, upkeepIDs := actions.DeployKeeperContracts( t, @@ -265,7 +265,7 @@ func TestKeeperSimulation(t *testing.T) { registryVersion := rv t.Run(fmt.Sprintf("registry_1_%d", registryVersion), func(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t) registry, _, consumersPerformance, upkeepIDs := actions.DeployPerformanceKeeperContracts( t, @@ -338,7 +338,7 @@ func TestKeeperCheckPerformGasLimit(t *testing.T) { registryVersion := rv t.Run(fmt.Sprintf("registry_1_%d", registryVersion), func(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t) registry, _, consumersPerformance, upkeepIDs := actions.DeployPerformanceKeeperContracts( t, @@ -451,7 +451,7 @@ func TestKeeperRegisterUpkeep(t *testing.T) { registryVersion := rv t.Run(fmt.Sprintf("registry_1_%d", registryVersion), func(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t) registry, registrar, consumers, upkeepIDs := actions.DeployKeeperContracts( t, @@ -540,7 +540,7 @@ func TestKeeperAddFunds(t *testing.T) { registryVersion := rv t.Run(fmt.Sprintf("registry_1_%d", registryVersion), func(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t) registry, _, consumers, upkeepIDs := actions.DeployKeeperContracts( t, @@ -603,7 +603,7 @@ func TestKeeperRemove(t *testing.T) { registryVersion := rv t.Run(fmt.Sprintf("registry_1_%d", registryVersion), func(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t) registry, _, consumers, upkeepIDs := actions.DeployKeeperContracts( t, @@ -681,7 +681,7 @@ func TestKeeperPauseRegistry(t *testing.T) { registryVersion := rv t.Run(fmt.Sprintf("registry_1_%d", registryVersion), func(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t) registry, _, consumers, upkeepIDs := actions.DeployKeeperContracts( t, @@ -742,7 +742,7 @@ func TestKeeperPauseRegistry(t *testing.T) { func TestKeeperMigrateRegistry(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t) registry, _, consumers, upkeepIDs := actions.DeployKeeperContracts( t, @@ -834,7 +834,7 @@ func TestKeeperNodeDown(t *testing.T) { registryVersion := rv t.Run(fmt.Sprintf("registry_1_%d", registryVersion), func(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t) registry, _, consumers, upkeepIDs := actions.DeployKeeperContracts( t, @@ -940,7 +940,7 @@ type nodeAndJob struct { func TestKeeperPauseUnPauseUpkeep(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t) registry, _, consumers, upkeepIDs := actions.DeployKeeperContracts( t, @@ -1030,7 +1030,7 @@ func TestKeeperPauseUnPauseUpkeep(t *testing.T) { func TestKeeperUpdateCheckData(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t) registry, _, performDataChecker, upkeepIDs := actions.DeployPerformDataCheckerContracts( t, @@ -1104,10 +1104,10 @@ func setupKeeperTest(t *testing.T) ( clNodeConfig.Keeper.TurnLookBack = &turnLookBack clNodeConfig.Keeper.Registry.SyncInterval = &syncInterval clNodeConfig.Keeper.Registry.PerformGasOverhead = &performGasOverhead - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) env, err := test_env.NewCLTestEnvBuilder(). - WithLogger(l). + WithTestLogger(t). WithGeth(). WithMockServer(1). WithCLNodes(5). diff --git a/integration-tests/smoke/ocr2_test.go b/integration-tests/smoke/ocr2_test.go index b173b8f594a..649bd7626ce 100644 --- a/integration-tests/smoke/ocr2_test.go +++ b/integration-tests/smoke/ocr2_test.go @@ -16,9 +16,8 @@ import ( "github.com/smartcontractkit/chainlink-env/pkg/helm/mockserver" mockservercfg "github.com/smartcontractkit/chainlink-env/pkg/helm/mockserver-cfg" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" - + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/networks" - "github.com/smartcontractkit/chainlink-testing-framework/utils" "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/client" @@ -29,10 +28,10 @@ import ( // Tests a basic OCRv2 median feed func TestOCRv2Basic(t *testing.T) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) env, err := test_env.NewCLTestEnvBuilder(). - WithLogger(l). + WithTestLogger(t). WithGeth(). WithMockServer(1). WithCLNodeConfig(node.NewConfig(node.NewBaseConfig(), diff --git a/integration-tests/smoke/ocr2vrf_test.go b/integration-tests/smoke/ocr2vrf_test.go index 50a21b81d8e..fa55bf98659 100644 --- a/integration-tests/smoke/ocr2vrf_test.go +++ b/integration-tests/smoke/ocr2vrf_test.go @@ -13,9 +13,9 @@ import ( "github.com/smartcontractkit/chainlink-env/pkg/helm/chainlink" eth "github.com/smartcontractkit/chainlink-env/pkg/helm/ethereum" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" - "github.com/smartcontractkit/chainlink-testing-framework/utils" - + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/networks" + "github.com/smartcontractkit/chainlink-testing-framework/utils" "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/actions/ocr2vrf_actions" @@ -28,7 +28,7 @@ import ( func TestOCR2VRFRedeemModel(t *testing.T) { t.Parallel() t.Skip("VRFv3 is on pause, skipping") - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) testEnvironment, testNetwork := setupOCR2VRFEnvironment(t) if testEnvironment.WillUseRemoteRunner() { return @@ -90,7 +90,7 @@ func TestOCR2VRFRedeemModel(t *testing.T) { func TestOCR2VRFFulfillmentModel(t *testing.T) { t.Parallel() t.Skip("VRFv3 is on pause, skipping") - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) testEnvironment, testNetwork := setupOCR2VRFEnvironment(t) if testEnvironment.WillUseRemoteRunner() { return diff --git a/integration-tests/smoke/ocr_test.go b/integration-tests/smoke/ocr_test.go index 070072e4d19..c783978e66e 100644 --- a/integration-tests/smoke/ocr_test.go +++ b/integration-tests/smoke/ocr_test.go @@ -7,7 +7,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/docker/test_env" @@ -15,10 +15,10 @@ import ( func TestOCRBasic(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) env, err := test_env.NewCLTestEnvBuilder(). - WithLogger(l). + WithTestLogger(t). WithGeth(). WithMockServer(1). WithCLNodes(6). diff --git a/integration-tests/smoke/runlog_test.go b/integration-tests/smoke/runlog_test.go index f79f9f266bb..1db940e26e5 100644 --- a/integration-tests/smoke/runlog_test.go +++ b/integration-tests/smoke/runlog_test.go @@ -11,7 +11,7 @@ import ( "github.com/onsi/gomega" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/integration-tests/client" "github.com/smartcontractkit/chainlink/integration-tests/docker/test_env" @@ -19,10 +19,10 @@ import ( func TestRunLogBasic(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) env, err := test_env.NewCLTestEnvBuilder(). - WithLogger(l). + WithTestLogger(t). WithGeth(). WithMockServer(1). WithCLNodes(1). diff --git a/integration-tests/smoke/vrf_test.go b/integration-tests/smoke/vrf_test.go index d4d980ec223..eb73b2bfd0e 100644 --- a/integration-tests/smoke/vrf_test.go +++ b/integration-tests/smoke/vrf_test.go @@ -11,7 +11,7 @@ import ( "github.com/onsi/gomega" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/actions/vrfv1" @@ -21,10 +21,10 @@ import ( func TestVRFBasic(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) env, err := test_env.NewCLTestEnvBuilder(). - WithLogger(l). + WithTestLogger(t). WithGeth(). WithMockServer(1). WithCLNodes(1). diff --git a/integration-tests/smoke/vrfv2_test.go b/integration-tests/smoke/vrfv2_test.go index 41f9d2ee5ee..0a16fcfa69e 100644 --- a/integration-tests/smoke/vrfv2_test.go +++ b/integration-tests/smoke/vrfv2_test.go @@ -9,7 +9,7 @@ import ( "github.com/onsi/gomega" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/actions/vrfv2_actions" @@ -20,7 +20,7 @@ import ( func TestVRFv2Basic(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) env, err := test_env.NewCLTestEnvBuilder(). WithGeth(). diff --git a/integration-tests/smoke/vrfv2plus_test.go b/integration-tests/smoke/vrfv2plus_test.go index 9b6dc5a8626..24001f2fb0f 100644 --- a/integration-tests/smoke/vrfv2plus_test.go +++ b/integration-tests/smoke/vrfv2plus_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/actions/vrfv2plus" @@ -18,7 +18,7 @@ import ( func TestVRFv2PlusBilling(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) env, err := test_env.NewCLTestEnvBuilder(). WithGeth(). diff --git a/integration-tests/soak/forwarder_ocr_test.go b/integration-tests/soak/forwarder_ocr_test.go index e8bcea0f5b8..bc02f367892 100644 --- a/integration-tests/soak/forwarder_ocr_test.go +++ b/integration-tests/soak/forwarder_ocr_test.go @@ -5,14 +5,14 @@ import ( "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/testsetups" ) func TestForwarderOCRSoak(t *testing.T) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) // Use this variable to pass in any custom EVM specific TOML values to your Chainlink nodes customNetworkTOML := `[EVM.Transactions] ForwardersEnabled = true` diff --git a/integration-tests/soak/ocr_test.go b/integration-tests/soak/ocr_test.go index c0fd0a4525f..b2375f13ac2 100644 --- a/integration-tests/soak/ocr_test.go +++ b/integration-tests/soak/ocr_test.go @@ -5,14 +5,14 @@ import ( "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/testsetups" ) func TestOCRSoak(t *testing.T) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) // Use this variable to pass in any custom EVM specific TOML values to your Chainlink nodes customNetworkTOML := `` // Uncomment below for debugging TOML issues on the node diff --git a/integration-tests/testsetups/keeper_benchmark.go b/integration-tests/testsetups/keeper_benchmark.go index 7e862467266..70e0bf57941 100644 --- a/integration-tests/testsetups/keeper_benchmark.go +++ b/integration-tests/testsetups/keeper_benchmark.go @@ -19,8 +19,8 @@ import ( "github.com/smartcontractkit/chainlink-env/environment" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" + "github.com/smartcontractkit/chainlink-testing-framework/logging" reportModel "github.com/smartcontractkit/chainlink-testing-framework/testreporters" - "github.com/smartcontractkit/chainlink-testing-framework/utils" iregistry21 "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/i_keeper_registry_master_wrapper_2_1" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/keeper_registry_wrapper1_1" @@ -100,7 +100,7 @@ func NewKeeperBenchmarkTest(inputs KeeperBenchmarkTestInputs) *KeeperBenchmarkTe // Setup prepares contracts for the test func (k *KeeperBenchmarkTest) Setup(t *testing.T, env *environment.Environment) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) startTime := time.Now() k.TestReporter.Summary.StartTime = startTime.UnixMilli() k.ensureInputValues(t) @@ -202,7 +202,7 @@ func (k *KeeperBenchmarkTest) Setup(t *testing.T, env *environment.Environment) // Run runs the keeper benchmark test func (k *KeeperBenchmarkTest) Run(t *testing.T) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) u := k.Inputs.Upkeeps k.TestReporter.Summary.Load.TotalCheckGasPerBlock = int64(u.NumberOfUpkeeps) * u.CheckGasToBurn k.TestReporter.Summary.Load.TotalPerformGasPerBlock = int64((float64(u.NumberOfUpkeeps) / @@ -323,7 +323,7 @@ func (k *KeeperBenchmarkTest) subscribeToUpkeepPerformedEvent( metricsReporter *testreporters.KeeperBenchmarkTestReporter, rIndex int, ) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) contractABI, err := keeper_registry_wrapper1_1.KeeperRegistryMetaData.GetAbi() require.NoError(t, err, "Error getting ABI") switch k.Inputs.RegistryVersions[rIndex] { @@ -476,7 +476,7 @@ func (k *KeeperBenchmarkTest) DeployBenchmarkKeeperContracts( t *testing.T, index int, ) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) registryVersion := k.Inputs.RegistryVersions[index] k.Inputs.KeeperRegistrySettings.RegistryVersion = registryVersion upkeep := k.Inputs.Upkeeps @@ -587,7 +587,7 @@ func DeployKeeperConsumersBenchmark( contractDeployer contracts.ContractDeployer, client blockchain.EVMClient, ) contracts.AutomationConsumerBenchmark { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) // Deploy consumer keeperConsumerInstance, err := contractDeployer.DeployKeeperConsumerBenchmark() diff --git a/integration-tests/testsetups/ocr.go b/integration-tests/testsetups/ocr.go index 07aa3b2c4e8..1c6c7f6b2b7 100644 --- a/integration-tests/testsetups/ocr.go +++ b/integration-tests/testsetups/ocr.go @@ -32,8 +32,8 @@ import ( mockservercfg "github.com/smartcontractkit/chainlink-env/pkg/helm/mockserver-cfg" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" ctfClient "github.com/smartcontractkit/chainlink-testing-framework/client" + "github.com/smartcontractkit/chainlink-testing-framework/logging" reportModel "github.com/smartcontractkit/chainlink-testing-framework/testreporters" - "github.com/smartcontractkit/chainlink-testing-framework/utils" "github.com/smartcontractkit/libocr/gethwrappers/offchainaggregator" "github.com/smartcontractkit/chainlink-testing-framework/networks" @@ -115,7 +115,7 @@ func NewOCRSoakTest(t *testing.T, forwarderFlow bool) (*OCRSoakTest, error) { t: t, startTime: time.Now(), timeLeft: testInputs.TestDuration, - log: utils.GetTestLogger(t), + log: logging.GetTestLogger(t), ocrRoundStates: make([]*testreporters.OCRRoundState, 0), ocrInstanceMap: make(map[string]contracts.OffchainAggregator), } diff --git a/integration-tests/testsetups/vrfv2.go b/integration-tests/testsetups/vrfv2.go index 7afe9cf2cca..cfa26e8f279 100644 --- a/integration-tests/testsetups/vrfv2.go +++ b/integration-tests/testsetups/vrfv2.go @@ -16,8 +16,8 @@ import ( "github.com/smartcontractkit/chainlink-env/environment" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" + "github.com/smartcontractkit/chainlink-testing-framework/logging" reportModel "github.com/smartcontractkit/chainlink-testing-framework/testreporters" - "github.com/smartcontractkit/chainlink-testing-framework/utils" "github.com/smartcontractkit/chainlink/integration-tests/client" "github.com/smartcontractkit/chainlink/integration-tests/contracts" @@ -80,7 +80,7 @@ func (v *VRFV2SoakTest) Setup(t *testing.T, env *environment.Environment) { // Run starts the VRFV2 soak test func (v *VRFV2SoakTest) Run(t *testing.T) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) l.Info(). Str("Test Duration", v.Inputs.TestDuration.Truncate(time.Second).String()). Int("Max number of requests per minute wanted", v.Inputs.RequestsPerMinute). From 2771f5a184db804153dbda35cdba8a722a372d0f Mon Sep 17 00:00:00 2001 From: Tate Date: Wed, 13 Sep 2023 10:15:50 -0600 Subject: [PATCH 3/8] More logging missing in parallel e2e tests --- integration-tests/client/chainlink.go | 138 +++++++++--------- .../contracts/ethereum_contracts.go | 4 + integration-tests/docker/test_env/cl_node.go | 1 + integration-tests/performance/flux_test.go | 4 +- integration-tests/smoke/flux_test.go | 4 +- integration-tests/testsetups/ocr.go | 19 ++- 6 files changed, 91 insertions(+), 79 deletions(-) diff --git a/integration-tests/client/chainlink.go b/integration-tests/client/chainlink.go index 7d3bd0284d0..9653dc0dea1 100644 --- a/integration-tests/client/chainlink.go +++ b/integration-tests/client/chainlink.go @@ -9,11 +9,13 @@ import ( "sync" "time" + "os" + "github.com/ethereum/go-ethereum/common" "github.com/go-resty/resty/v2" + "github.com/rs/zerolog" "github.com/rs/zerolog/log" "golang.org/x/sync/errgroup" - "os" ) const ( @@ -39,6 +41,7 @@ type ChainlinkClient struct { pageSize int primaryEthAddress string ethAddresses []string + l zerolog.Logger } // NewChainlinkClient creates a new Chainlink model using a provided config @@ -55,9 +58,14 @@ func NewChainlinkClient(c *ChainlinkConfig) (*ChainlinkClient, error) { Config: c, APIClient: rc, pageSize: 25, + l: log.Logger, }, nil } +func (c *ChainlinkClient) WithLogger(l zerolog.Logger) { + c.l = l +} + func initRestyClient(url string, email string, password string, timeout *time.Duration) (*resty.Client, error) { rc := resty.New().SetBaseURL(url) if timeout != nil { @@ -92,8 +100,8 @@ func (c *ChainlinkClient) URL() string { // CreateJobRaw creates a Chainlink job based on the provided spec string func (c *ChainlinkClient) CreateJobRaw(spec string) (*Job, *http.Response, error) { job := &Job{} - log.Info().Str("Node URL", c.Config.URL).Msg("Creating Job") - log.Trace().Str("Node URL", c.Config.URL).Str("Job Body", spec).Msg("Creating Job") + c.l.Info().Str("Node URL", c.Config.URL).Msg("Creating Job") + c.l.Trace().Str("Node URL", c.Config.URL).Str("Job Body", spec).Msg("Creating Job") resp, err := c.APIClient.R(). SetBody(&JobForm{ TOML: spec, @@ -123,8 +131,8 @@ func (c *ChainlinkClient) CreateJob(spec JobSpec) (*Job, *http.Response, error) if err != nil { return nil, nil, err } - log.Info().Str("Node URL", c.Config.URL).Str("Type", spec.Type()).Msg("Creating Job") - log.Trace().Str("Node URL", c.Config.URL).Str("Type", spec.Type()).Str("Spec", specString).Msg("Creating Job") + c.l.Info().Str("Node URL", c.Config.URL).Str("Type", spec.Type()).Msg("Creating Job") + c.l.Trace().Str("Node URL", c.Config.URL).Str("Type", spec.Type()).Str("Spec", specString).Msg("Creating Job") resp, err := c.APIClient.R(). SetBody(&JobForm{ TOML: specString, @@ -140,7 +148,7 @@ func (c *ChainlinkClient) CreateJob(spec JobSpec) (*Job, *http.Response, error) // ReadJobs reads all jobs from the Chainlink node func (c *ChainlinkClient) ReadJobs() (*ResponseSlice, *http.Response, error) { specObj := &ResponseSlice{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Getting Jobs") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Getting Jobs") resp, err := c.APIClient.R(). SetResult(&specObj). Get("/v2/jobs") @@ -153,7 +161,7 @@ func (c *ChainlinkClient) ReadJobs() (*ResponseSlice, *http.Response, error) { // ReadJob reads a job with the provided ID from the Chainlink node func (c *ChainlinkClient) ReadJob(id string) (*Response, *http.Response, error) { specObj := &Response{} - log.Info().Str(NodeURL, c.Config.URL).Str("ID", id).Msg("Reading Job") + c.l.Info().Str(NodeURL, c.Config.URL).Str("ID", id).Msg("Reading Job") resp, err := c.APIClient.R(). SetResult(&specObj). SetPathParams(map[string]string{ @@ -178,7 +186,7 @@ func (c *ChainlinkClient) MustDeleteJob(id string) error { // DeleteJob deletes a job with a provided ID from the Chainlink node func (c *ChainlinkClient) DeleteJob(id string) (*http.Response, error) { - log.Info().Str(NodeURL, c.Config.URL).Str("ID", id).Msg("Deleting Job") + c.l.Info().Str(NodeURL, c.Config.URL).Str("ID", id).Msg("Deleting Job") resp, err := c.APIClient.R(). SetPathParams(map[string]string{ "id": id, @@ -194,7 +202,7 @@ func (c *ChainlinkClient) DeleteJob(id string) (*http.Response, error) { func (c *ChainlinkClient) CreateSpec(spec string) (*Spec, *http.Response, error) { s := &Spec{} r := strings.NewReplacer("\n", "", " ", "", "\\", "") // Makes it more compact and readable for logging - log.Info().Str(NodeURL, c.Config.URL).Str("Spec", r.Replace(spec)).Msg("Creating Spec") + c.l.Info().Str(NodeURL, c.Config.URL).Str("Spec", r.Replace(spec)).Msg("Creating Spec") resp, err := c.APIClient.R(). SetBody([]byte(spec)). SetResult(&s). @@ -208,7 +216,7 @@ func (c *ChainlinkClient) CreateSpec(spec string) (*Spec, *http.Response, error) // ReadSpec reads a job spec with the provided ID on the Chainlink node func (c *ChainlinkClient) ReadSpec(id string) (*Response, *http.Response, error) { specObj := &Response{} - log.Info().Str(NodeURL, c.Config.URL).Str("ID", id).Msg("Reading Spec") + c.l.Info().Str(NodeURL, c.Config.URL).Str("ID", id).Msg("Reading Spec") resp, err := c.APIClient.R(). SetResult(&specObj). SetPathParams(map[string]string{ @@ -234,7 +242,7 @@ func (c *ChainlinkClient) MustReadRunsByJob(jobID string) (*JobRunsResponse, err // ReadRunsByJob reads all runs for a job func (c *ChainlinkClient) ReadRunsByJob(jobID string) (*JobRunsResponse, *http.Response, error) { runsObj := &JobRunsResponse{} - log.Debug().Str(NodeURL, c.Config.URL).Str("JobID", jobID).Msg("Reading runs for a job") + c.l.Debug().Str(NodeURL, c.Config.URL).Str("JobID", jobID).Msg("Reading runs for a job") resp, err := c.APIClient.R(). SetResult(&runsObj). SetPathParams(map[string]string{ @@ -249,7 +257,7 @@ func (c *ChainlinkClient) ReadRunsByJob(jobID string) (*JobRunsResponse, *http.R // DeleteSpec deletes a job spec with the provided ID from the Chainlink node func (c *ChainlinkClient) DeleteSpec(id string) (*http.Response, error) { - log.Info().Str(NodeURL, c.Config.URL).Str("ID", id).Msg("Deleting Spec") + c.l.Info().Str(NodeURL, c.Config.URL).Str("ID", id).Msg("Deleting Spec") resp, err := c.APIClient.R(). SetPathParams(map[string]string{ "id": id, @@ -272,7 +280,7 @@ func (c *ChainlinkClient) MustCreateBridge(bta *BridgeTypeAttributes) error { } func (c *ChainlinkClient) CreateBridge(bta *BridgeTypeAttributes) (*http.Response, error) { - log.Info().Str(NodeURL, c.Config.URL).Str("Name", bta.Name).Msg("Creating Bridge") + c.l.Info().Str(NodeURL, c.Config.URL).Str("Name", bta.Name).Msg("Creating Bridge") resp, err := c.APIClient.R(). SetBody(bta). Post("/v2/bridge_types") @@ -285,7 +293,7 @@ func (c *ChainlinkClient) CreateBridge(bta *BridgeTypeAttributes) (*http.Respons // ReadBridge reads a bridge from the Chainlink node based on the provided name func (c *ChainlinkClient) ReadBridge(name string) (*BridgeType, *http.Response, error) { bt := BridgeType{} - log.Info().Str(NodeURL, c.Config.URL).Str("Name", name).Msg("Reading Bridge") + c.l.Info().Str(NodeURL, c.Config.URL).Str("Name", name).Msg("Reading Bridge") resp, err := c.APIClient.R(). SetPathParams(map[string]string{ "name": name, @@ -300,7 +308,7 @@ func (c *ChainlinkClient) ReadBridge(name string) (*BridgeType, *http.Response, // DeleteBridge deletes a bridge on the Chainlink node based on the provided name func (c *ChainlinkClient) DeleteBridge(name string) (*http.Response, error) { - log.Info().Str(NodeURL, c.Config.URL).Str("Name", name).Msg("Deleting Bridge") + c.l.Info().Str(NodeURL, c.Config.URL).Str("Name", name).Msg("Deleting Bridge") resp, err := c.APIClient.R(). SetPathParams(map[string]string{ "name": name, @@ -315,7 +323,7 @@ func (c *ChainlinkClient) DeleteBridge(name string) (*http.Response, error) { // CreateOCRKey creates an OCRKey on the Chainlink node func (c *ChainlinkClient) CreateOCRKey() (*OCRKey, *http.Response, error) { ocrKey := &OCRKey{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Creating OCR Key") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Creating OCR Key") resp, err := c.APIClient.R(). SetResult(ocrKey). Post("/v2/keys/ocr") @@ -329,7 +337,7 @@ func (c *ChainlinkClient) CreateOCRKey() (*OCRKey, *http.Response, error) { // the request is unsuccessful func (c *ChainlinkClient) MustReadOCRKeys() (*OCRKeys, error) { ocrKeys := &OCRKeys{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Reading OCR Keys") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Reading OCR Keys") resp, err := c.APIClient.R(). SetResult(ocrKeys). Get("/v2/keys/ocr") @@ -350,7 +358,7 @@ func (c *ChainlinkClient) MustReadOCRKeys() (*OCRKeys, error) { // DeleteOCRKey deletes an OCRKey based on the provided ID func (c *ChainlinkClient) DeleteOCRKey(id string) (*http.Response, error) { - log.Info().Str(NodeURL, c.Config.URL).Str("ID", id).Msg("Deleting OCR Key") + c.l.Info().Str(NodeURL, c.Config.URL).Str("ID", id).Msg("Deleting OCR Key") resp, err := c.APIClient.R(). SetPathParams(map[string]string{ "id": id, @@ -365,7 +373,7 @@ func (c *ChainlinkClient) DeleteOCRKey(id string) (*http.Response, error) { // CreateOCR2Key creates an OCR2Key on the Chainlink node func (c *ChainlinkClient) CreateOCR2Key(chain string) (*OCR2Key, *http.Response, error) { ocr2Key := &OCR2Key{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Creating OCR2 Key") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Creating OCR2 Key") resp, err := c.APIClient.R(). SetPathParams(map[string]string{ "chain": chain, @@ -381,7 +389,7 @@ func (c *ChainlinkClient) CreateOCR2Key(chain string) (*OCR2Key, *http.Response, // ReadOCR2Keys reads all OCR2Keys from the Chainlink node func (c *ChainlinkClient) ReadOCR2Keys() (*OCR2Keys, *http.Response, error) { ocr2Keys := &OCR2Keys{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Reading OCR2 Keys") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Reading OCR2 Keys") resp, err := c.APIClient.R(). SetResult(ocr2Keys). Get("/v2/keys/ocr2") @@ -391,7 +399,7 @@ func (c *ChainlinkClient) ReadOCR2Keys() (*OCR2Keys, *http.Response, error) { // MustReadOCR2Keys reads all OCR2Keys from the Chainlink node returns err if response not 200 func (c *ChainlinkClient) MustReadOCR2Keys() (*OCR2Keys, error) { ocr2Keys := &OCR2Keys{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Reading OCR2 Keys") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Reading OCR2 Keys") resp, err := c.APIClient.R(). SetResult(ocr2Keys). Get("/v2/keys/ocr2") @@ -404,7 +412,7 @@ func (c *ChainlinkClient) MustReadOCR2Keys() (*OCR2Keys, error) { // DeleteOCR2Key deletes an OCR2Key based on the provided ID func (c *ChainlinkClient) DeleteOCR2Key(id string) (*http.Response, error) { - log.Info().Str(NodeURL, c.Config.URL).Str("ID", id).Msg("Deleting OCR2 Key") + c.l.Info().Str(NodeURL, c.Config.URL).Str("ID", id).Msg("Deleting OCR2 Key") resp, err := c.APIClient.R(). SetPathParams(map[string]string{ "id": id, @@ -419,7 +427,7 @@ func (c *ChainlinkClient) DeleteOCR2Key(id string) (*http.Response, error) { // CreateP2PKey creates an P2PKey on the Chainlink node func (c *ChainlinkClient) CreateP2PKey() (*P2PKey, *http.Response, error) { p2pKey := &P2PKey{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Creating P2P Key") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Creating P2P Key") resp, err := c.APIClient.R(). SetResult(p2pKey). Post("/v2/keys/p2p") @@ -433,7 +441,7 @@ func (c *ChainlinkClient) CreateP2PKey() (*P2PKey, *http.Response, error) { // the request is unsuccessful func (c *ChainlinkClient) MustReadP2PKeys() (*P2PKeys, error) { p2pKeys := &P2PKeys{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Reading P2P Keys") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Reading P2P Keys") resp, err := c.APIClient.R(). SetResult(p2pKeys). Get("/v2/keys/p2p") @@ -443,7 +451,7 @@ func (c *ChainlinkClient) MustReadP2PKeys() (*P2PKeys, error) { err = VerifyStatusCode(resp.StatusCode(), http.StatusOK) if len(p2pKeys.Data) == 0 { err = fmt.Errorf("Found no P2P Keys on the Chainlink node. Node URL: %s", c.Config.URL) - log.Err(err).Msg("Error getting P2P keys") + c.l.Err(err).Msg("Error getting P2P keys") return nil, err } for index := range p2pKeys.Data { @@ -454,7 +462,7 @@ func (c *ChainlinkClient) MustReadP2PKeys() (*P2PKeys, error) { // DeleteP2PKey deletes a P2PKey on the Chainlink node based on the provided ID func (c *ChainlinkClient) DeleteP2PKey(id int) (*http.Response, error) { - log.Info().Str(NodeURL, c.Config.URL).Int("ID", id).Msg("Deleting P2P Key") + c.l.Info().Str(NodeURL, c.Config.URL).Int("ID", id).Msg("Deleting P2P Key") resp, err := c.APIClient.R(). SetPathParams(map[string]string{ "id": fmt.Sprint(id), @@ -470,7 +478,7 @@ func (c *ChainlinkClient) DeleteP2PKey(id int) (*http.Response, error) { // the request is unsuccessful func (c *ChainlinkClient) MustReadETHKeys() (*ETHKeys, error) { ethKeys := ÐKeys{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Reading ETH Keys") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Reading ETH Keys") resp, err := c.APIClient.R(). SetResult(ethKeys). Get("/v2/keys/eth") @@ -479,7 +487,7 @@ func (c *ChainlinkClient) MustReadETHKeys() (*ETHKeys, error) { } err = VerifyStatusCode(resp.StatusCode(), http.StatusOK) if len(ethKeys.Data) == 0 { - log.Warn().Str(NodeURL, c.Config.URL).Msg("Found no ETH Keys on the node") + c.l.Warn().Str(NodeURL, c.Config.URL).Msg("Found no ETH Keys on the node") } return ethKeys, err } @@ -487,7 +495,7 @@ func (c *ChainlinkClient) MustReadETHKeys() (*ETHKeys, error) { // UpdateEthKeyMaxGasPriceGWei updates the maxGasPriceGWei for an eth key func (c *ChainlinkClient) UpdateEthKeyMaxGasPriceGWei(keyId string, gWei int) (*ETHKey, *http.Response, error) { ethKey := ÐKey{} - log.Info().Str(NodeURL, c.Config.URL).Str("ID", keyId).Int("maxGasPriceGWei", gWei).Msg("Update maxGasPriceGWei for eth key") + c.l.Info().Str(NodeURL, c.Config.URL).Str("ID", keyId).Int("maxGasPriceGWei", gWei).Msg("Update maxGasPriceGWei for eth key") resp, err := c.APIClient.R(). SetPathParams(map[string]string{ "keyId": keyId, @@ -608,7 +616,7 @@ func (c *ChainlinkClient) ExportEVMKeys() ([]*ExportedEVMKey, error) { exportedKeys = append(exportedKeys, exportedKey) } } - log.Info(). + c.l.Info(). Str(NodeURL, c.Config.URL). Str("Password", ChainlinkKeyPassword). Msg("Exported EVM Keys") @@ -636,7 +644,7 @@ func (c *ChainlinkClient) ExportEVMKeysForChain(chainid string) ([]*ExportedEVMK exportedKeys = append(exportedKeys, exportedKey) } } - log.Info(). + c.l.Info(). Str(NodeURL, c.Config.URL). Str("Password", ChainlinkKeyPassword). Msg("Exported EVM Keys") @@ -646,7 +654,7 @@ func (c *ChainlinkClient) ExportEVMKeysForChain(chainid string) ([]*ExportedEVMK // CreateTxKey creates a tx key on the Chainlink node func (c *ChainlinkClient) CreateTxKey(chain string, chainId string) (*TxKey, *http.Response, error) { txKey := &TxKey{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Creating Tx Key") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Creating Tx Key") resp, err := c.APIClient.R(). SetPathParams(map[string]string{ "chain": chain, @@ -663,7 +671,7 @@ func (c *ChainlinkClient) CreateTxKey(chain string, chainId string) (*TxKey, *ht // ReadTxKeys reads all tx keys from the Chainlink node func (c *ChainlinkClient) ReadTxKeys(chain string) (*TxKeys, *http.Response, error) { txKeys := &TxKeys{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Reading Tx Keys") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Reading Tx Keys") resp, err := c.APIClient.R(). SetPathParams(map[string]string{ "chain": chain, @@ -678,7 +686,7 @@ func (c *ChainlinkClient) ReadTxKeys(chain string) (*TxKeys, *http.Response, err // DeleteTxKey deletes an tx key based on the provided ID func (c *ChainlinkClient) DeleteTxKey(chain string, id string) (*http.Response, error) { - log.Info().Str(NodeURL, c.Config.URL).Str("ID", id).Msg("Deleting Tx Key") + c.l.Info().Str(NodeURL, c.Config.URL).Str("ID", id).Msg("Deleting Tx Key") resp, err := c.APIClient.R(). SetPathParams(map[string]string{ "chain": chain, @@ -695,7 +703,7 @@ func (c *ChainlinkClient) DeleteTxKey(chain string, id string) (*http.Response, // and returns error if the request is unsuccessful func (c *ChainlinkClient) MustReadTransactionAttempts() (*TransactionsData, error) { txsData := &TransactionsData{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Reading Transaction Attempts") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Reading Transaction Attempts") resp, err := c.APIClient.R(). SetResult(txsData). Get("/v2/tx_attempts") @@ -709,7 +717,7 @@ func (c *ChainlinkClient) MustReadTransactionAttempts() (*TransactionsData, erro // ReadTransactions reads all transactions made by the Chainlink node func (c *ChainlinkClient) ReadTransactions() (*TransactionsData, *http.Response, error) { txsData := &TransactionsData{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Reading Transactions") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Reading Transactions") resp, err := c.APIClient.R(). SetResult(txsData). Get("/v2/transactions") @@ -735,7 +743,7 @@ func (c *ChainlinkClient) MustSendNativeToken(amount *big.Int, fromAddress, toAd SetResult(txData). Post("/v2/transfers") - log.Info(). + c.l.Info(). Str(NodeURL, c.Config.URL). Str("From", fromAddress). Str("To", toAddress). @@ -751,7 +759,7 @@ func (c *ChainlinkClient) MustSendNativeToken(amount *big.Int, fromAddress, toAd // ReadVRFKeys reads all VRF keys from the Chainlink node func (c *ChainlinkClient) ReadVRFKeys() (*VRFKeys, *http.Response, error) { vrfKeys := &VRFKeys{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Reading VRF Keys") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Reading VRF Keys") resp, err := c.APIClient.R(). SetResult(vrfKeys). Get("/v2/keys/vrf") @@ -759,7 +767,7 @@ func (c *ChainlinkClient) ReadVRFKeys() (*VRFKeys, *http.Response, error) { return nil, nil, err } if len(vrfKeys.Data) == 0 { - log.Warn().Str(NodeURL, c.Config.URL).Msg("Found no VRF Keys on the node") + c.l.Warn().Str(NodeURL, c.Config.URL).Msg("Found no VRF Keys on the node") } return vrfKeys, resp.RawResponse, err } @@ -768,7 +776,7 @@ func (c *ChainlinkClient) ReadVRFKeys() (*VRFKeys, *http.Response, error) { // and returns error if the request is unsuccessful func (c *ChainlinkClient) MustCreateVRFKey() (*VRFKey, error) { vrfKey := &VRFKey{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Creating VRF Key") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Creating VRF Key") resp, err := c.APIClient.R(). SetResult(vrfKey). Post("/v2/keys/vrf") @@ -781,7 +789,7 @@ func (c *ChainlinkClient) MustCreateVRFKey() (*VRFKey, error) { // ExportVRFKey exports a vrf key by key id func (c *ChainlinkClient) ExportVRFKey(keyId string) (*VRFExportKey, *http.Response, error) { vrfExportKey := &VRFExportKey{} - log.Info().Str(NodeURL, c.Config.URL).Str("ID", keyId).Msg("Exporting VRF Key") + c.l.Info().Str(NodeURL, c.Config.URL).Str("ID", keyId).Msg("Exporting VRF Key") resp, err := c.APIClient.R(). SetPathParams(map[string]string{ "keyId": keyId, @@ -797,7 +805,7 @@ func (c *ChainlinkClient) ExportVRFKey(keyId string) (*VRFExportKey, *http.Respo // ImportVRFKey import vrf key func (c *ChainlinkClient) ImportVRFKey(vrfExportKey *VRFExportKey) (*VRFKey, *http.Response, error) { vrfKey := &VRFKey{} - log.Info().Str(NodeURL, c.Config.URL).Str("ID", vrfExportKey.VrfKey.Address).Msg("Importing VRF Key") + c.l.Info().Str(NodeURL, c.Config.URL).Str("ID", vrfExportKey.VrfKey.Address).Msg("Importing VRF Key") resp, err := c.APIClient.R(). SetBody(vrfExportKey). SetResult(vrfKey). @@ -812,7 +820,7 @@ func (c *ChainlinkClient) ImportVRFKey(vrfExportKey *VRFExportKey) (*VRFKey, *ht // and returns error if the request is unsuccessful func (c *ChainlinkClient) MustCreateDkgSignKey() (*DKGSignKey, error) { dkgSignKey := &DKGSignKey{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Creating DKG Sign Key") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Creating DKG Sign Key") resp, err := c.APIClient.R(). SetResult(dkgSignKey). Post("/v2/keys/dkgsign") @@ -826,7 +834,7 @@ func (c *ChainlinkClient) MustCreateDkgSignKey() (*DKGSignKey, error) { // and returns error if the request is unsuccessful func (c *ChainlinkClient) MustCreateDkgEncryptKey() (*DKGEncryptKey, error) { dkgEncryptKey := &DKGEncryptKey{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Creating DKG Encrypt Key") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Creating DKG Encrypt Key") resp, err := c.APIClient.R(). SetResult(dkgEncryptKey). Post("/v2/keys/dkgencrypt") @@ -839,7 +847,7 @@ func (c *ChainlinkClient) MustCreateDkgEncryptKey() (*DKGEncryptKey, error) { // MustReadDKGSignKeys reads all DKG Sign Keys from the Chainlink node returns err if response not 200 func (c *ChainlinkClient) MustReadDKGSignKeys() (*DKGSignKeys, error) { dkgSignKeys := &DKGSignKeys{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Reading DKG Sign Keys") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Reading DKG Sign Keys") resp, err := c.APIClient.R(). SetResult(dkgSignKeys). Get("/v2/keys/dkgsign") @@ -853,7 +861,7 @@ func (c *ChainlinkClient) MustReadDKGSignKeys() (*DKGSignKeys, error) { // MustReadDKGEncryptKeys reads all DKG Encrypt Keys from the Chainlink node returns err if response not 200 func (c *ChainlinkClient) MustReadDKGEncryptKeys() (*DKGEncryptKeys, error) { dkgEncryptKeys := &DKGEncryptKeys{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Reading DKG Encrypt Keys") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Reading DKG Encrypt Keys") resp, err := c.APIClient.R(). SetResult(dkgEncryptKeys). Get("/v2/keys/dkgencrypt") @@ -867,7 +875,7 @@ func (c *ChainlinkClient) MustReadDKGEncryptKeys() (*DKGEncryptKeys, error) { // CreateCSAKey creates a CSA key on the Chainlink node, only 1 CSA key per noe func (c *ChainlinkClient) CreateCSAKey() (*CSAKey, *http.Response, error) { csaKey := &CSAKey{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Creating CSA Key") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Creating CSA Key") resp, err := c.APIClient.R(). SetResult(csaKey). Post("/v2/keys/csa") @@ -880,12 +888,12 @@ func (c *ChainlinkClient) CreateCSAKey() (*CSAKey, *http.Response, error) { // ReadCSAKeys reads CSA keys from the Chainlink node func (c *ChainlinkClient) ReadCSAKeys() (*CSAKeys, *http.Response, error) { csaKeys := &CSAKeys{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Reading CSA Keys") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Reading CSA Keys") resp, err := c.APIClient.R(). SetResult(csaKeys). Get("/v2/keys/csa") if len(csaKeys.Data) == 0 { - log.Warn().Str(NodeURL, c.Config.URL).Msg("Found no CSA Keys on the node") + c.l.Warn().Str(NodeURL, c.Config.URL).Msg("Found no CSA Keys on the node") } if err != nil { return nil, nil, err @@ -896,7 +904,7 @@ func (c *ChainlinkClient) ReadCSAKeys() (*CSAKeys, *http.Response, error) { // CreateEI creates an EI on the Chainlink node based on the provided attributes and returns the respective secrets func (c *ChainlinkClient) CreateEI(eia *EIAttributes) (*EIKeyCreate, *http.Response, error) { ei := EIKeyCreate{} - log.Info().Str(NodeURL, c.Config.URL).Str("Name", eia.Name).Msg("Creating External Initiator") + c.l.Info().Str(NodeURL, c.Config.URL).Str("Name", eia.Name).Msg("Creating External Initiator") resp, err := c.APIClient.R(). SetBody(eia). SetResult(&ei). @@ -910,7 +918,7 @@ func (c *ChainlinkClient) CreateEI(eia *EIAttributes) (*EIKeyCreate, *http.Respo // ReadEIs reads all of the configured EIs from the Chainlink node func (c *ChainlinkClient) ReadEIs() (*EIKeys, *http.Response, error) { ei := EIKeys{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Reading EI Keys") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Reading EI Keys") resp, err := c.APIClient.R(). SetResult(&ei). Get("/v2/external_initiators") @@ -922,7 +930,7 @@ func (c *ChainlinkClient) ReadEIs() (*EIKeys, *http.Response, error) { // DeleteEI deletes an external initiator in the Chainlink node based on the provided name func (c *ChainlinkClient) DeleteEI(name string) (*http.Response, error) { - log.Info().Str(NodeURL, c.Config.URL).Str("Name", name).Msg("Deleting EI") + c.l.Info().Str(NodeURL, c.Config.URL).Str("Name", name).Msg("Deleting EI") resp, err := c.APIClient.R(). SetPathParams(map[string]string{ "name": name, @@ -937,7 +945,7 @@ func (c *ChainlinkClient) DeleteEI(name string) (*http.Response, error) { // CreateCosmosChain creates a cosmos chain func (c *ChainlinkClient) CreateCosmosChain(chain *CosmosChainAttributes) (*CosmosChainCreate, *http.Response, error) { response := CosmosChainCreate{} - log.Info().Str(NodeURL, c.Config.URL).Str("Chain ID", chain.ChainID).Msg("Creating Cosmos Chain") + c.l.Info().Str(NodeURL, c.Config.URL).Str("Chain ID", chain.ChainID).Msg("Creating Cosmos Chain") resp, err := c.APIClient.R(). SetBody(chain). SetResult(&response). @@ -951,7 +959,7 @@ func (c *ChainlinkClient) CreateCosmosChain(chain *CosmosChainAttributes) (*Cosm // CreateCosmosNode creates a cosmos node func (c *ChainlinkClient) CreateCosmosNode(node *CosmosNodeAttributes) (*CosmosNodeCreate, *http.Response, error) { response := CosmosNodeCreate{} - log.Info().Str(NodeURL, c.Config.URL).Str("Name", node.Name).Msg("Creating Cosmos Node") + c.l.Info().Str(NodeURL, c.Config.URL).Str("Name", node.Name).Msg("Creating Cosmos Node") resp, err := c.APIClient.R(). SetBody(node). SetResult(&response). @@ -965,7 +973,7 @@ func (c *ChainlinkClient) CreateCosmosNode(node *CosmosNodeAttributes) (*CosmosN // CreateSolanaChain creates a solana chain func (c *ChainlinkClient) CreateSolanaChain(chain *SolanaChainAttributes) (*SolanaChainCreate, *http.Response, error) { response := SolanaChainCreate{} - log.Info().Str(NodeURL, c.Config.URL).Str("Chain ID", chain.ChainID).Msg("Creating Solana Chain") + c.l.Info().Str(NodeURL, c.Config.URL).Str("Chain ID", chain.ChainID).Msg("Creating Solana Chain") resp, err := c.APIClient.R(). SetBody(chain). SetResult(&response). @@ -979,7 +987,7 @@ func (c *ChainlinkClient) CreateSolanaChain(chain *SolanaChainAttributes) (*Sola // CreateSolanaNode creates a solana node func (c *ChainlinkClient) CreateSolanaNode(node *SolanaNodeAttributes) (*SolanaNodeCreate, *http.Response, error) { response := SolanaNodeCreate{} - log.Info().Str(NodeURL, c.Config.URL).Str("Name", node.Name).Msg("Creating Solana Node") + c.l.Info().Str(NodeURL, c.Config.URL).Str("Name", node.Name).Msg("Creating Solana Node") resp, err := c.APIClient.R(). SetBody(node). SetResult(&response). @@ -993,7 +1001,7 @@ func (c *ChainlinkClient) CreateSolanaNode(node *SolanaNodeAttributes) (*SolanaN // CreateStarkNetChain creates a starknet chain func (c *ChainlinkClient) CreateStarkNetChain(chain *StarkNetChainAttributes) (*StarkNetChainCreate, *http.Response, error) { response := StarkNetChainCreate{} - log.Info().Str(NodeURL, c.Config.URL).Str("Chain ID", chain.ChainID).Msg("Creating StarkNet Chain") + c.l.Info().Str(NodeURL, c.Config.URL).Str("Chain ID", chain.ChainID).Msg("Creating StarkNet Chain") resp, err := c.APIClient.R(). SetBody(chain). SetResult(&response). @@ -1007,7 +1015,7 @@ func (c *ChainlinkClient) CreateStarkNetChain(chain *StarkNetChainAttributes) (* // CreateStarkNetNode creates a starknet node func (c *ChainlinkClient) CreateStarkNetNode(node *StarkNetNodeAttributes) (*StarkNetNodeCreate, *http.Response, error) { response := StarkNetNodeCreate{} - log.Info().Str(NodeURL, c.Config.URL).Str("Name", node.Name).Msg("Creating StarkNet Node") + c.l.Info().Str(NodeURL, c.Config.URL).Str("Name", node.Name).Msg("Creating StarkNet Node") resp, err := c.APIClient.R(). SetBody(node). SetResult(&response). @@ -1030,14 +1038,14 @@ func (c *ChainlinkClient) Profile(profileTime time.Duration, profileFunction fun profileResults := NewBlankChainlinkProfileResults() profileErrorGroup := new(errgroup.Group) var profileExecutedGroup sync.WaitGroup - log.Info().Int("Seconds to Profile", profileSeconds).Str(NodeURL, c.Config.URL).Msg("Starting Node PPROF session") + c.l.Info().Int("Seconds to Profile", profileSeconds).Str(NodeURL, c.Config.URL).Msg("Starting Node PPROF session") for _, rep := range profileResults.Reports { profileExecutedGroup.Add(1) profileReport := rep // The profile function returns with the profile results after the profile time frame has concluded // e.g. a profile API call of 5 seconds will start profiling, wait for 5 seconds, then send back results profileErrorGroup.Go(func() error { - log.Debug().Str("Type", profileReport.Type).Msg("PROFILING") + c.l.Debug().Str("Type", profileReport.Type).Msg("PROFILING") profileExecutedGroup.Done() resp, err := c.APIClient.R(). SetPathParams(map[string]string{ @@ -1054,7 +1062,7 @@ func (c *ChainlinkClient) Profile(profileTime time.Duration, profileFunction fun if err != nil { return err } - log.Debug().Str("Type", profileReport.Type).Msg("DONE PROFILING") + c.l.Debug().Str("Type", profileReport.Type).Msg("DONE PROFILING") profileReport.Data = resp.Body() return err }) @@ -1070,12 +1078,12 @@ func (c *ChainlinkClient) Profile(profileTime time.Duration, profileFunction fun actualSeconds := int(actualRunTime.Seconds()) if actualSeconds > profileSeconds { - log.Warn(). + c.l.Warn(). Int("Actual Seconds", actualSeconds). Int("Profile Seconds", profileSeconds). Msg("Your profile function took longer than expected to run, increase profileTime") } else if actualSeconds < profileSeconds && actualSeconds > 0 { - log.Warn(). + c.l.Warn(). Int("Actual Seconds", actualSeconds). Int("Profile Seconds", profileSeconds). Msg("Your profile function took shorter than expected to run, you can decrease profileTime") @@ -1174,7 +1182,7 @@ func (c *ChainlinkClient) TrackForwarder(chainID *big.Int, address common.Addres ChainID: chainID.String(), Address: address.Hex(), } - log.Debug().Str(NodeURL, c.Config.URL). + c.l.Debug().Str(NodeURL, c.Config.URL). Str("Forwarder address", (address).Hex()). Str("Chain ID", chainID.String()). Msg("Track forwarder") @@ -1196,7 +1204,7 @@ func (c *ChainlinkClient) TrackForwarder(chainID *big.Int, address common.Addres // GetForwarders get list of tracked forwarders func (c *ChainlinkClient) GetForwarders() (*Forwarders, *http.Response, error) { response := &Forwarders{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Reading Tracked Forwarders") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Reading Tracked Forwarders") resp, err := c.APIClient.R(). SetResult(response). Get("/v2/nodes/evm/forwarders") diff --git a/integration-tests/contracts/ethereum_contracts.go b/integration-tests/contracts/ethereum_contracts.go index 763faecace7..9416c2a1492 100644 --- a/integration-tests/contracts/ethereum_contracts.go +++ b/integration-tests/contracts/ethereum_contracts.go @@ -11,6 +11,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" + "github.com/rs/zerolog" "github.com/rs/zerolog/log" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" "github.com/smartcontractkit/libocr/gethwrappers/offchainaggregator" @@ -1115,6 +1116,7 @@ type FluxAggregatorRoundConfirmer struct { context context.Context cancel context.CancelFunc complete bool + l zerolog.Logger } // NewFluxAggregatorRoundConfirmer provides a new instance of a FluxAggregatorRoundConfirmer @@ -1122,6 +1124,7 @@ func NewFluxAggregatorRoundConfirmer( contract FluxAggregator, roundID *big.Int, timeout time.Duration, + logger zerolog.Logger, ) *FluxAggregatorRoundConfirmer { ctx, ctxCancel := context.WithTimeout(context.Background(), timeout) return &FluxAggregatorRoundConfirmer{ @@ -1130,6 +1133,7 @@ func NewFluxAggregatorRoundConfirmer( doneChan: make(chan struct{}), context: ctx, cancel: ctxCancel, + l: logger, } } diff --git a/integration-tests/docker/test_env/cl_node.go b/integration-tests/docker/test_env/cl_node.go index 5ad0c4ab800..bdd0b951f53 100644 --- a/integration-tests/docker/test_env/cl_node.go +++ b/integration-tests/docker/test_env/cl_node.go @@ -291,6 +291,7 @@ func (n *ClNode) StartContainer() error { return errors.Wrap(err, ErrConnectNodeClient) } + clClient.WithLogger(n.l) clClient.Config.InternalIP = n.ContainerName n.Container = container n.API = clClient diff --git a/integration-tests/performance/flux_test.go b/integration-tests/performance/flux_test.go index c9c32b047ba..e63e2b41bff 100644 --- a/integration-tests/performance/flux_test.go +++ b/integration-tests/performance/flux_test.go @@ -115,7 +115,7 @@ func TestFluxPerformance(t *testing.T) { return } fluxRoundTimeout := 2 * time.Minute - fluxRound := contracts.NewFluxAggregatorRoundConfirmer(fluxInstance, big.NewInt(1), fluxRoundTimeout) + fluxRound := contracts.NewFluxAggregatorRoundConfirmer(fluxInstance, big.NewInt(1), fluxRoundTimeout, l) chainClient.AddHeaderEventSubscription(fluxInstance.Address(), fluxRound) err = chainClient.WaitForEvents() require.NoError(t, err, "Waiting for event subscriptions in nodes shouldn't fail") @@ -133,7 +133,7 @@ func TestFluxPerformance(t *testing.T) { require.Equal(t, int64(3), data.AllocatedFunds.Int64(), "Expected allocated funds to be %d, but found %d", int64(3), data.AllocatedFunds.Int64()) - fluxRound = contracts.NewFluxAggregatorRoundConfirmer(fluxInstance, big.NewInt(2), fluxRoundTimeout) + fluxRound = contracts.NewFluxAggregatorRoundConfirmer(fluxInstance, big.NewInt(2), fluxRoundTimeout, l) chainClient.AddHeaderEventSubscription(fluxInstance.Address(), fluxRound) err = mockServer.SetValuePath(adapterPath, 1e10) require.NoError(t, err, "Setting value path in mock server shouldn't fail") diff --git a/integration-tests/smoke/flux_test.go b/integration-tests/smoke/flux_test.go index d34879a75d7..5cf0d7485b8 100644 --- a/integration-tests/smoke/flux_test.go +++ b/integration-tests/smoke/flux_test.go @@ -106,7 +106,7 @@ func TestFluxBasic(t *testing.T) { // initial value set is performed before jobs creation fluxRoundTimeout := 1 * time.Minute - fluxRound := contracts.NewFluxAggregatorRoundConfirmer(fluxInstance, big.NewInt(1), fluxRoundTimeout) + fluxRound := contracts.NewFluxAggregatorRoundConfirmer(fluxInstance, big.NewInt(1), fluxRoundTimeout, l) env.EVMClient.AddHeaderEventSubscription(fluxInstance.Address(), fluxRound) err = env.EVMClient.WaitForEvents() require.NoError(t, err, "Waiting for event subscriptions in nodes shouldn't fail") @@ -123,7 +123,7 @@ func TestFluxBasic(t *testing.T) { require.Equal(t, int64(3), data.AllocatedFunds.Int64(), "Expected allocated funds to be %d, but found %d", int64(3), data.AllocatedFunds.Int64()) - fluxRound = contracts.NewFluxAggregatorRoundConfirmer(fluxInstance, big.NewInt(2), fluxRoundTimeout) + fluxRound = contracts.NewFluxAggregatorRoundConfirmer(fluxInstance, big.NewInt(2), fluxRoundTimeout, l) env.EVMClient.AddHeaderEventSubscription(fluxInstance.Address(), fluxRound) err = env.MockServer.Client.SetValuePath(adapterPath, 1e10) require.NoError(t, err, "Setting value path in mock server shouldn't fail") diff --git a/integration-tests/testsetups/ocr.go b/integration-tests/testsetups/ocr.go index 1c6c7f6b2b7..49de6f99d60 100644 --- a/integration-tests/testsetups/ocr.go +++ b/integration-tests/testsetups/ocr.go @@ -22,7 +22,6 @@ import ( "github.com/kelseyhightower/envconfig" "github.com/pelletier/go-toml/v2" "github.com/rs/zerolog" - "github.com/rs/zerolog/log" "github.com/stretchr/testify/require" "github.com/smartcontractkit/chainlink-env/environment" @@ -424,7 +423,7 @@ func (o *OCRSoakTest) Resume() { StartTime: time.Now(), Message: "Test Resumed", }) - log.Info(). + o.log.Info(). Str("Total Duration", o.Inputs.TestDuration.String()). Str("Time Left", o.timeLeft.String()). Msg("Resuming OCR Soak Test") @@ -447,7 +446,7 @@ func (o *OCRSoakTest) Resume() { o.log.Info().Msg("Test Complete, collecting on-chain events") err = o.collectEvents() - log.Error().Err(err).Interface("Query", o.filterQuery).Msg("Error collecting on-chain events, expect malformed report") + o.log.Error().Err(err).Interface("Query", o.filterQuery).Msg("Error collecting on-chain events, expect malformed report") o.TestReporter.RecordEvents(o.ocrRoundStates, o.testIssues) } @@ -485,7 +484,7 @@ func (o *OCRSoakTest) testLoop(testDuration time.Duration, newValue int) { if err := o.SaveState(); err != nil { o.log.Error().Err(err).Msg("Error saving state") } - log.Warn().Str("Time Taken", time.Since(saveStart).String()).Msg("Saved state") + o.log.Warn().Str("Time Taken", time.Since(saveStart).String()).Msg("Saved state") os.Exit(2) // Exit with code 2 to indicate test was interrupted, not just a normal failure case <-endTest: return @@ -526,7 +525,7 @@ func (o *OCRSoakTest) complete() { err := o.collectEvents() if err != nil { - log.Error().Err(err).Interface("Query", o.filterQuery).Msg("Error collecting on-chain events, expect malformed report") + o.log.Error().Err(err).Interface("Query", o.filterQuery).Msg("Error collecting on-chain events, expect malformed report") } o.TestReporter.RecordEvents(o.ocrRoundStates, o.testIssues) } @@ -544,7 +543,7 @@ func (o *OCRSoakTest) setFilterQuery() { Topics: [][]common.Hash{{contractABI.Events["AnswerUpdated"].ID}}, FromBlock: big.NewInt(0).SetUint64(o.startingBlockNum), } - log.Debug(). + o.log.Debug(). Interface("Addresses", ocrAddresses). Str("Topic", contractABI.Events["AnswerUpdated"].ID.Hex()). Uint64("Starting Block", o.startingBlockNum). @@ -569,7 +568,7 @@ func (o *OCRSoakTest) observeOCREvents() error { case event := <-eventLogs: answerUpdated, err := o.ocrInstances[0].ParseEventAnswerUpdated(event) if err != nil { - log.Warn(). + o.log.Warn(). Err(err). Str("Address", event.Address.Hex()). Uint64("Block Number", event.BlockNumber). @@ -634,18 +633,18 @@ func (o *OCRSoakTest) collectEvents() error { // We must retrieve the events, use exponential backoff for timeout to retry timeout := time.Second * 15 - log.Info().Interface("Filter Query", o.filterQuery).Str("Timeout", timeout.String()).Msg("Retrieving on-chain events") + o.log.Info().Interface("Filter Query", o.filterQuery).Str("Timeout", timeout.String()).Msg("Retrieving on-chain events") ctx, cancel := context.WithTimeout(context.Background(), timeout) contractEvents, err := o.chainClient.FilterLogs(ctx, o.filterQuery) cancel() for err != nil { - log.Info().Interface("Filter Query", o.filterQuery).Str("Timeout", timeout.String()).Msg("Retrieving on-chain events") + o.log.Info().Interface("Filter Query", o.filterQuery).Str("Timeout", timeout.String()).Msg("Retrieving on-chain events") ctx, cancel := context.WithTimeout(context.Background(), timeout) contractEvents, err = o.chainClient.FilterLogs(ctx, o.filterQuery) cancel() if err != nil { - log.Warn().Interface("Filter Query", o.filterQuery).Str("Timeout", timeout.String()).Msg("Error collecting on-chain events, trying again") + o.log.Warn().Interface("Filter Query", o.filterQuery).Str("Timeout", timeout.String()).Msg("Error collecting on-chain events, trying again") timeout *= 2 } } From 91383d29a90f68358c7992cb992df3eeb8e3bb2f Mon Sep 17 00:00:00 2001 From: Tate Date: Wed, 13 Sep 2023 11:45:02 -0600 Subject: [PATCH 4/8] More improvements to the logging --- integration-tests/benchmark/keeper_test.go | 2 +- integration-tests/chaos/automation_chaos_test.go | 2 +- integration-tests/chaos/ocr2vrf_chaos_test.go | 2 +- integration-tests/chaos/ocr_chaos_test.go | 2 +- integration-tests/contracts/ethereum_contracts.go | 4 ++-- integration-tests/docker/test_env/test_env_builder.go | 2 +- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- integration-tests/load/functions/setup.go | 2 +- integration-tests/performance/directrequest_test.go | 2 +- integration-tests/performance/flux_test.go | 2 +- integration-tests/performance/keeper_test.go | 3 ++- integration-tests/performance/ocr_test.go | 5 +++-- integration-tests/performance/vrf_test.go | 2 +- integration-tests/reorg/automation_reorg_test.go | 2 +- integration-tests/reorg/reorg_test.go | 3 ++- integration-tests/smoke/ocr2vrf_test.go | 4 ++-- integration-tests/testsetups/don_evm_chain.go | 7 +++++-- integration-tests/testsetups/ocr.go | 6 +++--- 19 files changed, 32 insertions(+), 26 deletions(-) diff --git a/integration-tests/benchmark/keeper_test.go b/integration-tests/benchmark/keeper_test.go index dca7b61bf83..59406e51583 100644 --- a/integration-tests/benchmark/keeper_test.go +++ b/integration-tests/benchmark/keeper_test.go @@ -153,7 +153,7 @@ func TestAutomationBenchmark(t *testing.T) { l.Info().Str("Namespace", testEnvironment.Cfg.Namespace).Msg("Connected to Keepers Benchmark Environment") - chainClient, err := blockchain.NewEVMClient(benchmarkNetwork, testEnvironment) + chainClient, err := blockchain.NewEVMClient(benchmarkNetwork, testEnvironment, l) require.NoError(t, err, "Error connecting to blockchain") registryVersions := addRegistry(RegistryToTest) keeperBenchmarkTest := testsetups.NewKeeperBenchmarkTest( diff --git a/integration-tests/chaos/automation_chaos_test.go b/integration-tests/chaos/automation_chaos_test.go index 00ad8d3d41e..1b45d5dd716 100644 --- a/integration-tests/chaos/automation_chaos_test.go +++ b/integration-tests/chaos/automation_chaos_test.go @@ -201,7 +201,7 @@ func TestAutomationChaos(t *testing.T) { err = testEnvironment.Client.LabelChaosGroup(testEnvironment.Cfg.Namespace, "instance=", 2, 5, ChaosGroupMajorityPlus) require.NoError(t, err) - chainClient, err := blockchain.NewEVMClient(network, testEnvironment) + chainClient, err := blockchain.NewEVMClient(network, testEnvironment, l) require.NoError(t, err, "Error connecting to blockchain") contractDeployer, err := contracts.NewContractDeployer(chainClient) require.NoError(t, err, "Error building contract deployer") diff --git a/integration-tests/chaos/ocr2vrf_chaos_test.go b/integration-tests/chaos/ocr2vrf_chaos_test.go index 876424626c0..8199163e5b6 100644 --- a/integration-tests/chaos/ocr2vrf_chaos_test.go +++ b/integration-tests/chaos/ocr2vrf_chaos_test.go @@ -140,7 +140,7 @@ func TestOCR2VRFChaos(t *testing.T) { err = testEnvironment.Client.LabelChaosGroup(testEnvironment.Cfg.Namespace, "instance=", 3, 5, ChaosGroupMajority) require.NoError(t, err) - chainClient, err := blockchain.NewEVMClient(testNetwork, testEnvironment) + chainClient, err := blockchain.NewEVMClient(testNetwork, testEnvironment, l) require.NoError(t, err, "Error connecting to blockchain") contractDeployer, err := contracts.NewContractDeployer(chainClient) require.NoError(t, err, "Error building contract deployer") diff --git a/integration-tests/chaos/ocr_chaos_test.go b/integration-tests/chaos/ocr_chaos_test.go index 6a4ec63c309..4ce25a4f39e 100644 --- a/integration-tests/chaos/ocr_chaos_test.go +++ b/integration-tests/chaos/ocr_chaos_test.go @@ -153,7 +153,7 @@ func TestOCRChaos(t *testing.T) { err = testEnvironment.Client.LabelChaosGroup(testEnvironment.Cfg.Namespace, "instance=", 2, 5, ChaosGroupMajorityPlus) require.NoError(t, err) - chainClient, err := blockchain.NewEVMClient(blockchain.SimulatedEVMNetwork, testEnvironment) + chainClient, err := blockchain.NewEVMClient(blockchain.SimulatedEVMNetwork, testEnvironment, l) require.NoError(t, err, "Connecting to blockchain nodes shouldn't fail") cd, err := contracts.NewContractDeployer(chainClient) require.NoError(t, err, "Deploying contracts shouldn't fail") diff --git a/integration-tests/contracts/ethereum_contracts.go b/integration-tests/contracts/ethereum_contracts.go index 9416c2a1492..c2f0733cde3 100644 --- a/integration-tests/contracts/ethereum_contracts.go +++ b/integration-tests/contracts/ethereum_contracts.go @@ -1153,11 +1153,11 @@ func (f *FluxAggregatorRoundConfirmer) ReceiveHeader(header blockchain.NodeHeade "Header Number": header.Number.Uint64(), } if lr.Cmp(f.roundID) >= 0 { - log.Info().Fields(logFields).Msg("FluxAggregator round completed") + f.l.Info().Fields(logFields).Msg("FluxAggregator round completed") f.complete = true f.doneChan <- struct{}{} } else { - log.Debug().Fields(logFields).Msg("Waiting for FluxAggregator round") + f.l.Debug().Fields(logFields).Msg("Waiting for FluxAggregator round") } return nil } diff --git a/integration-tests/docker/test_env/test_env_builder.go b/integration-tests/docker/test_env/test_env_builder.go index f8524663f7b..1bdf52de915 100644 --- a/integration-tests/docker/test_env/test_env_builder.go +++ b/integration-tests/docker/test_env/test_env_builder.go @@ -182,7 +182,7 @@ func (b *CLTestEnvBuilder) buildNewEnv(cfg *TestEnvConfig) (*CLClusterTestEnv, e } - bc, err := blockchain.NewEVMClientFromNetwork(networkConfig) + bc, err := blockchain.NewEVMClientFromNetwork(networkConfig, b.l) if err != nil { return nil, err } diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 4cc70633e4e..8122ab283ee 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -20,7 +20,7 @@ require ( github.com/rs/zerolog v1.30.0 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-env v0.36.0 - github.com/smartcontractkit/chainlink-testing-framework v1.16.9-0.20230913150728-98e8ec8d6561 + github.com/smartcontractkit/chainlink-testing-framework v1.16.9-0.20230913173230-737b5d5c1e01 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20230816220705-665e93233ae5 github.com/smartcontractkit/ocr2keepers v0.7.23 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 46c80c77431..cd0f4cdce28 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -2258,8 +2258,8 @@ github.com/smartcontractkit/chainlink-solana v1.0.3-0.20230831134610-680240b97ac github.com/smartcontractkit/chainlink-solana v1.0.3-0.20230831134610-680240b97aca/go.mod h1:RIUJXn7EVp24TL2p4FW79dYjyno23x5mjt1nKN+5WEk= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20230901115736-bbabe542a918 h1:ByVauKFXphRlSNG47lNuxZ9aicu+r8AoNp933VRPpCw= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20230901115736-bbabe542a918/go.mod h1:/yp/sqD8Iz5GU5fcercjrw0ivJF7HDcupYg+Gjr7EPg= -github.com/smartcontractkit/chainlink-testing-framework v1.16.9-0.20230913150728-98e8ec8d6561 h1:YYjZf4G1JXK+QntTFHdhMe0NyIdFfhGdzHc8EhDdjIo= -github.com/smartcontractkit/chainlink-testing-framework v1.16.9-0.20230913150728-98e8ec8d6561/go.mod h1:Ry6fRPr8TwrIsYVNEF1pguAgzE3QW1s54tbLWnFtfI4= +github.com/smartcontractkit/chainlink-testing-framework v1.16.9-0.20230913173230-737b5d5c1e01 h1:ODe3YR4lQnXciiq1pMY16wrKpFpYqTC0c1aJsMb9hjM= +github.com/smartcontractkit/chainlink-testing-framework v1.16.9-0.20230913173230-737b5d5c1e01/go.mod h1:Ry6fRPr8TwrIsYVNEF1pguAgzE3QW1s54tbLWnFtfI4= github.com/smartcontractkit/go-plugin v0.0.0-20230605132010-0f4d515d1472 h1:x3kNwgFlDmbE/n0gTSRMt9GBDfsfGrs4X9b9arPZtFI= github.com/smartcontractkit/go-plugin v0.0.0-20230605132010-0f4d515d1472/go.mod h1:6/1TEzT0eQznvI/gV2CM29DLSkAK/e58mUWKVsPaph0= github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f h1:hgJif132UCdjo8u43i7iPN1/MFnu49hv7lFGFftCHKU= diff --git a/integration-tests/load/functions/setup.go b/integration-tests/load/functions/setup.go index 60986595b9f..bdff1bb2578 100644 --- a/integration-tests/load/functions/setup.go +++ b/integration-tests/load/functions/setup.go @@ -50,7 +50,7 @@ type S4SecretsCfg struct { } func SetupLocalLoadTestEnv(cfg *PerformanceConfig) (*FunctionsTest, error) { - bc, err := blockchain.NewEVMClientFromNetwork(networks.SelectedNetwork) + bc, err := blockchain.NewEVMClientFromNetwork(networks.SelectedNetwork, log.Logger) if err != nil { return nil, err } diff --git a/integration-tests/performance/directrequest_test.go b/integration-tests/performance/directrequest_test.go index 8e308176c94..9c20ba27ebe 100644 --- a/integration-tests/performance/directrequest_test.go +++ b/integration-tests/performance/directrequest_test.go @@ -36,7 +36,7 @@ func TestDirectRequestPerformance(t *testing.T) { return } - chainClient, err := blockchain.NewEVMClient(blockchain.SimulatedEVMNetwork, testEnvironment) + chainClient, err := blockchain.NewEVMClient(blockchain.SimulatedEVMNetwork, testEnvironment, l) require.NoError(t, err, "Connecting to blockchain nodes shouldn't fail") contractDeployer, err := contracts.NewContractDeployer(chainClient) require.NoError(t, err, "Deploying contracts shouldn't fail") diff --git a/integration-tests/performance/flux_test.go b/integration-tests/performance/flux_test.go index e63e2b41bff..00de909276c 100644 --- a/integration-tests/performance/flux_test.go +++ b/integration-tests/performance/flux_test.go @@ -35,7 +35,7 @@ func TestFluxPerformance(t *testing.T) { return } - chainClient, err := blockchain.NewEVMClient(testNetwork, testEnvironment) + chainClient, err := blockchain.NewEVMClient(testNetwork, testEnvironment, l) require.NoError(t, err, "Connecting to blockchain nodes shouldn't fail") contractDeployer, err := contracts.NewContractDeployer(chainClient) require.NoError(t, err, "Deploying contracts shouldn't fail") diff --git a/integration-tests/performance/keeper_test.go b/integration-tests/performance/keeper_test.go index c9e105e9f4e..e488b76c660 100644 --- a/integration-tests/performance/keeper_test.go +++ b/integration-tests/performance/keeper_test.go @@ -173,7 +173,8 @@ PerformGasOverhead = 150_000` return testEnvironment, nil, nil, nil, nil } - chainClient, err := blockchain.NewEVMClient(network, testEnvironment) + l := logging.GetTestLogger(t) + chainClient, err := blockchain.NewEVMClient(network, testEnvironment, l) require.NoError(t, err, "Connecting to blockchain nodes shouldn't fail") contractDeployer, err := contracts.NewContractDeployer(chainClient) require.NoError(t, err, "Deploying contracts shouldn't fail") diff --git a/integration-tests/performance/ocr_test.go b/integration-tests/performance/ocr_test.go index d056d58e30b..24bf7a2837e 100644 --- a/integration-tests/performance/ocr_test.go +++ b/integration-tests/performance/ocr_test.go @@ -17,6 +17,7 @@ import ( mockservercfg "github.com/smartcontractkit/chainlink-env/pkg/helm/mockserver-cfg" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" ctfClient "github.com/smartcontractkit/chainlink-testing-framework/client" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/networks" @@ -32,8 +33,8 @@ func TestOCRBasic(t *testing.T) { if testEnvironment.WillUseRemoteRunner() { return } - - chainClient, err := blockchain.NewEVMClient(testNetwork, testEnvironment) + l := logging.GetTestLogger(t) + chainClient, err := blockchain.NewEVMClient(testNetwork, testEnvironment, l) require.NoError(t, err, "Connecting to blockchain nodes shouldn't fail") contractDeployer, err := contracts.NewContractDeployer(chainClient) require.NoError(t, err, "Deploying contracts shouldn't fail") diff --git a/integration-tests/performance/vrf_test.go b/integration-tests/performance/vrf_test.go index a5e40265040..6e738ce812a 100644 --- a/integration-tests/performance/vrf_test.go +++ b/integration-tests/performance/vrf_test.go @@ -33,7 +33,7 @@ func TestVRFBasic(t *testing.T) { return } - chainClient, err := blockchain.NewEVMClient(testNetwork, testEnvironment) + chainClient, err := blockchain.NewEVMClient(testNetwork, testEnvironment, l) require.NoError(t, err, "Connecting client shouldn't fail") cd, err := contracts.NewContractDeployer(chainClient) require.NoError(t, err, "Deploying contracts shouldn't fail") diff --git a/integration-tests/reorg/automation_reorg_test.go b/integration-tests/reorg/automation_reorg_test.go index d0f08855da3..5aacadc41d3 100644 --- a/integration-tests/reorg/automation_reorg_test.go +++ b/integration-tests/reorg/automation_reorg_test.go @@ -147,7 +147,7 @@ func TestAutomationReorg(t *testing.T) { return } - chainClient, err := blockchain.NewEVMClient(network, testEnvironment) + chainClient, err := blockchain.NewEVMClient(network, testEnvironment, l) require.NoError(t, err, "Error connecting to blockchain") contractDeployer, err := contracts.NewContractDeployer(chainClient) require.NoError(t, err, "Error building contract deployer") diff --git a/integration-tests/reorg/reorg_test.go b/integration-tests/reorg/reorg_test.go index c944b7a7539..fe390a3764c 100644 --- a/integration-tests/reorg/reorg_test.go +++ b/integration-tests/reorg/reorg_test.go @@ -91,6 +91,7 @@ func CleanupReorgTest( func TestDirectRequestReorg(t *testing.T) { logging.Init() + l := logging.GetTestLogger(t) testEnvironment := environment.New(&environment.Config{ TTL: 1 * time.Hour, Test: t, @@ -131,7 +132,7 @@ func TestDirectRequestReorg(t *testing.T) { err = testEnvironment.AddHelmCharts(chainlinkDeployment).Run() require.NoError(t, err, "Error adding to test environment") - chainClient, err := blockchain.NewEVMClient(networkSettings, testEnvironment) + chainClient, err := blockchain.NewEVMClient(networkSettings, testEnvironment, l) require.NoError(t, err, "Error connecting to blockchain") cd, err := contracts.NewContractDeployer(chainClient) require.NoError(t, err, "Error building contract deployer") diff --git a/integration-tests/smoke/ocr2vrf_test.go b/integration-tests/smoke/ocr2vrf_test.go index fa55bf98659..f57178d4b73 100644 --- a/integration-tests/smoke/ocr2vrf_test.go +++ b/integration-tests/smoke/ocr2vrf_test.go @@ -34,7 +34,7 @@ func TestOCR2VRFRedeemModel(t *testing.T) { return } - chainClient, err := blockchain.NewEVMClient(testNetwork, testEnvironment) + chainClient, err := blockchain.NewEVMClient(testNetwork, testEnvironment, l) require.NoError(t, err, "Error connecting to blockchain") contractDeployer, err := contracts.NewContractDeployer(chainClient) require.NoError(t, err, "Error building contract deployer") @@ -96,7 +96,7 @@ func TestOCR2VRFFulfillmentModel(t *testing.T) { return } - chainClient, err := blockchain.NewEVMClient(testNetwork, testEnvironment) + chainClient, err := blockchain.NewEVMClient(testNetwork, testEnvironment, l) require.NoError(t, err, "Error connecting to blockchain") contractDeployer, err := contracts.NewContractDeployer(chainClient) require.NoError(t, err, "Error building contract deployer") diff --git a/integration-tests/testsetups/don_evm_chain.go b/integration-tests/testsetups/don_evm_chain.go index a9e69b32f49..13d5a415f8b 100644 --- a/integration-tests/testsetups/don_evm_chain.go +++ b/integration-tests/testsetups/don_evm_chain.go @@ -3,6 +3,7 @@ package testsetups import ( "testing" + "github.com/rs/zerolog" "github.com/stretchr/testify/require" e "github.com/smartcontractkit/chainlink-env/environment" @@ -25,6 +26,7 @@ type DonChain struct { LinkTokenContract contracts.LinkToken ChainlinkNodes []*client.ChainlinkK8sClient Mockserver *ctfClient.MockserverClient + l zerolog.Logger } type DonChainConfig struct { @@ -35,10 +37,11 @@ type DonChainConfig struct { ChainlinkValues map[string]interface{} } -func NewDonChain(conf *DonChainConfig) *DonChain { +func NewDonChain(conf *DonChainConfig, logger zerolog.Logger) *DonChain { return &DonChain{ conf: conf, EVMNetwork: conf.EVMNetwork, + l: logger, } } @@ -59,7 +62,7 @@ func (s *DonChain) Deploy() { func (s *DonChain) initializeClients() { var err error network := *s.conf.EVMNetwork - s.EVMClient, err = blockchain.NewEVMClient(network, s.conf.Env) + s.EVMClient, err = blockchain.NewEVMClient(network, s.conf.Env, s.l) require.NoError(s.conf.T, err, "Connecting to blockchain nodes shouldn't fail") s.ContractDeployer, err = contracts.NewContractDeployer(s.EVMClient) diff --git a/integration-tests/testsetups/ocr.go b/integration-tests/testsetups/ocr.go index 49de6f99d60..e5e97fc5a3e 100644 --- a/integration-tests/testsetups/ocr.go +++ b/integration-tests/testsetups/ocr.go @@ -164,7 +164,7 @@ func (o *OCRSoakTest) LoadEnvironment(chainlinkURLs []string, chainURL, mockServ network = networks.SelectedNetwork err error ) - o.chainClient, err = blockchain.ConnectEVMClient(network) + o.chainClient, err = blockchain.ConnectEVMClient(network, o.log) require.NoError(o.t, err, "Error connecting to EVM client") chainlinkNodes, err := client.ConnectChainlinkNodeURLs(chainlinkURLs) require.NoError(o.t, err, "Error connecting to chainlink nodes") @@ -186,7 +186,7 @@ func (o *OCRSoakTest) Setup() { // Environment currently being used to soak test on // Make connections to soak test resources - o.chainClient, err = blockchain.NewEVMClient(network, o.testEnvironment) + o.chainClient, err = blockchain.NewEVMClient(network, o.testEnvironment, o.log) require.NoError(o.t, err, "Error creating EVM client") contractDeployer, err := contracts.NewContractDeployer(o.chainClient) require.NoError(o.t, err, "Unable to create contract deployer") @@ -384,7 +384,7 @@ func (o *OCRSoakTest) LoadState() error { o.startingBlockNum = testState.StartingBlockNum network := networks.SelectedNetwork - o.chainClient, err = blockchain.ConnectEVMClient(network) + o.chainClient, err = blockchain.ConnectEVMClient(network, o.log) if err != nil { return err } From e04c63825c56bc9e9d6c7895638cf09b14dd188d Mon Sep 17 00:00:00 2001 From: Tate Date: Wed, 13 Sep 2023 14:11:40 -0600 Subject: [PATCH 5/8] merge conflict fixes --- integration-tests/docker/test_env/test_env.go | 2 +- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/integration-tests/docker/test_env/test_env.go b/integration-tests/docker/test_env/test_env.go index d6a175270d7..fb6b0adb466 100644 --- a/integration-tests/docker/test_env/test_env.go +++ b/integration-tests/docker/test_env/test_env.go @@ -98,7 +98,7 @@ func (te *CLClusterTestEnv) WithPrivateChain(evmNetworks []blockchain.EVMNetwork n := evmNetwork pgc := test_env.NewPrivateGethChain(&n, []string{te.Network.Name}) if te.t != nil { - pgc.WithTestLogger(te.t) + pgc.GetPrimaryNode().WithTestLogger(te.t) } chains = append(chains, pgc) var privateChain test_env.PrivateChain diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 448ec407cc1..32d77d52539 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -20,7 +20,7 @@ require ( github.com/rs/zerolog v1.30.0 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-env v0.36.0 - github.com/smartcontractkit/chainlink-testing-framework v1.16.9-0.20230913173230-737b5d5c1e01 + github.com/smartcontractkit/chainlink-testing-framework v1.16.9-0.20230913200453-9dad8d418161 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20230816220705-665e93233ae5 github.com/smartcontractkit/ocr2keepers v0.7.23 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 3d120b43e51..fb49d562234 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -2258,8 +2258,8 @@ github.com/smartcontractkit/chainlink-solana v1.0.3-0.20230831134610-680240b97ac github.com/smartcontractkit/chainlink-solana v1.0.3-0.20230831134610-680240b97aca/go.mod h1:RIUJXn7EVp24TL2p4FW79dYjyno23x5mjt1nKN+5WEk= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20230901115736-bbabe542a918 h1:ByVauKFXphRlSNG47lNuxZ9aicu+r8AoNp933VRPpCw= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20230901115736-bbabe542a918/go.mod h1:/yp/sqD8Iz5GU5fcercjrw0ivJF7HDcupYg+Gjr7EPg= -github.com/smartcontractkit/chainlink-testing-framework v1.16.9-0.20230913173230-737b5d5c1e01 h1:ODe3YR4lQnXciiq1pMY16wrKpFpYqTC0c1aJsMb9hjM= -github.com/smartcontractkit/chainlink-testing-framework v1.16.9-0.20230913173230-737b5d5c1e01/go.mod h1:Ry6fRPr8TwrIsYVNEF1pguAgzE3QW1s54tbLWnFtfI4= +github.com/smartcontractkit/chainlink-testing-framework v1.16.9-0.20230913200453-9dad8d418161 h1:aGjUrDpAdzHkfaflsEzHdw6rV1pHmFuDcwKd0NzolhY= +github.com/smartcontractkit/chainlink-testing-framework v1.16.9-0.20230913200453-9dad8d418161/go.mod h1:Ry6fRPr8TwrIsYVNEF1pguAgzE3QW1s54tbLWnFtfI4= github.com/smartcontractkit/go-plugin v0.0.0-20230605132010-0f4d515d1472 h1:x3kNwgFlDmbE/n0gTSRMt9GBDfsfGrs4X9b9arPZtFI= github.com/smartcontractkit/go-plugin v0.0.0-20230605132010-0f4d515d1472/go.mod h1:6/1TEzT0eQznvI/gV2CM29DLSkAK/e58mUWKVsPaph0= github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f h1:hgJif132UCdjo8u43i7iPN1/MFnu49hv7lFGFftCHKU= From 6f5b0ec10ccd8e3394baadd45e451e94c50c8066 Mon Sep 17 00:00:00 2001 From: Tate Date: Wed, 13 Sep 2023 15:04:19 -0600 Subject: [PATCH 6/8] Cover more missing cases --- integration-tests/actions/ocr2_helpers.go | 4 +- integration-tests/actions/ocr_helpers.go | 4 +- integration-tests/chaos/ocr2vrf_chaos_test.go | 2 +- .../contracts/contract_deployer.go | 34 ++++++++----- .../contracts/contract_loader.go | 22 +++++---- .../contracts/ethereum_contracts.go | 48 ++++++++++++------- .../contracts/ethereum_keeper_contracts.go | 44 ++++++++++------- .../docker/test_env/test_env_builder.go | 4 +- integration-tests/load/functions/setup.go | 2 +- .../performance/directrequest_test.go | 2 +- integration-tests/performance/flux_test.go | 2 +- integration-tests/performance/keeper_test.go | 2 +- integration-tests/performance/ocr_test.go | 6 +-- integration-tests/performance/vrf_test.go | 2 +- .../reorg/automation_reorg_test.go | 2 +- integration-tests/reorg/reorg_test.go | 2 +- .../smoke/forwarders_ocr2_test.go | 4 +- integration-tests/smoke/ocr2_test.go | 4 +- integration-tests/smoke/ocr2vrf_test.go | 4 +- integration-tests/smoke/ocr_test.go | 4 +- integration-tests/testsetups/don_evm_chain.go | 2 +- .../testsetups/keeper_benchmark.go | 3 +- integration-tests/testsetups/ocr.go | 6 +-- 23 files changed, 126 insertions(+), 83 deletions(-) diff --git a/integration-tests/actions/ocr2_helpers.go b/integration-tests/actions/ocr2_helpers.go index 3c37233a0d3..293ea2b73c0 100644 --- a/integration-tests/actions/ocr2_helpers.go +++ b/integration-tests/actions/ocr2_helpers.go @@ -10,6 +10,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/lib/pq" + "github.com/rs/zerolog" "github.com/rs/zerolog/log" "golang.org/x/sync/errgroup" "gopkg.in/guregu/null.v4" @@ -360,13 +361,14 @@ func StartNewOCR2Round( ocrInstances []contracts.OffchainAggregatorV2, client blockchain.EVMClient, timeout time.Duration, + logger zerolog.Logger, ) error { for i := 0; i < len(ocrInstances); i++ { err := ocrInstances[i].RequestNewRound() if err != nil { return fmt.Errorf("requesting new OCR round %d have failed: %w", i+1, err) } - ocrRound := contracts.NewOffchainAggregatorV2RoundConfirmer(ocrInstances[i], big.NewInt(roundNumber), timeout) + ocrRound := contracts.NewOffchainAggregatorV2RoundConfirmer(ocrInstances[i], big.NewInt(roundNumber), timeout, logger) client.AddHeaderEventSubscription(ocrInstances[i].Address(), ocrRound) err = client.WaitForEvents() if err != nil { diff --git a/integration-tests/actions/ocr_helpers.go b/integration-tests/actions/ocr_helpers.go index bff96c73042..713578acbb8 100644 --- a/integration-tests/actions/ocr_helpers.go +++ b/integration-tests/actions/ocr_helpers.go @@ -8,6 +8,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/google/uuid" + "github.com/rs/zerolog" "github.com/stretchr/testify/require" "golang.org/x/sync/errgroup" @@ -320,13 +321,14 @@ func StartNewRound( roundNumber int64, ocrInstances []contracts.OffchainAggregator, client blockchain.EVMClient, + logger zerolog.Logger, ) error { for i := 0; i < len(ocrInstances); i++ { err := ocrInstances[i].RequestNewRound() if err != nil { return fmt.Errorf("requesting new OCR round %d have failed: %w", i+1, err) } - ocrRound := contracts.NewOffchainAggregatorRoundConfirmer(ocrInstances[i], big.NewInt(roundNumber), client.GetNetworkConfig().Timeout.Duration) + ocrRound := contracts.NewOffchainAggregatorRoundConfirmer(ocrInstances[i], big.NewInt(roundNumber), client.GetNetworkConfig().Timeout.Duration, logger) client.AddHeaderEventSubscription(ocrInstances[i].Address(), ocrRound) err = client.WaitForEvents() if err != nil { diff --git a/integration-tests/chaos/ocr2vrf_chaos_test.go b/integration-tests/chaos/ocr2vrf_chaos_test.go index 8199163e5b6..fd51fa55db5 100644 --- a/integration-tests/chaos/ocr2vrf_chaos_test.go +++ b/integration-tests/chaos/ocr2vrf_chaos_test.go @@ -142,7 +142,7 @@ func TestOCR2VRFChaos(t *testing.T) { chainClient, err := blockchain.NewEVMClient(testNetwork, testEnvironment, l) require.NoError(t, err, "Error connecting to blockchain") - contractDeployer, err := contracts.NewContractDeployer(chainClient) + contractDeployer, err := contracts.NewContractDeployer(chainClient, l) require.NoError(t, err, "Error building contract deployer") chainlinkNodes, err := client.ConnectChainlinkNodes(testEnvironment) require.NoError(t, err, "Error connecting to Chainlink nodes") diff --git a/integration-tests/contracts/contract_deployer.go b/integration-tests/contracts/contract_deployer.go index 4c4d2b87a81..a3adb6db13a 100644 --- a/integration-tests/contracts/contract_deployer.go +++ b/integration-tests/contracts/contract_deployer.go @@ -9,6 +9,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" + "github.com/rs/zerolog" "github.com/rs/zerolog/log" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" "github.com/smartcontractkit/libocr/gethwrappers/offchainaggregator" @@ -116,30 +117,30 @@ type ContractDeployer interface { } // NewContractDeployer returns an instance of a contract deployer based on the client type -func NewContractDeployer(bcClient blockchain.EVMClient) (ContractDeployer, error) { +func NewContractDeployer(bcClient blockchain.EVMClient, logger zerolog.Logger) (ContractDeployer, error) { switch clientImpl := bcClient.Get().(type) { case *blockchain.EthereumClient: - return NewEthereumContractDeployer(clientImpl), nil + return NewEthereumContractDeployer(clientImpl, logger), nil case *blockchain.KlaytnClient: - return &KlaytnContractDeployer{NewEthereumContractDeployer(clientImpl)}, nil + return &KlaytnContractDeployer{NewEthereumContractDeployer(clientImpl, logger)}, nil case *blockchain.MetisClient: - return &MetisContractDeployer{NewEthereumContractDeployer(clientImpl)}, nil + return &MetisContractDeployer{NewEthereumContractDeployer(clientImpl, logger)}, nil case *blockchain.ArbitrumClient: - return &MetisContractDeployer{NewEthereumContractDeployer(clientImpl)}, nil + return &MetisContractDeployer{NewEthereumContractDeployer(clientImpl, logger)}, nil case *blockchain.OptimismClient: - return &OptimismContractDeployer{NewEthereumContractDeployer(clientImpl)}, nil + return &OptimismContractDeployer{NewEthereumContractDeployer(clientImpl, logger)}, nil case *blockchain.RSKClient: - return &RSKContractDeployer{NewEthereumContractDeployer(clientImpl)}, nil + return &RSKContractDeployer{NewEthereumContractDeployer(clientImpl, logger)}, nil case *blockchain.PolygonClient: - return &PolygonContractDeployer{NewEthereumContractDeployer(clientImpl)}, nil + return &PolygonContractDeployer{NewEthereumContractDeployer(clientImpl, logger)}, nil case *blockchain.CeloClient: - return &CeloContractDeployer{NewEthereumContractDeployer(clientImpl)}, nil + return &CeloContractDeployer{NewEthereumContractDeployer(clientImpl, logger)}, nil case *blockchain.QuorumClient: - return &QuorumContractDeployer{NewEthereumContractDeployer(clientImpl)}, nil + return &QuorumContractDeployer{NewEthereumContractDeployer(clientImpl, logger)}, nil case *blockchain.BSCClient: - return &BSCContractDeployer{NewEthereumContractDeployer(clientImpl)}, nil + return &BSCContractDeployer{NewEthereumContractDeployer(clientImpl, logger)}, nil case *blockchain.ScrollClient: - return &ScrollContractDeployer{NewEthereumContractDeployer(clientImpl)}, nil + return &ScrollContractDeployer{NewEthereumContractDeployer(clientImpl, logger)}, nil } return nil, errors.New("unknown blockchain client implementation for contract deployer, register blockchain client in NewContractDeployer") } @@ -147,6 +148,7 @@ func NewContractDeployer(bcClient blockchain.EVMClient) (ContractDeployer, error // EthereumContractDeployer provides the implementations for deploying ETH (EVM) based contracts type EthereumContractDeployer struct { client blockchain.EVMClient + l zerolog.Logger } // KlaytnContractDeployer wraps ethereum contract deployments for Klaytn @@ -195,9 +197,10 @@ type ScrollContractDeployer struct { } // NewEthereumContractDeployer returns an instantiated instance of the ETH contract deployer -func NewEthereumContractDeployer(ethClient blockchain.EVMClient) *EthereumContractDeployer { +func NewEthereumContractDeployer(ethClient blockchain.EVMClient, logger zerolog.Logger) *EthereumContractDeployer { return &EthereumContractDeployer{ client: ethClient, + l: logger, } } @@ -451,6 +454,7 @@ func (e *EthereumContractDeployer) DeployLinkTokenContract() (LinkToken, error) client: e.client, instance: instance.(*link_token_interface.LinkToken), address: *linkTokenAddress, + l: e.l, }, err } @@ -469,6 +473,7 @@ func (e *EthereumContractDeployer) LoadLinkToken(address common.Address) (LinkTo address: address, client: e.client, instance: instance.(*link_token_interface.LinkToken), + l: e.l, }, err } @@ -551,6 +556,7 @@ func (e *EthereumContractDeployer) DeployOffChainAggregator( client: e.client, ocr: instance.(*offchainaggregator.OffchainAggregator), address: address, + l: e.l, }, err } @@ -569,6 +575,7 @@ func (e *EthereumContractDeployer) LoadOffChainAggregator(address *common.Addres address: address, client: e.client, ocr: instance.(*offchainaggregator.OffchainAggregator), + l: e.l, }, err } @@ -1423,5 +1430,6 @@ func (e *EthereumContractDeployer) DeployOffchainAggregatorV2( client: e.client, contract: instance.(*ocr2aggregator.OCR2Aggregator), address: address, + l: e.l, }, err } diff --git a/integration-tests/contracts/contract_loader.go b/integration-tests/contracts/contract_loader.go index 2c079a61b8b..a790747e38d 100644 --- a/integration-tests/contracts/contract_loader.go +++ b/integration-tests/contracts/contract_loader.go @@ -5,6 +5,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" + "github.com/rs/zerolog" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/functions/generated/functions_coordinator" @@ -34,20 +35,20 @@ type ContractLoader interface { } // NewContractLoader returns an instance of a contract Loader based on the client type -func NewContractLoader(bcClient blockchain.EVMClient) (ContractLoader, error) { +func NewContractLoader(bcClient blockchain.EVMClient, logger zerolog.Logger) (ContractLoader, error) { switch clientImpl := bcClient.Get().(type) { case *blockchain.EthereumClient: - return NewEthereumContractLoader(clientImpl), nil + return NewEthereumContractLoader(clientImpl, logger), nil case *blockchain.KlaytnClient: - return &KlaytnContractLoader{NewEthereumContractLoader(clientImpl)}, nil + return &KlaytnContractLoader{NewEthereumContractLoader(clientImpl, logger)}, nil case *blockchain.MetisClient: - return &MetisContractLoader{NewEthereumContractLoader(clientImpl)}, nil + return &MetisContractLoader{NewEthereumContractLoader(clientImpl, logger)}, nil case *blockchain.ArbitrumClient: - return &ArbitrumContractLoader{NewEthereumContractLoader(clientImpl)}, nil + return &ArbitrumContractLoader{NewEthereumContractLoader(clientImpl, logger)}, nil case *blockchain.PolygonClient: - return &PolygonContractLoader{NewEthereumContractLoader(clientImpl)}, nil + return &PolygonContractLoader{NewEthereumContractLoader(clientImpl, logger)}, nil case *blockchain.OptimismClient: - return &OptimismContractLoader{NewEthereumContractLoader(clientImpl)}, nil + return &OptimismContractLoader{NewEthereumContractLoader(clientImpl, logger)}, nil } return nil, errors.New("unknown blockchain client implementation for contract Loader, register blockchain client in NewContractLoader") } @@ -55,6 +56,7 @@ func NewContractLoader(bcClient blockchain.EVMClient) (ContractLoader, error) { // EthereumContractLoader provides the implementations for deploying ETH (EVM) based contracts type EthereumContractLoader struct { client blockchain.EVMClient + l zerolog.Logger } // KlaytnContractLoader wraps ethereum contract deployments for Klaytn @@ -83,9 +85,10 @@ type OptimismContractLoader struct { } // NewEthereumContractLoader returns an instantiated instance of the ETH contract Loader -func NewEthereumContractLoader(ethClient blockchain.EVMClient) *EthereumContractLoader { +func NewEthereumContractLoader(ethClient blockchain.EVMClient, logger zerolog.Logger) *EthereumContractLoader { return &EthereumContractLoader{ client: ethClient, + l: logger, } } @@ -104,6 +107,7 @@ func (e *EthereumContractLoader) LoadLINKToken(addr string) (LinkToken, error) { client: e.client, instance: instance.(*link_token_interface.LinkToken), address: common.HexToAddress(addr), + l: e.l, }, err } @@ -140,6 +144,7 @@ func (e *EthereumContractLoader) LoadFunctionsRouter(addr string) (FunctionsRout client: e.client, instance: instance.(*functions_router.FunctionsRouter), address: common.HexToAddress(addr), + l: e.l, }, err } @@ -176,6 +181,7 @@ func (e *EthereumContractLoader) LoadOperatorContract(address common.Address) (O address: address, client: e.client, operator: instance.(*operator_wrapper.Operator), + l: e.l, }, err } diff --git a/integration-tests/contracts/ethereum_contracts.go b/integration-tests/contracts/ethereum_contracts.go index c2f0733cde3..d11eefecd47 100644 --- a/integration-tests/contracts/ethereum_contracts.go +++ b/integration-tests/contracts/ethereum_contracts.go @@ -1185,6 +1185,7 @@ type EthereumLinkToken struct { client blockchain.EVMClient instance *link_token_interface.LinkToken address common.Address + l zerolog.Logger } // Fund the LINK Token contract with ETH to distribute the token @@ -1226,7 +1227,7 @@ func (l *EthereumLinkToken) Approve(to string, amount *big.Int) error { if err != nil { return err } - log.Info(). + l.l.Info(). Str("From", l.client.GetDefaultWallet().Address()). Str("To", to). Str("Amount", amount.String()). @@ -1244,7 +1245,7 @@ func (l *EthereumLinkToken) Transfer(to string, amount *big.Int) error { if err != nil { return err } - log.Info(). + l.l.Info(). Str("From", l.client.GetDefaultWallet().Address()). Str("To", to). Str("Amount", amount.String()). @@ -1266,7 +1267,7 @@ func (l *EthereumLinkToken) TransferAndCall(to string, amount *big.Int, data []b if err != nil { return nil, err } - log.Info(). + l.l.Info(). Str("From", l.client.GetDefaultWallet().Address()). Str("To", to). Str("Amount", amount.String()). @@ -1281,6 +1282,7 @@ type EthereumOffchainAggregator struct { client blockchain.EVMClient ocr *offchainaggregator.OffchainAggregator address *common.Address + l zerolog.Logger } // Fund sends specified currencies to the contract @@ -1326,7 +1328,7 @@ func (o *EthereumOffchainAggregator) SetPayees( payeesAddr = append(payeesAddr, common.HexToAddress(p)) } - log.Info(). + o.l.Info(). Str("Transmitters", fmt.Sprintf("%v", transmitters)). Str("Payees", fmt.Sprintf("%v", payees)). Str("OCR Address", o.Address()). @@ -1434,7 +1436,7 @@ func (o *EthereumOffchainAggregator) RequestNewRound() error { if err != nil { return err } - log.Info().Str("Contract Address", o.address.Hex()).Msg("New OCR round requested") + o.l.Info().Str("Contract Address", o.address.Hex()).Msg("New OCR round requested") return o.client.ProcessTransaction(tx) } @@ -1516,6 +1518,7 @@ type RunlogRoundConfirmer struct { doneChan chan struct{} context context.Context cancel context.CancelFunc + l zerolog.Logger } // NewRunlogRoundConfirmer provides a new instance of a RunlogRoundConfirmer @@ -1523,6 +1526,7 @@ func NewRunlogRoundConfirmer( contract APIConsumer, roundID *big.Int, timeout time.Duration, + logger zerolog.Logger, ) *RunlogRoundConfirmer { ctx, ctxCancel := context.WithTimeout(context.Background(), timeout) return &RunlogRoundConfirmer{ @@ -1531,6 +1535,7 @@ func NewRunlogRoundConfirmer( doneChan: make(chan struct{}), context: ctx, cancel: ctxCancel, + l: logger, } } @@ -1546,10 +1551,10 @@ func (o *RunlogRoundConfirmer) ReceiveHeader(_ blockchain.NodeHeader) error { "Waiting for Round": o.roundID.Int64(), } if currentRoundID.Cmp(o.roundID) >= 0 { - log.Info().Fields(logFields).Msg("Runlog round completed") + o.l.Info().Fields(logFields).Msg("Runlog round completed") o.doneChan <- struct{}{} } else { - log.Debug().Fields(logFields).Msg("Waiting for Runlog round") + o.l.Debug().Fields(logFields).Msg("Waiting for Runlog round") } return nil } @@ -1576,6 +1581,7 @@ type OffchainAggregatorRoundConfirmer struct { cancel context.CancelFunc blocksSinceAnswer uint complete bool + l zerolog.Logger } // NewOffchainAggregatorRoundConfirmer provides a new instance of a OffchainAggregatorRoundConfirmer @@ -1583,6 +1589,7 @@ func NewOffchainAggregatorRoundConfirmer( contract OffchainAggregator, roundID *big.Int, timeout time.Duration, + logger zerolog.Logger, ) *OffchainAggregatorRoundConfirmer { ctx, ctxCancel := context.WithTimeout(context.Background(), timeout) return &OffchainAggregatorRoundConfirmer{ @@ -1592,6 +1599,7 @@ func NewOffchainAggregatorRoundConfirmer( context: ctx, cancel: ctxCancel, complete: false, + l: logger, } } @@ -1613,11 +1621,11 @@ func (o *OffchainAggregatorRoundConfirmer) ReceiveHeader(_ blockchain.NodeHeader "Waiting for Round": o.roundID.Int64(), } if currRound.Cmp(o.roundID) >= 0 { - log.Info().Fields(logFields).Msg("OCR round completed") + o.l.Info().Fields(logFields).Msg("OCR round completed") o.doneChan <- struct{}{} o.complete = true } else { - log.Debug().Fields(logFields).Msg("Waiting on OCR Round") + o.l.Debug().Fields(logFields).Msg("Waiting on OCR Round") } return nil } @@ -1650,6 +1658,7 @@ type OffchainAggregatorV2RoundConfirmer struct { cancel context.CancelFunc blocksSinceAnswer uint complete bool + l zerolog.Logger } // NewOffchainAggregatorRoundConfirmer provides a new instance of a OffchainAggregatorRoundConfirmer @@ -1657,6 +1666,7 @@ func NewOffchainAggregatorV2RoundConfirmer( contract OffchainAggregatorV2, roundID *big.Int, timeout time.Duration, + logger zerolog.Logger, ) *OffchainAggregatorV2RoundConfirmer { ctx, ctxCancel := context.WithTimeout(context.Background(), timeout) return &OffchainAggregatorV2RoundConfirmer{ @@ -1666,6 +1676,7 @@ func NewOffchainAggregatorV2RoundConfirmer( context: ctx, cancel: ctxCancel, complete: false, + l: logger, } } @@ -1687,11 +1698,11 @@ func (o *OffchainAggregatorV2RoundConfirmer) ReceiveHeader(_ blockchain.NodeHead "Waiting for Round": o.roundID.Int64(), } if currRound.Cmp(o.roundID) >= 0 { - log.Info().Fields(logFields).Msg("OCR round completed") + o.l.Info().Fields(logFields).Msg("OCR round completed") o.doneChan <- struct{}{} o.complete = true } else { - log.Debug().Fields(logFields).Msg("Waiting on OCR Round") + o.l.Debug().Fields(logFields).Msg("Waiting on OCR Round") } return nil } @@ -1819,6 +1830,7 @@ type EthereumOperator struct { address common.Address client blockchain.EVMClient operator *operator_wrapper.Operator + l zerolog.Logger } func (e *EthereumOperator) Address() string { @@ -1830,7 +1842,7 @@ func (e *EthereumOperator) AcceptAuthorizedReceivers(forwarders []common.Address if err != nil { return err } - log.Info(). + e.l.Info(). Str("ForwardersAddresses", fmt.Sprint(forwarders)). Str("EoaAddresses", fmt.Sprint(eoa)). Msg("Accepting Authorized Receivers") @@ -1927,6 +1939,7 @@ type EthereumOffchainAggregatorV2 struct { address *common.Address client blockchain.EVMClient contract *ocr2aggregator.OCR2Aggregator + l zerolog.Logger } // OCRv2Config represents the config for the OCRv2 contract @@ -2012,7 +2025,7 @@ func (e *EthereumOffchainAggregatorV2) SetPayees(transmitters, payees []string) if err != nil { return err } - log.Info(). + e.l.Info(). Str("Transmitters", fmt.Sprintf("%v", transmitters)). Str("Payees", fmt.Sprintf("%v", payees)). Str("OCRv2 Address", e.Address()). @@ -2038,7 +2051,7 @@ func (e *EthereumOffchainAggregatorV2) SetConfig(ocrConfig *OCRv2Config) error { if err != nil { return err } - log.Info(). + e.l.Info(). Str("Address", e.Address()). Interface("Signers", ocrConfig.Signers). Interface("Transmitters", ocrConfig.Transmitters). @@ -2095,6 +2108,7 @@ type EthereumFunctionsRouter struct { address common.Address client blockchain.EVMClient instance *functions_router.FunctionsRouter + l zerolog.Logger } func (e *EthereumFunctionsRouter) Address() string { @@ -2118,7 +2132,7 @@ func (e *EthereumFunctionsRouter) CreateSubscriptionWithConsumer(consumer string return 0, err } for _, l := range r.Logs { - log.Info().Interface("Log", common.Bytes2Hex(l.Data)).Send() + e.l.Info().Interface("Log", common.Bytes2Hex(l.Data)).Send() } topicsMap := map[string]interface{}{} @@ -2127,14 +2141,14 @@ func (e *EthereumFunctionsRouter) CreateSubscriptionWithConsumer(consumer string return 0, err } for _, ev := range fabi.Events { - log.Info().Str("EventName", ev.Name).Send() + e.l.Info().Str("EventName", ev.Name).Send() } topicOneInputs := abi.Arguments{fabi.Events["SubscriptionCreated"].Inputs[0]} topicOneHash := []common.Hash{r.Logs[0].Topics[1:][0]} if err := abi.ParseTopicsIntoMap(topicsMap, topicOneInputs, topicOneHash); err != nil { return 0, errors.Wrap(err, "failed to decode topic value") } - log.Info().Interface("NewTopicsDecoded", topicsMap).Send() + e.l.Info().Interface("NewTopicsDecoded", topicsMap).Send() if topicsMap["subscriptionId"] == 0 { return 0, errors.New("failed to decode subscription ID after creation") } diff --git a/integration-tests/contracts/ethereum_keeper_contracts.go b/integration-tests/contracts/ethereum_keeper_contracts.go index 67d26960585..afb6550bd2c 100644 --- a/integration-tests/contracts/ethereum_keeper_contracts.go +++ b/integration-tests/contracts/ethereum_keeper_contracts.go @@ -15,7 +15,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" - "github.com/rs/zerolog/log" + "github.com/rs/zerolog" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" goabi "github.com/umbracle/ethgo/abi" @@ -204,6 +204,7 @@ type EthereumKeeperRegistry struct { registry2_0 *keeper_registry_wrapper2_0.KeeperRegistry registry2_1 *i_keeper_registry_master_wrapper_2_1.IKeeperRegistryMaster address *common.Address + l zerolog.Logger } func (v *EthereumKeeperRegistry) Address() string { @@ -777,7 +778,7 @@ func (v *EthereumKeeperRegistry) CancelUpkeep(id *big.Int) error { } } - log.Info(). + v.l.Info(). Str("Upkeep ID", strconv.FormatInt(id.Int64(), 10)). Str("From", v.client.GetDefaultWallet().Address()). Str("TX Hash", tx.Hash().String()). @@ -1132,6 +1133,7 @@ type KeeperConsumerRoundConfirmer struct { doneChan chan struct{} context context.Context cancel context.CancelFunc + l zerolog.Logger } // NewKeeperConsumerRoundConfirmer provides a new instance of a KeeperConsumerRoundConfirmer @@ -1139,6 +1141,7 @@ func NewKeeperConsumerRoundConfirmer( contract KeeperConsumer, counterValue int, timeout time.Duration, + logger zerolog.Logger, ) *KeeperConsumerRoundConfirmer { ctx, ctxCancel := context.WithTimeout(context.Background(), timeout) return &KeeperConsumerRoundConfirmer{ @@ -1147,6 +1150,7 @@ func NewKeeperConsumerRoundConfirmer( doneChan: make(chan struct{}), context: ctx, cancel: ctxCancel, + l: logger, } } @@ -1156,7 +1160,7 @@ func (o *KeeperConsumerRoundConfirmer) ReceiveHeader(_ blockchain.NodeHeader) er if err != nil { return err } - l := log.Info(). + l := o.l.Info(). Str("Contract Address", o.instance.Address()). Int64("Upkeeps", upkeeps.Int64()). Int("Required upkeeps", o.upkeepsValue) @@ -1200,6 +1204,7 @@ type KeeperConsumerPerformanceRoundConfirmer struct { metricsReporter *testreporters.KeeperBlockTimeTestReporter // Testreporter to track results complete bool + l zerolog.Logger } // NewKeeperConsumerPerformanceRoundConfirmer provides a new instance of a KeeperConsumerPerformanceRoundConfirmer @@ -1209,6 +1214,7 @@ func NewKeeperConsumerPerformanceRoundConfirmer( expectedBlockCadence int64, // Expected to upkeep every 5/10/20 blocks, for example blockRange int64, metricsReporter *testreporters.KeeperBlockTimeTestReporter, + logger zerolog.Logger, ) *KeeperConsumerPerformanceRoundConfirmer { ctx, cancelFunc := context.WithCancel(context.Background()) return &KeeperConsumerPerformanceRoundConfirmer{ @@ -1226,6 +1232,7 @@ func NewKeeperConsumerPerformanceRoundConfirmer( metricsReporter: metricsReporter, complete: false, lastBlockNum: 0, + l: logger, } } @@ -1248,22 +1255,22 @@ func (o *KeeperConsumerPerformanceRoundConfirmer) ReceiveHeader(receivedHeader b return err } if isEligible { - log.Trace(). + o.l.Trace(). Str("Contract Address", o.instance.Address()). Int64("Upkeeps Performed", upkeepCount.Int64()). Msg("Upkeep Now Eligible") } if upkeepCount.Int64() >= o.expectedUpkeepCount { // Upkeep was successful if o.blocksSinceSuccessfulUpkeep < o.blockCadence { // If there's an early upkeep, that's weird - log.Error(). + o.l.Error(). Str("Contract Address", o.instance.Address()). Int64("Upkeeps Performed", upkeepCount.Int64()). Int64("Expected Cadence", o.blockCadence). Int64("Actual Cadence", o.blocksSinceSuccessfulUpkeep). - Err(errors.New("Found an early Upkeep")) - return fmt.Errorf("Found an early Upkeep on contract %s", o.instance.Address()) + Err(errors.New("found an early Upkeep")) + return fmt.Errorf("found an early Upkeep on contract %s", o.instance.Address()) } else if o.blocksSinceSuccessfulUpkeep == o.blockCadence { // Perfectly timed upkeep - log.Info(). + o.l.Info(). Str("Contract Address", o.instance.Address()). Int64("Upkeeps Performed", upkeepCount.Int64()). Int64("Expected Cadence", o.blockCadence). @@ -1271,7 +1278,7 @@ func (o *KeeperConsumerPerformanceRoundConfirmer) ReceiveHeader(receivedHeader b Msg("Successful Upkeep on Expected Cadence") o.totalSuccessfulUpkeeps++ } else { // Late upkeep - log.Warn(). + o.l.Warn(). Str("Contract Address", o.instance.Address()). Int64("Upkeeps Performed", upkeepCount.Int64()). Int64("Expected Cadence", o.blockCadence). @@ -1286,7 +1293,7 @@ func (o *KeeperConsumerPerformanceRoundConfirmer) ReceiveHeader(receivedHeader b if o.blocksSinceSubscription > o.blockRange { if o.blocksSinceSuccessfulUpkeep > o.blockCadence { - log.Warn(). + o.l.Warn(). Str("Contract Address", o.instance.Address()). Int64("Upkeeps Performed", upkeepCount.Int64()). Int64("Expected Cadence", o.blockCadence). @@ -1296,7 +1303,7 @@ func (o *KeeperConsumerPerformanceRoundConfirmer) ReceiveHeader(receivedHeader b Msg("Finished Watching for Upkeeps While Waiting on a Late Upkeep") o.allMissedUpkeeps = append(o.allMissedUpkeeps, o.blocksSinceSuccessfulUpkeep-o.blockCadence) } else { - log.Info(). + o.l.Info(). Str("Contract Address", o.instance.Address()). Int64("Upkeeps Performed", upkeepCount.Int64()). Int64("Total Blocks Watched", o.blocksSinceSubscription). @@ -1365,6 +1372,7 @@ type KeeperConsumerBenchmarkRoundConfirmer struct { upkeepCount int64 // The count of upkeeps done so far allCheckDelays []int64 // Tracks the amount of blocks missed before an upkeep since it became eligible complete bool + l zerolog.Logger } // NewKeeperConsumerBenchmarkRoundConfirmer provides a new instance of a KeeperConsumerBenchmarkRoundConfirmer @@ -1378,6 +1386,7 @@ func NewKeeperConsumerBenchmarkRoundConfirmer( metricsReporter *testreporters.KeeperBenchmarkTestReporter, upkeepIndex int64, firstEligibleuffer int64, + logger zerolog.Logger, ) *KeeperConsumerBenchmarkRoundConfirmer { ctx, cancelFunc := context.WithCancel(context.Background()) return &KeeperConsumerBenchmarkRoundConfirmer{ @@ -1399,6 +1408,7 @@ func NewKeeperConsumerBenchmarkRoundConfirmer( upkeepIndex: upkeepIndex, firstBlockNum: 0, firstEligibleuffer: firstEligibleuffer, + l: logger, } } @@ -1423,7 +1433,7 @@ func (o *KeeperConsumerBenchmarkRoundConfirmer) ReceiveHeader(receivedHeader blo if upkeepCount.Int64() != o.upkeepCount+1 { return errors.New("upkeep count increased by more than 1 in a single block") } - log.Info(). + o.l.Info(). Uint64("Block_Number", receivedHeader.Number.Uint64()). Str("Upkeep_ID", o.upkeepID.String()). Str("Contract_Address", o.instance.Address()). @@ -1433,7 +1443,7 @@ func (o *KeeperConsumerBenchmarkRoundConfirmer) ReceiveHeader(receivedHeader blo Msg("Upkeep Performed") if o.blocksSinceEligible > o.upkeepSLA { - log.Warn(). + o.l.Warn(). Uint64("Block_Number", receivedHeader.Number.Uint64()). Str("Upkeep_ID", o.upkeepID.String()). Str("Contract_Address", o.instance.Address()). @@ -1456,7 +1466,7 @@ func (o *KeeperConsumerBenchmarkRoundConfirmer) ReceiveHeader(receivedHeader blo if o.blocksSinceEligible == 0 { // First time this upkeep became eligible o.countEligible++ - log.Info(). + o.l.Info(). Uint64("Block_Number", receivedHeader.Number.Uint64()). Str("Upkeep_ID", o.upkeepID.String()). Str("Contract_Address", o.instance.Address()). @@ -1469,7 +1479,7 @@ func (o *KeeperConsumerBenchmarkRoundConfirmer) ReceiveHeader(receivedHeader blo if o.blocksSinceSubscription >= o.blockRange || int64(o.lastBlockNum-o.firstBlockNum) >= o.blockRange { if o.blocksSinceEligible > 0 { if o.blocksSinceEligible > o.upkeepSLA { - log.Warn(). + o.l.Warn(). Uint64("Block_Number", receivedHeader.Number.Uint64()). Str("Upkeep_ID", o.upkeepID.String()). Str("Contract_Address", o.instance.Address()). @@ -1478,7 +1488,7 @@ func (o *KeeperConsumerBenchmarkRoundConfirmer) ReceiveHeader(receivedHeader blo Msg("Upkeep remained eligible at end of test and missed SLA") o.countMissed++ } else { - log.Info(). + o.l.Info(). Uint64("Block_Number", receivedHeader.Number.Uint64()). Str("Upkeep_ID", o.upkeepID.String()). Str("Contract_Address", o.instance.Address()). @@ -1490,7 +1500,7 @@ func (o *KeeperConsumerBenchmarkRoundConfirmer) ReceiveHeader(receivedHeader blo o.allCheckDelays = append(o.allCheckDelays, o.blocksSinceEligible) } - log.Info(). + o.l.Info(). Uint64("Block_Number", receivedHeader.Number.Uint64()). Str("Upkeep_ID", o.upkeepID.String()). Str("Contract_Address", o.instance.Address()). diff --git a/integration-tests/docker/test_env/test_env_builder.go b/integration-tests/docker/test_env/test_env_builder.go index 9f55ce047eb..f3944b0ba96 100644 --- a/integration-tests/docker/test_env/test_env_builder.go +++ b/integration-tests/docker/test_env/test_env_builder.go @@ -194,13 +194,13 @@ func (b *CLTestEnvBuilder) buildNewEnv(cfg *TestEnvConfig) (*CLClusterTestEnv, e te.EVMClient = bc - cd, err := contracts.NewContractDeployer(bc) + cd, err := contracts.NewContractDeployer(bc, b.l) if err != nil { return nil, err } te.ContractDeployer = cd - cl, err := contracts.NewContractLoader(bc) + cl, err := contracts.NewContractLoader(bc, b.l) if err != nil { return nil, err } diff --git a/integration-tests/load/functions/setup.go b/integration-tests/load/functions/setup.go index bdff1bb2578..6801e2ede59 100644 --- a/integration-tests/load/functions/setup.go +++ b/integration-tests/load/functions/setup.go @@ -54,7 +54,7 @@ func SetupLocalLoadTestEnv(cfg *PerformanceConfig) (*FunctionsTest, error) { if err != nil { return nil, err } - cd, err := contracts.NewContractDeployer(bc) + cd, err := contracts.NewContractDeployer(bc, log.Logger) if err != nil { return nil, err } diff --git a/integration-tests/performance/directrequest_test.go b/integration-tests/performance/directrequest_test.go index 9c20ba27ebe..38a8565a3b9 100644 --- a/integration-tests/performance/directrequest_test.go +++ b/integration-tests/performance/directrequest_test.go @@ -38,7 +38,7 @@ func TestDirectRequestPerformance(t *testing.T) { chainClient, err := blockchain.NewEVMClient(blockchain.SimulatedEVMNetwork, testEnvironment, l) require.NoError(t, err, "Connecting to blockchain nodes shouldn't fail") - contractDeployer, err := contracts.NewContractDeployer(chainClient) + contractDeployer, err := contracts.NewContractDeployer(chainClient, l) require.NoError(t, err, "Deploying contracts shouldn't fail") chainlinkNodes, err := client.ConnectChainlinkNodes(testEnvironment) require.NoError(t, err, "Connecting to chainlink nodes shouldn't fail") diff --git a/integration-tests/performance/flux_test.go b/integration-tests/performance/flux_test.go index 00de909276c..04a5331d9ae 100644 --- a/integration-tests/performance/flux_test.go +++ b/integration-tests/performance/flux_test.go @@ -37,7 +37,7 @@ func TestFluxPerformance(t *testing.T) { chainClient, err := blockchain.NewEVMClient(testNetwork, testEnvironment, l) require.NoError(t, err, "Connecting to blockchain nodes shouldn't fail") - contractDeployer, err := contracts.NewContractDeployer(chainClient) + contractDeployer, err := contracts.NewContractDeployer(chainClient, l) require.NoError(t, err, "Deploying contracts shouldn't fail") chainlinkNodes, err := client.ConnectChainlinkNodes(testEnvironment) require.NoError(t, err, "Connecting to chainlink nodes shouldn't fail") diff --git a/integration-tests/performance/keeper_test.go b/integration-tests/performance/keeper_test.go index e488b76c660..8a587714dd8 100644 --- a/integration-tests/performance/keeper_test.go +++ b/integration-tests/performance/keeper_test.go @@ -176,7 +176,7 @@ PerformGasOverhead = 150_000` l := logging.GetTestLogger(t) chainClient, err := blockchain.NewEVMClient(network, testEnvironment, l) require.NoError(t, err, "Connecting to blockchain nodes shouldn't fail") - contractDeployer, err := contracts.NewContractDeployer(chainClient) + contractDeployer, err := contracts.NewContractDeployer(chainClient, l) require.NoError(t, err, "Deploying contracts shouldn't fail") chainlinkNodes, err := client.ConnectChainlinkNodes(testEnvironment) require.NoError(t, err, "Connecting to chainlink nodes shouldn't fail") diff --git a/integration-tests/performance/ocr_test.go b/integration-tests/performance/ocr_test.go index 24bf7a2837e..3a133b69d30 100644 --- a/integration-tests/performance/ocr_test.go +++ b/integration-tests/performance/ocr_test.go @@ -36,7 +36,7 @@ func TestOCRBasic(t *testing.T) { l := logging.GetTestLogger(t) chainClient, err := blockchain.NewEVMClient(testNetwork, testEnvironment, l) require.NoError(t, err, "Connecting to blockchain nodes shouldn't fail") - contractDeployer, err := contracts.NewContractDeployer(chainClient) + contractDeployer, err := contracts.NewContractDeployer(chainClient, l) require.NoError(t, err, "Deploying contracts shouldn't fail") chainlinkNodes, err := client.ConnectChainlinkNodes(testEnvironment) @@ -61,7 +61,7 @@ func TestOCRBasic(t *testing.T) { profileFunction := func(chainlinkNode *client.ChainlinkClient) { err = actions.CreateOCRJobs(ocrInstances, bootstrapNode, workerNodes, 5, mockServer) require.NoError(t, err) - err = actions.StartNewRound(1, ocrInstances, chainClient) + err = actions.StartNewRound(1, ocrInstances, chainClient, l) require.NoError(t, err) answer, err := ocrInstances[0].GetLatestAnswer(context.Background()) @@ -70,7 +70,7 @@ func TestOCRBasic(t *testing.T) { err = mockServer.SetValuePath("ocr", 10) require.NoError(t, err) - err = actions.StartNewRound(2, ocrInstances, chainClient) + err = actions.StartNewRound(2, ocrInstances, chainClient, l) require.NoError(t, err) answer, err = ocrInstances[0].GetLatestAnswer(context.Background()) diff --git a/integration-tests/performance/vrf_test.go b/integration-tests/performance/vrf_test.go index 6e738ce812a..af3a3ecba81 100644 --- a/integration-tests/performance/vrf_test.go +++ b/integration-tests/performance/vrf_test.go @@ -35,7 +35,7 @@ func TestVRFBasic(t *testing.T) { chainClient, err := blockchain.NewEVMClient(testNetwork, testEnvironment, l) require.NoError(t, err, "Connecting client shouldn't fail") - cd, err := contracts.NewContractDeployer(chainClient) + cd, err := contracts.NewContractDeployer(chainClient, l) require.NoError(t, err, "Deploying contracts shouldn't fail") chainlinkNodes, err := client.ConnectChainlinkNodes(testEnvironment) require.NoError(t, err, "Connecting to chainlink nodes shouldn't fail") diff --git a/integration-tests/reorg/automation_reorg_test.go b/integration-tests/reorg/automation_reorg_test.go index 5aacadc41d3..ab439e59f29 100644 --- a/integration-tests/reorg/automation_reorg_test.go +++ b/integration-tests/reorg/automation_reorg_test.go @@ -149,7 +149,7 @@ func TestAutomationReorg(t *testing.T) { chainClient, err := blockchain.NewEVMClient(network, testEnvironment, l) require.NoError(t, err, "Error connecting to blockchain") - contractDeployer, err := contracts.NewContractDeployer(chainClient) + contractDeployer, err := contracts.NewContractDeployer(chainClient, l) require.NoError(t, err, "Error building contract deployer") chainlinkNodes, err := client.ConnectChainlinkNodes(testEnvironment) require.NoError(t, err, "Error connecting to Chainlink nodes") diff --git a/integration-tests/reorg/reorg_test.go b/integration-tests/reorg/reorg_test.go index fe390a3764c..8174735b29c 100644 --- a/integration-tests/reorg/reorg_test.go +++ b/integration-tests/reorg/reorg_test.go @@ -134,7 +134,7 @@ func TestDirectRequestReorg(t *testing.T) { chainClient, err := blockchain.NewEVMClient(networkSettings, testEnvironment, l) require.NoError(t, err, "Error connecting to blockchain") - cd, err := contracts.NewContractDeployer(chainClient) + cd, err := contracts.NewContractDeployer(chainClient, l) require.NoError(t, err, "Error building contract deployer") chainlinkNodes, err := client.ConnectChainlinkNodes(testEnvironment) require.NoError(t, err, "Error connecting to Chainlink nodes") diff --git a/integration-tests/smoke/forwarders_ocr2_test.go b/integration-tests/smoke/forwarders_ocr2_test.go index 59276f936ab..c5fb7740756 100644 --- a/integration-tests/smoke/forwarders_ocr2_test.go +++ b/integration-tests/smoke/forwarders_ocr2_test.go @@ -90,7 +90,7 @@ func TestForwarderOCR2Basic(t *testing.T) { err = actions.ConfigureOCRv2AggregatorContracts(env.EVMClient, ocrv2Config, ocrInstances) require.NoError(t, err, "Error configuring OCRv2 aggregator contracts") - err = actions.StartNewOCR2Round(1, ocrInstances, env.EVMClient, time.Minute*10) + err = actions.StartNewOCR2Round(1, ocrInstances, env.EVMClient, time.Minute*10, l) require.NoError(t, err) answer, err := ocrInstances[0].GetLatestAnswer(context.Background()) @@ -101,7 +101,7 @@ func TestForwarderOCR2Basic(t *testing.T) { ocrRoundVal := (5 + i) % 10 err = env.MockServer.Client.SetValuePath("ocr2", ocrRoundVal) require.NoError(t, err) - err = actions.StartNewOCR2Round(int64(i), ocrInstances, env.EVMClient, time.Minute*10) + err = actions.StartNewOCR2Round(int64(i), ocrInstances, env.EVMClient, time.Minute*10, l) require.NoError(t, err) answer, err = ocrInstances[0].GetLatestAnswer(context.Background()) diff --git a/integration-tests/smoke/ocr2_test.go b/integration-tests/smoke/ocr2_test.go index 649bd7626ce..611eddb104e 100644 --- a/integration-tests/smoke/ocr2_test.go +++ b/integration-tests/smoke/ocr2_test.go @@ -81,7 +81,7 @@ func TestOCRv2Basic(t *testing.T) { err = actions.ConfigureOCRv2AggregatorContracts(env.EVMClient, ocrv2Config, aggregatorContracts) require.NoError(t, err, "Error configuring OCRv2 aggregator contracts") - err = actions.StartNewOCR2Round(1, aggregatorContracts, env.EVMClient, time.Minute*5) + err = actions.StartNewOCR2Round(1, aggregatorContracts, env.EVMClient, time.Minute*5, l) require.NoError(t, err, "Error starting new OCR2 round") roundData, err := aggregatorContracts[0].GetRound(context.Background(), big.NewInt(1)) require.NoError(t, err, "Getting latest answer from OCR contract shouldn't fail") @@ -92,7 +92,7 @@ func TestOCRv2Basic(t *testing.T) { err = env.MockServer.Client.SetValuePath("ocr2", 10) require.NoError(t, err) - err = actions.StartNewOCR2Round(2, aggregatorContracts, env.EVMClient, time.Minute*5) + err = actions.StartNewOCR2Round(2, aggregatorContracts, env.EVMClient, time.Minute*5, l) require.NoError(t, err) roundData, err = aggregatorContracts[0].GetRound(context.Background(), big.NewInt(2)) diff --git a/integration-tests/smoke/ocr2vrf_test.go b/integration-tests/smoke/ocr2vrf_test.go index f57178d4b73..c9f689ca7ae 100644 --- a/integration-tests/smoke/ocr2vrf_test.go +++ b/integration-tests/smoke/ocr2vrf_test.go @@ -36,7 +36,7 @@ func TestOCR2VRFRedeemModel(t *testing.T) { chainClient, err := blockchain.NewEVMClient(testNetwork, testEnvironment, l) require.NoError(t, err, "Error connecting to blockchain") - contractDeployer, err := contracts.NewContractDeployer(chainClient) + contractDeployer, err := contracts.NewContractDeployer(chainClient, l) require.NoError(t, err, "Error building contract deployer") chainlinkNodes, err := client.ConnectChainlinkNodes(testEnvironment) require.NoError(t, err, "Error connecting to Chainlink nodes") @@ -98,7 +98,7 @@ func TestOCR2VRFFulfillmentModel(t *testing.T) { chainClient, err := blockchain.NewEVMClient(testNetwork, testEnvironment, l) require.NoError(t, err, "Error connecting to blockchain") - contractDeployer, err := contracts.NewContractDeployer(chainClient) + contractDeployer, err := contracts.NewContractDeployer(chainClient, l) require.NoError(t, err, "Error building contract deployer") chainlinkNodes, err := client.ConnectChainlinkNodes(testEnvironment) require.NoError(t, err, "Error connecting to Chainlink nodes") diff --git a/integration-tests/smoke/ocr_test.go b/integration-tests/smoke/ocr_test.go index c783978e66e..fdcb9c84b5e 100644 --- a/integration-tests/smoke/ocr_test.go +++ b/integration-tests/smoke/ocr_test.go @@ -47,7 +47,7 @@ func TestOCRBasic(t *testing.T) { err = actions.CreateOCRJobsLocal(ocrInstances, bootstrapNode, workerNodes, 5, env.MockServer.Client) require.NoError(t, err) - err = actions.StartNewRound(1, ocrInstances, env.EVMClient) + err = actions.StartNewRound(1, ocrInstances, env.EVMClient, l) require.NoError(t, err) answer, err := ocrInstances[0].GetLatestAnswer(context.Background()) @@ -56,7 +56,7 @@ func TestOCRBasic(t *testing.T) { err = actions.SetAllAdapterResponsesToTheSameValueLocal(10, ocrInstances, workerNodes, env.MockServer.Client) require.NoError(t, err) - err = actions.StartNewRound(2, ocrInstances, env.EVMClient) + err = actions.StartNewRound(2, ocrInstances, env.EVMClient, l) require.NoError(t, err) answer, err = ocrInstances[0].GetLatestAnswer(context.Background()) diff --git a/integration-tests/testsetups/don_evm_chain.go b/integration-tests/testsetups/don_evm_chain.go index 13d5a415f8b..545d9515801 100644 --- a/integration-tests/testsetups/don_evm_chain.go +++ b/integration-tests/testsetups/don_evm_chain.go @@ -65,7 +65,7 @@ func (s *DonChain) initializeClients() { s.EVMClient, err = blockchain.NewEVMClient(network, s.conf.Env, s.l) require.NoError(s.conf.T, err, "Connecting to blockchain nodes shouldn't fail") - s.ContractDeployer, err = contracts.NewContractDeployer(s.EVMClient) + s.ContractDeployer, err = contracts.NewContractDeployer(s.EVMClient, s.l) require.NoError(s.conf.T, err) s.ChainlinkNodes, err = client.ConnectChainlinkNodes(s.conf.Env) diff --git a/integration-tests/testsetups/keeper_benchmark.go b/integration-tests/testsetups/keeper_benchmark.go index 70e0bf57941..7a52383d8e8 100644 --- a/integration-tests/testsetups/keeper_benchmark.go +++ b/integration-tests/testsetups/keeper_benchmark.go @@ -116,7 +116,7 @@ func (k *KeeperBenchmarkTest) Setup(t *testing.T, env *environment.Environment) var err error // Connect to networks and prepare for contract deployment - k.contractDeployer, err = contracts.NewContractDeployer(k.chainClient) + k.contractDeployer, err = contracts.NewContractDeployer(k.chainClient, l) require.NoError(t, err, "Building a new contract deployer shouldn't fail") k.chainlinkNodes, err = client.ConnectChainlinkNodes(k.env) require.NoError(t, err, "Connecting to chainlink nodes shouldn't fail") @@ -264,6 +264,7 @@ func (k *KeeperBenchmarkTest) Run(t *testing.T) { &k.TestReporter, int64(index), inputs.Upkeeps.FirstEligibleBuffer, + l, ), ) } diff --git a/integration-tests/testsetups/ocr.go b/integration-tests/testsetups/ocr.go index e5e97fc5a3e..b5c032e74aa 100644 --- a/integration-tests/testsetups/ocr.go +++ b/integration-tests/testsetups/ocr.go @@ -188,7 +188,7 @@ func (o *OCRSoakTest) Setup() { // Make connections to soak test resources o.chainClient, err = blockchain.NewEVMClient(network, o.testEnvironment, o.log) require.NoError(o.t, err, "Error creating EVM client") - contractDeployer, err := contracts.NewContractDeployer(o.chainClient) + contractDeployer, err := contracts.NewContractDeployer(o.chainClient, o.log) require.NoError(o.t, err, "Unable to create contract deployer") require.NotNil(o.t, contractDeployer, "Contract deployer shouldn't be nil") nodes, err := client.ConnectChainlinkNodes(o.testEnvironment) @@ -206,7 +206,7 @@ func (o *OCRSoakTest) Setup() { require.NoError(o.t, err, "Error funding Chainlink nodes") if o.OperatorForwarderFlow { - contractLoader, err := contracts.NewContractLoader(o.chainClient) + contractLoader, err := contracts.NewContractLoader(o.chainClient, o.log) require.NoError(o.t, err, "Loading contracts shouldn't fail") operators, authorizedForwarders, _ := actions.DeployForwarderContracts( @@ -388,7 +388,7 @@ func (o *OCRSoakTest) LoadState() error { if err != nil { return err } - contractDeployer, err := contracts.NewContractDeployer(o.chainClient) + contractDeployer, err := contracts.NewContractDeployer(o.chainClient, o.log) if err != nil { return err } From 06863869e21c45820250fabae0c980b1f3db30a9 Mon Sep 17 00:00:00 2001 From: Tate Date: Wed, 13 Sep 2023 15:41:05 -0600 Subject: [PATCH 7/8] More and cleanup --- integration-tests/actions/ocr_helpers_local.go | 10 ++++++---- integration-tests/chaos/automation_chaos_test.go | 3 ++- integration-tests/chaos/ocr_chaos_test.go | 2 +- integration-tests/client/chainlink.go | 8 ++------ integration-tests/docker/test_env/cl_node.go | 11 +++++++---- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- integration-tests/load/functions/setup.go | 2 +- integration-tests/migration/upgrade_version_test.go | 4 +++- integration-tests/smoke/forwarder_ocr_test.go | 6 +++--- integration-tests/smoke/forwarders_ocr2_test.go | 2 +- integration-tests/smoke/vrfv2_test.go | 1 + integration-tests/smoke/vrfv2plus_test.go | 1 + 13 files changed, 31 insertions(+), 25 deletions(-) diff --git a/integration-tests/actions/ocr_helpers_local.go b/integration-tests/actions/ocr_helpers_local.go index 13fc01dcea6..82d32d1f489 100644 --- a/integration-tests/actions/ocr_helpers_local.go +++ b/integration-tests/actions/ocr_helpers_local.go @@ -2,18 +2,19 @@ package actions import ( "fmt" + "math/big" + "strings" + "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/common" "github.com/google/uuid" "github.com/pkg/errors" - "github.com/rs/zerolog/log" + "github.com/rs/zerolog" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" ctfClient "github.com/smartcontractkit/chainlink-testing-framework/client" "github.com/smartcontractkit/chainlink/integration-tests/client" "github.com/smartcontractkit/chainlink/integration-tests/contracts" "golang.org/x/sync/errgroup" - "math/big" - "strings" ) /* @@ -266,13 +267,14 @@ func TrackForwarderLocal( chainClient blockchain.EVMClient, authorizedForwarder common.Address, node *client.ChainlinkClient, + logger zerolog.Logger, ) error { chainID := chainClient.GetChainID() _, _, err := node.TrackForwarder(chainID, authorizedForwarder) if err != nil { return errors.Wrap(err, "failed to track forwarder") } - log.Info().Str("NodeURL", node.Config.URL). + logger.Info().Str("NodeURL", node.Config.URL). Str("ForwarderAddress", authorizedForwarder.Hex()). Str("ChaindID", chainID.String()). Msg("Forwarder tracked") diff --git a/integration-tests/chaos/automation_chaos_test.go b/integration-tests/chaos/automation_chaos_test.go index 1b45d5dd716..1b18b9f6ab7 100644 --- a/integration-tests/chaos/automation_chaos_test.go +++ b/integration-tests/chaos/automation_chaos_test.go @@ -203,8 +203,9 @@ func TestAutomationChaos(t *testing.T) { chainClient, err := blockchain.NewEVMClient(network, testEnvironment, l) require.NoError(t, err, "Error connecting to blockchain") - contractDeployer, err := contracts.NewContractDeployer(chainClient) + contractDeployer, err := contracts.NewContractDeployer(chainClient, l) require.NoError(t, err, "Error building contract deployer") + chainlinkNodes, err := client.ConnectChainlinkNodes(testEnvironment) require.NoError(t, err, "Error connecting to Chainlink nodes") chainClient.ParallelTransactions(true) diff --git a/integration-tests/chaos/ocr_chaos_test.go b/integration-tests/chaos/ocr_chaos_test.go index 4ce25a4f39e..f6150cb5974 100644 --- a/integration-tests/chaos/ocr_chaos_test.go +++ b/integration-tests/chaos/ocr_chaos_test.go @@ -155,7 +155,7 @@ func TestOCRChaos(t *testing.T) { chainClient, err := blockchain.NewEVMClient(blockchain.SimulatedEVMNetwork, testEnvironment, l) require.NoError(t, err, "Connecting to blockchain nodes shouldn't fail") - cd, err := contracts.NewContractDeployer(chainClient) + cd, err := contracts.NewContractDeployer(chainClient, l) require.NoError(t, err, "Deploying contracts shouldn't fail") chainlinkNodes, err := client.ConnectChainlinkNodes(testEnvironment) diff --git a/integration-tests/client/chainlink.go b/integration-tests/client/chainlink.go index 9653dc0dea1..8a79cb3ec95 100644 --- a/integration-tests/client/chainlink.go +++ b/integration-tests/client/chainlink.go @@ -45,7 +45,7 @@ type ChainlinkClient struct { } // NewChainlinkClient creates a new Chainlink model using a provided config -func NewChainlinkClient(c *ChainlinkConfig) (*ChainlinkClient, error) { +func NewChainlinkClient(c *ChainlinkConfig, logger zerolog.Logger) (*ChainlinkClient, error) { rc, err := initRestyClient(c.URL, c.Email, c.Password, c.HTTPTimeout) if err != nil { return nil, err @@ -58,14 +58,10 @@ func NewChainlinkClient(c *ChainlinkConfig) (*ChainlinkClient, error) { Config: c, APIClient: rc, pageSize: 25, - l: log.Logger, + l: logger, }, nil } -func (c *ChainlinkClient) WithLogger(l zerolog.Logger) { - c.l = l -} - func initRestyClient(url string, email string, password string, timeout *time.Duration) (*resty.Client, error) { rc := resty.New().SetBaseURL(url) if timeout != nil { diff --git a/integration-tests/docker/test_env/cl_node.go b/integration-tests/docker/test_env/cl_node.go index bdd0b951f53..6ab399933d3 100644 --- a/integration-tests/docker/test_env/cl_node.go +++ b/integration-tests/docker/test_env/cl_node.go @@ -251,9 +251,13 @@ func (n *ClNode) StartContainer() error { if err != nil { return err } + l := tc.Logger if n.t != nil { - l = tc.TestLogger(n.t) + l = logging.CustomT{ + T: n.t, + L: n.l, + } } container, err := docker.StartContainerWithRetry(n.l, tc.GenericContainerRequest{ ContainerRequest: *cReq, @@ -286,12 +290,11 @@ func (n *ClNode) StartContainer() error { Email: "local@local.com", Password: "localdevpassword", InternalIP: ip, - }) + }, + n.l) if err != nil { return errors.Wrap(err, ErrConnectNodeClient) } - - clClient.WithLogger(n.l) clClient.Config.InternalIP = n.ContainerName n.Container = container n.API = clClient diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 32d77d52539..6ea1b23e5ce 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -20,7 +20,7 @@ require ( github.com/rs/zerolog v1.30.0 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-env v0.36.0 - github.com/smartcontractkit/chainlink-testing-framework v1.16.9-0.20230913200453-9dad8d418161 + github.com/smartcontractkit/chainlink-testing-framework v1.16.9-0.20230913215151-0c65ac4a863a github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20230816220705-665e93233ae5 github.com/smartcontractkit/ocr2keepers v0.7.23 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index fb49d562234..524acfe1925 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -2258,8 +2258,8 @@ github.com/smartcontractkit/chainlink-solana v1.0.3-0.20230831134610-680240b97ac github.com/smartcontractkit/chainlink-solana v1.0.3-0.20230831134610-680240b97aca/go.mod h1:RIUJXn7EVp24TL2p4FW79dYjyno23x5mjt1nKN+5WEk= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20230901115736-bbabe542a918 h1:ByVauKFXphRlSNG47lNuxZ9aicu+r8AoNp933VRPpCw= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20230901115736-bbabe542a918/go.mod h1:/yp/sqD8Iz5GU5fcercjrw0ivJF7HDcupYg+Gjr7EPg= -github.com/smartcontractkit/chainlink-testing-framework v1.16.9-0.20230913200453-9dad8d418161 h1:aGjUrDpAdzHkfaflsEzHdw6rV1pHmFuDcwKd0NzolhY= -github.com/smartcontractkit/chainlink-testing-framework v1.16.9-0.20230913200453-9dad8d418161/go.mod h1:Ry6fRPr8TwrIsYVNEF1pguAgzE3QW1s54tbLWnFtfI4= +github.com/smartcontractkit/chainlink-testing-framework v1.16.9-0.20230913215151-0c65ac4a863a h1:k7XHEvO2b677uqF2NO5v2R2ezqc4rKPd6IHNQNDiJVo= +github.com/smartcontractkit/chainlink-testing-framework v1.16.9-0.20230913215151-0c65ac4a863a/go.mod h1:Ry6fRPr8TwrIsYVNEF1pguAgzE3QW1s54tbLWnFtfI4= github.com/smartcontractkit/go-plugin v0.0.0-20230605132010-0f4d515d1472 h1:x3kNwgFlDmbE/n0gTSRMt9GBDfsfGrs4X9b9arPZtFI= github.com/smartcontractkit/go-plugin v0.0.0-20230605132010-0f4d515d1472/go.mod h1:6/1TEzT0eQznvI/gV2CM29DLSkAK/e58mUWKVsPaph0= github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f h1:hgJif132UCdjo8u43i7iPN1/MFnu49hv7lFGFftCHKU= diff --git a/integration-tests/load/functions/setup.go b/integration-tests/load/functions/setup.go index 6801e2ede59..5d44cbc698e 100644 --- a/integration-tests/load/functions/setup.go +++ b/integration-tests/load/functions/setup.go @@ -59,7 +59,7 @@ func SetupLocalLoadTestEnv(cfg *PerformanceConfig) (*FunctionsTest, error) { return nil, err } - cl, err := contracts.NewContractLoader(bc) + cl, err := contracts.NewContractLoader(bc, log.Logger) if err != nil { return nil, err } diff --git a/integration-tests/migration/upgrade_version_test.go b/integration-tests/migration/upgrade_version_test.go index 1f90bd123eb..d1d79de5eed 100644 --- a/integration-tests/migration/upgrade_version_test.go +++ b/integration-tests/migration/upgrade_version_test.go @@ -6,13 +6,15 @@ import ( "github.com/smartcontractkit/chainlink-testing-framework/utils" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink/integration-tests/docker/test_env" "os" + + "github.com/smartcontractkit/chainlink/integration-tests/docker/test_env" ) func TestVersionUpgrade(t *testing.T) { t.Parallel() env, err := test_env.NewCLTestEnvBuilder(). + WithTestLogger(t). WithGeth(). WithCLNodes(1). Build() diff --git a/integration-tests/smoke/forwarder_ocr_test.go b/integration-tests/smoke/forwarder_ocr_test.go index 1f3fb43846e..8c4ffd40e22 100644 --- a/integration-tests/smoke/forwarder_ocr_test.go +++ b/integration-tests/smoke/forwarder_ocr_test.go @@ -55,7 +55,7 @@ func TestForwarderOCRBasic(t *testing.T) { t, operators[i], authorizedForwarders[i], []common.Address{workerNodeAddresses[i]}, env.EVMClient, env.ContractLoader, ) require.NoError(t, err, "Accepting Authorize Receivers on Operator shouldn't fail") - err = actions.TrackForwarderLocal(env.EVMClient, authorizedForwarders[i], workerNodes[i]) + err = actions.TrackForwarderLocal(env.EVMClient, authorizedForwarders[i], workerNodes[i], l) require.NoError(t, err) err = env.EVMClient.WaitForEvents() } @@ -71,7 +71,7 @@ func TestForwarderOCRBasic(t *testing.T) { err = actions.CreateOCRJobsWithForwarderLocal(ocrInstances, bootstrapNode, workerNodes, 5, env.MockServer.Client) require.NoError(t, err, "failed to setup forwarder jobs") - err = actions.StartNewRound(1, ocrInstances, env.EVMClient) + err = actions.StartNewRound(1, ocrInstances, env.EVMClient, l) require.NoError(t, err) err = env.EVMClient.WaitForEvents() require.NoError(t, err, "Error waiting for events") @@ -83,7 +83,7 @@ func TestForwarderOCRBasic(t *testing.T) { err = actions.SetAllAdapterResponsesToTheSameValueLocal(10, ocrInstances, workerNodes, env.MockServer.Client) require.NoError(t, err) - err = actions.StartNewRound(2, ocrInstances, env.EVMClient) + err = actions.StartNewRound(2, ocrInstances, env.EVMClient, l) require.NoError(t, err) err = env.EVMClient.WaitForEvents() require.NoError(t, err, "Error waiting for events") diff --git a/integration-tests/smoke/forwarders_ocr2_test.go b/integration-tests/smoke/forwarders_ocr2_test.go index c5fb7740756..206320a8a9d 100644 --- a/integration-tests/smoke/forwarders_ocr2_test.go +++ b/integration-tests/smoke/forwarders_ocr2_test.go @@ -61,7 +61,7 @@ func TestForwarderOCR2Basic(t *testing.T) { for i := range workerNodes { actions.AcceptAuthorizedReceiversOperator(t, operators[i], authorizedForwarders[i], []common.Address{workerNodeAddresses[i]}, env.EVMClient, env.ContractLoader) require.NoError(t, err, "Accepting Authorized Receivers on Operator shouldn't fail") - err = actions.TrackForwarderLocal(env.EVMClient, authorizedForwarders[i], workerNodes[i]) + err = actions.TrackForwarderLocal(env.EVMClient, authorizedForwarders[i], workerNodes[i], l) require.NoError(t, err, "failed to track forwarders") err = env.EVMClient.WaitForEvents() require.NoError(t, err, "Error waiting for events") diff --git a/integration-tests/smoke/vrfv2_test.go b/integration-tests/smoke/vrfv2_test.go index 0a16fcfa69e..4270f82f714 100644 --- a/integration-tests/smoke/vrfv2_test.go +++ b/integration-tests/smoke/vrfv2_test.go @@ -23,6 +23,7 @@ func TestVRFv2Basic(t *testing.T) { l := logging.GetTestLogger(t) env, err := test_env.NewCLTestEnvBuilder(). + WithTestLogger(t). WithGeth(). WithCLNodes(1). WithFunding(vrfConst.ChainlinkNodeFundingAmountEth). diff --git a/integration-tests/smoke/vrfv2plus_test.go b/integration-tests/smoke/vrfv2plus_test.go index 24001f2fb0f..37e9c08fe83 100644 --- a/integration-tests/smoke/vrfv2plus_test.go +++ b/integration-tests/smoke/vrfv2plus_test.go @@ -21,6 +21,7 @@ func TestVRFv2PlusBilling(t *testing.T) { l := logging.GetTestLogger(t) env, err := test_env.NewCLTestEnvBuilder(). + WithTestLogger(t). WithGeth(). WithCLNodes(1). WithFunding(vrfv2plus_constants.ChainlinkNodeFundingAmountEth). From 7925bb8e78c050039c8e21db92d1e42995a62383 Mon Sep 17 00:00:00 2001 From: Tate Date: Thu, 14 Sep 2023 13:40:38 -0600 Subject: [PATCH 8/8] Bump ctf and merge conflict fixes --- integration-tests/docker/test_env/test_env.go | 12 +++--- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 +- integration-tests/smoke/keeper_test.go | 39 +++++++------------ 4 files changed, 21 insertions(+), 36 deletions(-) diff --git a/integration-tests/docker/test_env/test_env.go b/integration-tests/docker/test_env/test_env.go index 2a72ab56286..8c4faadbd2b 100644 --- a/integration-tests/docker/test_env/test_env.go +++ b/integration-tests/docker/test_env/test_env.go @@ -24,7 +24,6 @@ import ( "github.com/smartcontractkit/chainlink-testing-framework/docker/test_env" "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/logwatch" - testUtils "github.com/smartcontractkit/chainlink-testing-framework/utils" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" "github.com/smartcontractkit/chainlink/integration-tests/client" @@ -240,7 +239,6 @@ func (te *CLClusterTestEnv) Terminate() error { // Cleanup cleans the environment up after it's done being used, mainly for returning funds when on live networks. // Intended to be used as part of t.Cleanup() in tests. func (te *CLClusterTestEnv) Cleanup(t *testing.T) error { - l := testUtils.GetTestLogger(t) if te.EVMClient == nil { return errors.New("blockchain client is nil, unable to return funds from chainlink nodes") } @@ -250,10 +248,10 @@ func (te *CLClusterTestEnv) Cleanup(t *testing.T) error { // Check if we need to return funds if te.EVMClient.NetworkSimulated() { - l.Info().Str("Network Name", te.EVMClient.GetNetworkName()). + te.l.Info().Str("Network Name", te.EVMClient.GetNetworkName()). Msg("Network is a simulated network. Skipping fund return.") } else { - l.Info().Msg("Attempting to return Chainlink node funds to default network wallets") + te.l.Info().Msg("Attempting to return Chainlink node funds to default network wallets") for _, chainlinkNode := range te.CLNodes { fundedKeys, err := chainlinkNode.API.ExportEVMKeysForChain(te.EVMClient.GetChainID().String()) if err != nil { @@ -288,7 +286,7 @@ func (te *CLClusterTestEnv) Cleanup(t *testing.T) error { return err } - l.Warn().Msg("Test failed, collecting logs") + te.l.Warn().Msg("Test failed, collecting logs") eg := &errgroup.Group{} for _, n := range te.CLNodes { node := n @@ -307,7 +305,7 @@ func (te *CLClusterTestEnv) Cleanup(t *testing.T) error { if err != nil { return err } - l.Info().Str("Node", node.ContainerName).Str("File", logFileName).Msg("Wrote Logs") + te.l.Info().Str("Node", node.ContainerName).Str("File", logFileName).Msg("Wrote Logs") return nil }) } @@ -316,7 +314,7 @@ func (te *CLClusterTestEnv) Cleanup(t *testing.T) error { return err } - l.Info().Str("Logs Location", folder).Msg("Wrote Logs for Failed Test") + te.l.Info().Str("Logs Location", folder).Msg("Wrote Logs for Failed Test") return nil } diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 6ea1b23e5ce..9edf6d72be5 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -20,7 +20,7 @@ require ( github.com/rs/zerolog v1.30.0 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-env v0.36.0 - github.com/smartcontractkit/chainlink-testing-framework v1.16.9-0.20230913215151-0c65ac4a863a + github.com/smartcontractkit/chainlink-testing-framework v1.17.0 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20230816220705-665e93233ae5 github.com/smartcontractkit/ocr2keepers v0.7.23 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 524acfe1925..55686ce2ef4 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -2258,8 +2258,8 @@ github.com/smartcontractkit/chainlink-solana v1.0.3-0.20230831134610-680240b97ac github.com/smartcontractkit/chainlink-solana v1.0.3-0.20230831134610-680240b97aca/go.mod h1:RIUJXn7EVp24TL2p4FW79dYjyno23x5mjt1nKN+5WEk= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20230901115736-bbabe542a918 h1:ByVauKFXphRlSNG47lNuxZ9aicu+r8AoNp933VRPpCw= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20230901115736-bbabe542a918/go.mod h1:/yp/sqD8Iz5GU5fcercjrw0ivJF7HDcupYg+Gjr7EPg= -github.com/smartcontractkit/chainlink-testing-framework v1.16.9-0.20230913215151-0c65ac4a863a h1:k7XHEvO2b677uqF2NO5v2R2ezqc4rKPd6IHNQNDiJVo= -github.com/smartcontractkit/chainlink-testing-framework v1.16.9-0.20230913215151-0c65ac4a863a/go.mod h1:Ry6fRPr8TwrIsYVNEF1pguAgzE3QW1s54tbLWnFtfI4= +github.com/smartcontractkit/chainlink-testing-framework v1.17.0 h1:JcJwfawW7jfLBG+By5hGTVcNgKQ7bJCqvN9TEF3qBis= +github.com/smartcontractkit/chainlink-testing-framework v1.17.0/go.mod h1:Ry6fRPr8TwrIsYVNEF1pguAgzE3QW1s54tbLWnFtfI4= github.com/smartcontractkit/go-plugin v0.0.0-20230605132010-0f4d515d1472 h1:x3kNwgFlDmbE/n0gTSRMt9GBDfsfGrs4X9b9arPZtFI= github.com/smartcontractkit/go-plugin v0.0.0-20230605132010-0f4d515d1472/go.mod h1:6/1TEzT0eQznvI/gV2CM29DLSkAK/e58mUWKVsPaph0= github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f h1:hgJif132UCdjo8u43i7iPN1/MFnu49hv7lFGFftCHKU= diff --git a/integration-tests/smoke/keeper_test.go b/integration-tests/smoke/keeper_test.go index 4b04456a54b..0e4cb7ce041 100644 --- a/integration-tests/smoke/keeper_test.go +++ b/integration-tests/smoke/keeper_test.go @@ -101,8 +101,7 @@ func TestKeeperBasicSmoke(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) + _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -178,8 +177,7 @@ func TestKeeperBlockCountPerTurn(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) + _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -287,8 +285,7 @@ func TestKeeperSimulation(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) + _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -361,8 +358,7 @@ func TestKeeperCheckPerformGasLimit(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) + _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -471,8 +467,7 @@ func TestKeeperRegisterUpkeep(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) + _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -561,8 +556,7 @@ func TestKeeperAddFunds(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) + _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -625,8 +619,7 @@ func TestKeeperRemove(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) + _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -704,8 +697,7 @@ func TestKeeperPauseRegistry(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) + _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -766,8 +758,7 @@ func TestKeeperMigrateRegistry(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) + _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -786,8 +777,7 @@ func TestKeeperMigrateRegistry(t *testing.T) { ) // Set the jobs for the second registry - _, err = actions.CreateKeeperJobsLocal(l, chainlinkNodes, secondRegistry, contracts.OCRv2Config{}) - _, err = actions.CreateKeeperJobsLocal(chainlinkNodes, secondRegistry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) + _, err = actions.CreateKeeperJobsLocal(l, chainlinkNodes, secondRegistry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -860,8 +850,7 @@ func TestKeeperNodeDown(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - jobs, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}) - jobs, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) + jobs, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -967,8 +956,7 @@ func TestKeeperPauseUnPauseUpkeep(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) + _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -1059,8 +1047,7 @@ func TestKeeperUpdateCheckData(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) + _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs")