From 4c809308f2bac5a8c4ec9343c0074af1cce3eeb0 Mon Sep 17 00:00:00 2001 From: Tate Date: Tue, 12 Sep 2023 14:56:20 -0600 Subject: [PATCH] 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).