diff --git a/integration-tests/actions/actions.go b/integration-tests/actions/actions.go index 2431e02f8c1..75ff00afbc5 100644 --- a/integration-tests/actions/actions.go +++ b/integration-tests/actions/actions.go @@ -11,6 +11,7 @@ import ( "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" uuid "github.com/satori/go.uuid" "go.uber.org/zap/zapcore" @@ -231,6 +232,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 := zerolog.New(zerolog.NewTestWriter(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") } @@ -240,12 +242,12 @@ func TeardownSuite( // This printed line is required for tests that use real funds to propagate the failure // out to the system running the test. Do not remove fmt.Println(environment.FAILED_FUND_RETURN) - log.Error().Err(err).Str("Namespace", env.Cfg.Namespace). + l.Error().Err(err).Str("Namespace", env.Cfg.Namespace). Msg("Error attempting to return funds from chainlink nodes to network's default wallet. " + "Environment is left running so you can try manually!") } } else { - log.Info().Msg("Successfully returned funds from chainlink nodes to default network wallets") + l.Info().Msg("Successfully returned funds from chainlink nodes to default network wallets") } // nolint if c != nil { @@ -268,12 +270,13 @@ func TeardownRemoteSuite( optionalTestReporter testreporters.TestReporter, // Optionally pass in a test reporter to log further metrics client blockchain.EVMClient, ) error { + l := zerolog.New(zerolog.NewTestWriter(t)) var err error if err = testreporters.SendReport(t, env, "./", optionalTestReporter); err != nil { - log.Warn().Err(err).Msg("Error writing test report") + l.Warn().Err(err).Msg("Error writing test report") } if err = returnFunds(chainlinkNodes, client); err != nil { - log.Error().Err(err).Str("Namespace", env.Cfg.Namespace). + l.Error().Err(err).Str("Namespace", env.Cfg.Namespace). Msg("Error attempting to return funds from chainlink nodes to network's default wallet. " + "Environment is left running so you can try manually!") } diff --git a/integration-tests/actions/automation_ocr_helpers.go b/integration-tests/actions/automation_ocr_helpers.go index 2ee8f43f0ff..050da3687c8 100644 --- a/integration-tests/actions/automation_ocr_helpers.go +++ b/integration-tests/actions/automation_ocr_helpers.go @@ -10,18 +10,19 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/lib/pq" - "github.com/rs/zerolog/log" + "github.com/rs/zerolog" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" "github.com/smartcontractkit/chainlink-testing-framework/contracts/ethereum" + "github.com/smartcontractkit/libocr/offchainreporting2/confighelper" + types2 "github.com/smartcontractkit/ocr2keepers/pkg/types" + "github.com/stretchr/testify/require" + "gopkg.in/guregu/null.v4" + "github.com/smartcontractkit/chainlink/core/services/job" "github.com/smartcontractkit/chainlink/core/services/keystore/chaintype" "github.com/smartcontractkit/chainlink/core/store/models" "github.com/smartcontractkit/chainlink/integration-tests/client" "github.com/smartcontractkit/chainlink/integration-tests/contracts" - "github.com/smartcontractkit/libocr/offchainreporting2/confighelper" - types2 "github.com/smartcontractkit/ocr2keepers/pkg/types" - "github.com/stretchr/testify/require" - "gopkg.in/guregu/null.v4" ) func BuildAutoOCR2ConfigVars( @@ -31,6 +32,7 @@ func BuildAutoOCR2ConfigVars( registrar string, deltaStage time.Duration, ) contracts.OCRConfig { + l := zerolog.New(zerolog.NewTestWriter(t)) S, oracleIdentities := getOracleIdentities(t, chainlinkNodes) signerOnchainPublicKeys, transmitterAccounts, f, _, offchainConfigVersion, offchainConfig, err := confighelper.ContractSetConfigArgsForTests( @@ -77,7 +79,7 @@ func BuildAutoOCR2ConfigVars( onchainConfig, err := registryConfig.EncodeOnChainConfig(registrar) require.NoError(t, err, "Shouldn't fail encoding config") - log.Info().Msg("Done building OCR config") + l.Info().Msg("Done building OCR config") return contracts.OCRConfig{ Signers: signers, Transmitters: transmitters, @@ -96,6 +98,7 @@ func CreateOCRKeeperJobs( chainID int64, keyIndex int, ) { + l := zerolog.New(zerolog.NewTestWriter(t)) bootstrapNode := chainlinkNodes[0] bootstrapNode.RemoteIP() bootstrapP2PIds, err := bootstrapNode.MustReadP2PKeys() @@ -154,7 +157,7 @@ func CreateOCRKeeperJobs( _, err = chainlinkNodes[nodeIndex].MustCreateJob(&autoOCR2JobSpec) require.NoError(t, err, "Shouldn't fail creating OCR Task job on OCR node %d", nodeIndex+1) } - log.Info().Msg("Done creating OCR automation jobs") + l.Info().Msg("Done creating OCR automation jobs") } // DeployAutoOCRRegistryAndRegistrar registry and registrar diff --git a/integration-tests/actions/keeper_benchmark_helpers.go b/integration-tests/actions/keeper_benchmark_helpers.go index 03134cad398..db40d7217f3 100644 --- a/integration-tests/actions/keeper_benchmark_helpers.go +++ b/integration-tests/actions/keeper_benchmark_helpers.go @@ -8,12 +8,12 @@ import ( "testing" "time" - "github.com/smartcontractkit/chainlink/integration-tests/client" + "github.com/rs/zerolog" "github.com/stretchr/testify/require" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" + "github.com/smartcontractkit/chainlink/integration-tests/client" + "github.com/ethereum/go-ethereum/common" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" "github.com/smartcontractkit/chainlink-testing-framework/contracts/ethereum" @@ -117,6 +117,7 @@ func ResetUpkeeps( predeployedContracts []contracts.KeeperConsumerBenchmark, upkeepResetterAddr string, ) { + l := zerolog.New(zerolog.NewTestWriter(t)) contractLoader, err := contracts.NewContractLoader(client) require.NoError(t, err, "Error loading upkeep contract") upkeepChunkSize := 500 @@ -131,11 +132,11 @@ func ResetUpkeeps( } err = client.WaitForEvents() require.NoError(t, err, "Failed to wait for deploying UpkeepResetter") - log.Info().Str("UpkeepResetter Address", upkeepResetter.Address()).Msg("Deployed UpkeepResetter") + l.Info().Str("UpkeepResetter Address", upkeepResetter.Address()).Msg("Deployed UpkeepResetter") upkeepResetterAddr = upkeepResetter.Address() } upkeepResetter, _ := contractLoader.LoadUpkeepResetter(common.HexToAddress(upkeepResetterAddr)) - log.Info().Str("UpkeepResetter Address", upkeepResetter.Address()).Msg("Loaded UpkeepResetter") + l.Info().Str("UpkeepResetter Address", upkeepResetter.Address()).Msg("Loaded UpkeepResetter") iter := 0 upkeepChunks[iter] = make([]string, 0) @@ -146,13 +147,13 @@ func ResetUpkeeps( } upkeepChunks[iter] = append(upkeepChunks[iter], predeployedContracts[count].Address()) } - log.Debug().Int("UpkeepChunk length", len(upkeepChunks)) + l.Debug().Int("UpkeepChunk length", len(upkeepChunks)) for it, upkeepChunk := range upkeepChunks { err := upkeepResetter.ResetManyConsumerBenchmark(context.Background(), upkeepChunk, big.NewInt(blockRange), big.NewInt(blockInterval), big.NewInt(firstEligibleBuffer), big.NewInt(checkGasToBurn), big.NewInt(performGasToBurn)) - log.Info().Int("Number of Contracts", len(upkeepChunk)).Int("Batch", it).Msg("Resetting batch of Contracts") - log.Debug().Str("Address", upkeepChunk[0]).Msg("First Upkeep to be reset") - log.Debug().Str("Address", upkeepChunk[len(upkeepChunk)-1]).Msg("Last Upkeep to be reset") + l.Info().Int("Number of Contracts", len(upkeepChunk)).Int("Batch", it).Msg("Resetting batch of Contracts") + l.Debug().Str("Address", upkeepChunk[0]).Msg("First Upkeep to be reset") + l.Debug().Str("Address", upkeepChunk[len(upkeepChunk)-1]).Msg("Last Upkeep to be reset") if err != nil { require.NoError(t, err, "Resetting upkeeps shouldn't fail") } @@ -174,19 +175,20 @@ func DeployKeeperConsumersBenchmark( predeployedContracts []string, upkeepResetterAddr string, ) []contracts.KeeperConsumerBenchmark { + l := zerolog.New(zerolog.NewTestWriter(t)) upkeeps := make([]contracts.KeeperConsumerBenchmark, 0) firstEligibleBuffer = 10000 if len(predeployedContracts) >= numberOfContracts { contractLoader, err := contracts.NewContractLoader(client) if err != nil { - log.Error().Err(err).Msg("Loading Contract Loader shouldn't fail") + l.Error().Err(err).Msg("Loading Contract Loader shouldn't fail") } for count, address := range predeployedContracts { if count < numberOfContracts { keeperConsumerInstance, err := contractLoader.LoadKeeperConsumerBenchmark(common.HexToAddress(address)) if err != nil { - log.Error().Err(err).Int("count", count+1).Str("UpkeepAddress", address).Msg("Loading KeeperConsumerBenchmark instance shouldn't fail") + l.Error().Err(err).Int("count", count+1).Str("UpkeepAddress", address).Msg("Loading KeeperConsumerBenchmark instance shouldn't fail") require.NoError(t, err, "Failed to load KeeperConsumerBenchmark") } upkeeps = append(upkeeps, keeperConsumerInstance) @@ -208,7 +210,7 @@ func DeployKeeperConsumersBenchmark( big.NewInt(firstEligibleBuffer), ) if err != nil { - log.Error().Err(err).Int("count", contractCount+1).Msg("Deploying KeeperConsumerBenchmark instance %d shouldn't fail") + l.Error().Err(err).Int("count", contractCount+1).Msg("Deploying KeeperConsumerBenchmark instance %d shouldn't fail") keeperConsumerInstance, err = contractDeployer.DeployKeeperConsumerBenchmark( big.NewInt(blockRange), big.NewInt(blockInterval), @@ -220,7 +222,7 @@ func DeployKeeperConsumersBenchmark( } //require.NoError(t, err, "Deploying KeeperConsumerBenchmark instance %d shouldn't fail", contractCount+1) upkeeps = append(upkeeps, keeperConsumerInstance) - log.Debug(). + l.Debug(). Str("Contract Address", keeperConsumerInstance.Address()). Int("Number", contractCount+1). Int("Out Of", numberOfContracts). @@ -232,7 +234,7 @@ func DeployKeeperConsumersBenchmark( } err := client.WaitForEvents() require.NoError(t, err, "Failed waiting for to deploy all keeper consumer contracts") - log.Info().Msg("Successfully deployed all Keeper Consumer Contracts") + l.Info().Msg("Successfully deployed all Keeper Consumer Contracts") return upkeeps } diff --git a/integration-tests/actions/keeper_helpers.go b/integration-tests/actions/keeper_helpers.go index 21bf1cf2a6d..a764b0bc025 100644 --- a/integration-tests/actions/keeper_helpers.go +++ b/integration-tests/actions/keeper_helpers.go @@ -8,7 +8,7 @@ import ( "testing" "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" + "github.com/rs/zerolog" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" "github.com/smartcontractkit/chainlink-testing-framework/contracts/ethereum" "github.com/stretchr/testify/require" @@ -338,6 +338,7 @@ func RegisterUpkeepContracts( numberOfContracts int, upkeepAddresses []string, ) []*big.Int { + l := zerolog.New(zerolog.NewTestWriter(t)) registrationTxHashes := make([]common.Hash, 0) upkeepIds := make([]*big.Int, 0) for contractCount, upkeepAddress := range upkeepAddresses { @@ -355,7 +356,7 @@ func RegisterUpkeepContracts( require.NoError(t, err, "Encoding the register request shouldn't fail") tx, err := linkToken.TransferAndCall(registrar.Address(), linkFunds, req) require.NoError(t, err, "Error registering the upkeep consumer to the registrar") - log.Debug(). + l.Debug(). Str("Contract Address", upkeepAddress). Int("Number", contractCount+1). Int("Out Of", numberOfContracts). @@ -383,13 +384,13 @@ func RegisterUpkeepContracts( } } require.NotNil(t, upkeepId, "Upkeep ID should be found after registration") - log.Debug(). + l.Debug(). Str("TxHash", txHash.String()). Str("Upkeep ID", upkeepId.String()). Msg("Found upkeepId in tx hash") upkeepIds = append(upkeepIds, upkeepId) } - log.Info().Msg("Successfully registered all Keeper Consumer Contracts") + l.Info().Msg("Successfully registered all Keeper Consumer Contracts") return upkeepIds } @@ -399,6 +400,7 @@ func DeployKeeperConsumers( client blockchain.EVMClient, numberOfContracts int, ) []contracts.KeeperConsumer { + l := zerolog.New(zerolog.NewTestWriter(t)) keeperConsumerContracts := make([]contracts.KeeperConsumer, 0) for contractCount := 0; contractCount < numberOfContracts; contractCount++ { @@ -406,7 +408,7 @@ func DeployKeeperConsumers( keeperConsumerInstance, err := contractDeployer.DeployKeeperConsumer(big.NewInt(5)) require.NoError(t, err, "Deploying KeeperConsumer instance %d shouldn't fail", contractCount+1) keeperConsumerContracts = append(keeperConsumerContracts, keeperConsumerInstance) - log.Debug(). + l.Debug(). Str("Contract Address", keeperConsumerInstance.Address()). Int("Number", contractCount+1). Int("Out Of", numberOfContracts). @@ -418,7 +420,7 @@ func DeployKeeperConsumers( } err := client.WaitForEvents() require.NoError(t, err, "Failed waiting for to deploy all keeper consumer contracts") - log.Info().Msg("Successfully deployed all Keeper Consumer Contracts") + l.Info().Msg("Successfully deployed all Keeper Consumer Contracts") return keeperConsumerContracts } @@ -433,6 +435,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 := zerolog.New(zerolog.NewTestWriter(t)) upkeeps := make([]contracts.KeeperConsumerPerformance, 0) for contractCount := 0; contractCount < numberOfContracts; contractCount++ { @@ -445,7 +448,7 @@ func DeployKeeperConsumersPerformance( ) require.NoError(t, err, "Deploying KeeperConsumerPerformance instance %d shouldn't fail", contractCount+1) upkeeps = append(upkeeps, keeperConsumerInstance) - log.Debug(). + l.Debug(). Str("Contract Address", keeperConsumerInstance.Address()). Int("Number", contractCount+1). Int("Out Of", numberOfContracts). @@ -457,7 +460,7 @@ func DeployKeeperConsumersPerformance( } err := client.WaitForEvents() require.NoError(t, err, "Failed waiting for to deploy all keeper consumer contracts") - log.Info().Msg("Successfully deployed all Keeper Consumer Contracts") + l.Info().Msg("Successfully deployed all Keeper Consumer Contracts") return upkeeps } @@ -469,13 +472,14 @@ func DeployPerformDataChecker( numberOfContracts int, expectedData []byte, ) []contracts.KeeperPerformDataChecker { + l := zerolog.New(zerolog.NewTestWriter(t)) upkeeps := make([]contracts.KeeperPerformDataChecker, 0) for contractCount := 0; contractCount < numberOfContracts; contractCount++ { performDataCheckerInstance, err := contractDeployer.DeployKeeperPerformDataChecker(expectedData) require.NoError(t, err, "Deploying KeeperPerformDataChecker instance %d shouldn't fail", contractCount+1) upkeeps = append(upkeeps, performDataCheckerInstance) - log.Debug(). + l.Debug(). Str("Contract Address", performDataCheckerInstance.Address()). Int("Number", contractCount+1). Int("Out Of", numberOfContracts). @@ -487,7 +491,7 @@ func DeployPerformDataChecker( } err := client.WaitForEvents() require.NoError(t, err, "Failed waiting for to deploy all keeper perform data checker contracts") - log.Info().Msg("Successfully deployed all PerformDataChecker Contracts") + l.Info().Msg("Successfully deployed all PerformDataChecker Contracts") return upkeeps } @@ -500,6 +504,7 @@ func DeployUpkeepCounters( testRange *big.Int, interval *big.Int, ) []contracts.UpkeepCounter { + l := zerolog.New(zerolog.NewTestWriter(t)) upkeepCounters := make([]contracts.UpkeepCounter, 0) for contractCount := 0; contractCount < numberOfContracts; contractCount++ { @@ -507,7 +512,7 @@ func DeployUpkeepCounters( upkeepCounter, err := contractDeployer.DeployUpkeepCounter(testRange, interval) require.NoError(t, err, "Deploying KeeperConsumer instance %d shouldn't fail", contractCount+1) upkeepCounters = append(upkeepCounters, upkeepCounter) - log.Debug(). + l.Debug(). Str("Contract Address", upkeepCounter.Address()). Int("Number", contractCount+1). Int("Out Of", numberOfContracts). @@ -519,7 +524,7 @@ func DeployUpkeepCounters( } err := client.WaitForEvents() require.NoError(t, err, "Failed waiting for to deploy all keeper consumer contracts") - log.Info().Msg("Successfully deployed all Keeper Consumer Contracts") + l.Info().Msg("Successfully deployed all Keeper Consumer Contracts") return upkeepCounters } @@ -532,6 +537,7 @@ func DeployUpkeepPerformCounterRestrictive( testRange *big.Int, averageEligibilityCadence *big.Int, ) []contracts.UpkeepPerformCounterRestrictive { + l := zerolog.New(zerolog.NewTestWriter(t)) upkeepCounters := make([]contracts.UpkeepPerformCounterRestrictive, 0) for contractCount := 0; contractCount < numberOfContracts; contractCount++ { @@ -539,7 +545,7 @@ func DeployUpkeepPerformCounterRestrictive( upkeepCounter, err := contractDeployer.DeployUpkeepPerformCounterRestrictive(testRange, averageEligibilityCadence) require.NoError(t, err, "Deploying KeeperConsumer instance %d shouldn't fail", contractCount+1) upkeepCounters = append(upkeepCounters, upkeepCounter) - log.Debug(). + l.Debug(). Str("Contract Address", upkeepCounter.Address()). Int("Number", contractCount+1). Int("Out Of", numberOfContracts). @@ -551,7 +557,7 @@ func DeployUpkeepPerformCounterRestrictive( } err := client.WaitForEvents() require.NoError(t, err, "Failed waiting for to deploy all keeper consumer contracts") - log.Info().Msg("Successfully deployed all Keeper Consumer Contracts") + l.Info().Msg("Successfully deployed all Keeper Consumer Contracts") return upkeepCounters } diff --git a/integration-tests/actions/ocr2vrf_actions/ocr2vrf_config_helpers.go b/integration-tests/actions/ocr2vrf_actions/ocr2vrf_config_helpers.go index 88521e39797..5b4f668adc3 100644 --- a/integration-tests/actions/ocr2vrf_actions/ocr2vrf_config_helpers.go +++ b/integration-tests/actions/ocr2vrf_actions/ocr2vrf_config_helpers.go @@ -11,7 +11,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/lib/pq" - "github.com/rs/zerolog/log" + "github.com/rs/zerolog" "github.com/smartcontractkit/libocr/offchainreporting2/confighelper" "github.com/smartcontractkit/libocr/offchainreporting2/types" "github.com/smartcontractkit/ocr2vrf/altbn_128" @@ -39,10 +39,11 @@ func CreateOCR2VRFJobs( chainID int64, keyIndex int, ) { + l := zerolog.New(zerolog.NewTestWriter(t)) p2pV2Bootstrapper := createBootstrapJob(t, bootstrapNode, OCR2VRFPluginConfig.DKGConfig.DKGContractAddress, chainID) createNonBootstrapJobs(t, nonBootstrapNodes, OCR2VRFPluginConfig, chainID, keyIndex, p2pV2Bootstrapper) - log.Info().Msg("Done creating OCR automation jobs") + l.Info().Msg("Done creating OCR automation jobs") } func createNonBootstrapJobs( @@ -119,7 +120,7 @@ func BuildOCR2DKGConfigVars( t *testing.T, ocr2VRFPluginConfig *OCR2VRFPluginConfig, ) contracts.OCRConfig { - + l := zerolog.New(zerolog.NewTestWriter(t)) var onchainPublicKeys []common.Address for _, onchainPublicKey := range ocr2VRFPluginConfig.OCR2Config.OnchainPublicKeys { onchainPublicKeys = append(onchainPublicKeys, common.HexToAddress(onchainPublicKey)) @@ -191,7 +192,7 @@ func BuildOCR2DKGConfigVars( ) require.NoError(t, err, "Shouldn't fail building OCR config") - log.Info().Msg("Done building DKG OCR config") + l.Info().Msg("Done building DKG OCR config") return contracts.OCRConfig{ Signers: onchainPublicKeys, Transmitters: transmitters, @@ -265,7 +266,7 @@ func BuildOCR2VRFConfigVars( t *testing.T, ocr2VRFPluginConfig *OCR2VRFPluginConfig, ) contracts.OCRConfig { - + l := zerolog.New(zerolog.NewTestWriter(t)) var onchainPublicKeys []common.Address for _, onchainPublicKey := range ocr2VRFPluginConfig.OCR2Config.OnchainPublicKeys { onchainPublicKeys = append(onchainPublicKeys, common.HexToAddress(onchainPublicKey)) @@ -316,7 +317,7 @@ func BuildOCR2VRFConfigVars( ) require.NoError(t, err) - log.Info().Msg("Done building VRF OCR config") + l.Info().Msg("Done building VRF OCR config") return contracts.OCRConfig{ Signers: onchainPublicKeys, Transmitters: transmitters, diff --git a/integration-tests/actions/ocr2vrf_actions/ocr2vrf_steps.go b/integration-tests/actions/ocr2vrf_actions/ocr2vrf_steps.go index 21d47a1dc2e..e4c7cfa2204 100644 --- a/integration-tests/actions/ocr2vrf_actions/ocr2vrf_steps.go +++ b/integration-tests/actions/ocr2vrf_actions/ocr2vrf_steps.go @@ -8,12 +8,13 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" + "github.com/rs/zerolog" - "github.com/rs/zerolog/log" ocr2vrftypes "github.com/smartcontractkit/ocr2vrf/types" "github.com/stretchr/testify/require" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" + "github.com/smartcontractkit/chainlink/core/services/keystore/chaintype" chainlinkutils "github.com/smartcontractkit/chainlink/core/utils" @@ -24,8 +25,9 @@ import ( ) func SetAndWaitForVRFBeaconProcessToFinish(t *testing.T, ocr2VRFPluginConfig *OCR2VRFPluginConfig, vrfBeacon contracts.VRFBeacon) { + l := zerolog.New(zerolog.NewTestWriter(t)) ocr2VrfConfig := BuildOCR2VRFConfigVars(t, ocr2VRFPluginConfig) - log.Debug().Interface("OCR2 VRF Config", ocr2VrfConfig).Msg("OCR2 VRF Config prepared") + l.Debug().Interface("OCR2 VRF Config", ocr2VrfConfig).Msg("OCR2 VRF Config prepared") err := vrfBeacon.SetConfig( ocr2VrfConfig.Signers, @@ -39,14 +41,15 @@ func SetAndWaitForVRFBeaconProcessToFinish(t *testing.T, ocr2VRFPluginConfig *OC vrfConfigSetEvent, err := vrfBeacon.WaitForConfigSetEvent(time.Minute) require.NoError(t, err, "Error waiting for ConfigSet Event for VRFBeacon contract") - log.Info().Interface("Event", vrfConfigSetEvent).Msg("OCR2 VRF Config was set") + l.Info().Interface("Event", vrfConfigSetEvent).Msg("OCR2 VRF Config was set") } func SetAndWaitForDKGProcessToFinish(t *testing.T, ocr2VRFPluginConfig *OCR2VRFPluginConfig, dkg contracts.DKG) { + l := zerolog.New(zerolog.NewTestWriter(t)) ocr2DkgConfig := BuildOCR2DKGConfigVars(t, ocr2VRFPluginConfig) // set config for DKG OCR - log.Debug().Interface("OCR2 DKG Config", ocr2DkgConfig).Msg("OCR2 DKG Config prepared") + l.Debug().Interface("OCR2 DKG Config", ocr2DkgConfig).Msg("OCR2 DKG Config prepared") err := dkg.SetConfig( ocr2DkgConfig.Signers, ocr2DkgConfig.Transmitters, @@ -60,11 +63,11 @@ func SetAndWaitForDKGProcessToFinish(t *testing.T, ocr2VRFPluginConfig *OCR2VRFP // wait for the event ConfigSet from DKG contract dkgConfigSetEvent, err := dkg.WaitForConfigSetEvent(time.Minute) require.NoError(t, err, "Error waiting for ConfigSet Event for DKG contract") - log.Info().Interface("Event", dkgConfigSetEvent).Msg("OCR2 DKG Config Set") + l.Info().Interface("Event", dkgConfigSetEvent).Msg("OCR2 DKG Config Set") // wait for the event Transmitted from DKG contract, meaning that OCR committee has sent out the Public key and Shares dkgSharesTransmittedEvent, err := dkg.WaitForTransmittedEvent(time.Minute * 5) require.NoError(t, err) - log.Info().Interface("Event", dkgSharesTransmittedEvent).Msg("DKG Shares were generated and transmitted by OCR Committee") + l.Info().Interface("Event", dkgSharesTransmittedEvent).Msg("DKG Shares were generated and transmitted by OCR Committee") } func SetAndGetOCR2VRFPluginConfig(t *testing.T, nonBootstrapNodes []*client.Chainlink, dkg contracts.DKG, vrfBeacon contracts.VRFBeacon, coordinator contracts.VRFCoordinatorV3, mockETHLinkFeed contracts.MockETHLINKFeed, keyID string, vrfBeaconAllowedConfirmationDelays []string, coordinatorConfig *ocr2vrftypes.CoordinatorConfig) *OCR2VRFPluginConfig { @@ -199,13 +202,14 @@ func RequestAndRedeemRandomness( subscriptionID, confirmationDelay *big.Int, ) *big.Int { + l := zerolog.New(zerolog.NewTestWriter(t)) receipt, err := consumer.RequestRandomness( numberOfRandomWordsToRequest, subscriptionID, confirmationDelay, ) require.NoError(t, err, "Error requesting randomness from Consumer Contract") - log.Info().Interface("TX Hash", receipt.TxHash).Msg("Randomness requested from Consumer contract") + l.Info().Interface("TX Hash", receipt.TxHash).Msg("Randomness requested from Consumer contract") err = chainClient.WaitForEvents() require.NoError(t, err, "Error waiting for TXs to complete") @@ -214,7 +218,7 @@ func RequestAndRedeemRandomness( newTransmissionEvent, err := vrfBeacon.WaitForNewTransmissionEvent(time.Minute * 5) require.NoError(t, err, "Error waiting for NewTransmission event from VRF Beacon Contract") - log.Info().Interface("NewTransmission event", newTransmissionEvent).Msg("Randomness transmitted by DON") + l.Info().Interface("NewTransmission event", newTransmissionEvent).Msg("Randomness transmitted by DON") err = consumer.RedeemRandomness(subscriptionID, requestID) require.NoError(t, err, "Error redeeming randomness from Consumer Contract") @@ -233,6 +237,7 @@ func RequestRandomnessFulfillment( subscriptionID *big.Int, confirmationDelay *big.Int, ) *big.Int { + l := zerolog.New(zerolog.NewTestWriter(t)) receipt, err := consumer.RequestRandomnessFulfillment( numberOfRandomWordsToRequest, subscriptionID, @@ -241,7 +246,7 @@ func RequestRandomnessFulfillment( nil, ) require.NoError(t, err, "Error requesting Randomness Fulfillment") - log.Info().Interface("TX Hash", receipt.TxHash).Msg("Randomness Fulfillment requested from Consumer contract") + l.Info().Interface("TX Hash", receipt.TxHash).Msg("Randomness Fulfillment requested from Consumer contract") err = chainClient.WaitForEvents() require.NoError(t, err, "Error waiting for TXs to complete") @@ -250,7 +255,7 @@ func RequestRandomnessFulfillment( newTransmissionEvent, err := vrfBeacon.WaitForNewTransmissionEvent(time.Minute * 5) require.NoError(t, err, "Error waiting for NewTransmission event from VRF Beacon Contract") - log.Info().Interface("NewTransmission event", newTransmissionEvent).Msg("Randomness Fulfillment transmitted by DON") + l.Info().Interface("NewTransmission event", newTransmissionEvent).Msg("Randomness Fulfillment transmitted by DON") err = chainClient.WaitForEvents() require.NoError(t, err, "Error waiting for TXs to complete") diff --git a/integration-tests/actions/ocr_helpers.go b/integration-tests/actions/ocr_helpers.go index ad810197612..419596aad6f 100644 --- a/integration-tests/actions/ocr_helpers.go +++ b/integration-tests/actions/ocr_helpers.go @@ -11,7 +11,7 @@ import ( "time" "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" + "github.com/rs/zerolog" uuid "github.com/satori/go.uuid" "github.com/stretchr/testify/require" @@ -442,6 +442,7 @@ func BuildGeneralOCR2Config( f int, onchainConfig []byte, ) contracts.OCRConfig { + l := zerolog.New(zerolog.NewTestWriter(t)) _, oracleIdentities := getOracleIdentities(t, chainlinkNodes) signerOnchainPublicKeys, transmitterAccounts, f_, onchainConfig_, offchainConfigVersion, offchainConfig, err := confighelper.ContractSetConfigArgsForTests( @@ -476,7 +477,7 @@ func BuildGeneralOCR2Config( transmitters = append(transmitters, common.HexToAddress(string(transmitter))) } - log.Info().Msg("Done building OCR2 config") + l.Info().Msg("Done building OCR2 config") return contracts.OCRConfig{ Signers: signers, Transmitters: transmitters, @@ -488,6 +489,7 @@ func BuildGeneralOCR2Config( } func getOracleIdentities(t *testing.T, chainlinkNodes []*client.Chainlink) ([]int, []confighelper.OracleIdentityExtra) { + l := zerolog.New(zerolog.NewTestWriter(t)) S := make([]int, len(chainlinkNodes)) oracleIdentities := make([]confighelper.OracleIdentityExtra, len(chainlinkNodes)) sharedSecretEncryptionPublicKeys := make([]types.ConfigEncryptionPublicKey, len(chainlinkNodes)) @@ -544,6 +546,6 @@ func getOracleIdentities(t *testing.T, chainlinkNodes []*client.Chainlink) ([]in }(i, cl) } wg.Wait() - log.Info().Msg("Done fetching oracle identities") + l.Info().Msg("Done fetching oracle identities") return S, oracleIdentities } diff --git a/integration-tests/actions/operator_forwarder_helpers.go b/integration-tests/actions/operator_forwarder_helpers.go index 3c3008a4eff..d4ac3780382 100644 --- a/integration-tests/actions/operator_forwarder_helpers.go +++ b/integration-tests/actions/operator_forwarder_helpers.go @@ -9,7 +9,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" - "github.com/rs/zerolog/log" + "github.com/rs/zerolog" "github.com/stretchr/testify/require" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" @@ -91,14 +91,15 @@ func ProcessNewEvent( contractABI *abi.ABI, chainClient blockchain.EVMClient, ) { + l := zerolog.New(zerolog.NewTestWriter(t)) errorChan := make(chan error) eventConfirmed := make(chan bool) err := chainClient.ProcessEvent(eventDetails.Name, event, eventConfirmed, errorChan) if err != nil { - log.Error().Err(err).Str("Hash", event.TxHash.Hex()).Str("Event", eventDetails.Name).Msg("Error trying to process event") + l.Error().Err(err).Str("Hash", event.TxHash.Hex()).Str("Event", eventDetails.Name).Msg("Error trying to process event") return } - log.Debug(). + l.Debug(). Str("Event", eventDetails.Name). Str("Address", event.Address.Hex()). Str("Hash", event.TxHash.Hex()). @@ -106,7 +107,7 @@ func ProcessNewEvent( for { select { case err := <-errorChan: - log.Error().Err(err).Msg("Error while confirming event") + l.Error().Err(err).Msg("Error while confirming event") return case confirmed := <-eventConfirmed: if confirmed { @@ -137,6 +138,7 @@ func SubscribeOperatorFactoryEvents( chainClient blockchain.EVMClient, operatorFactoryInstance contracts.OperatorFactory, ) { + l := zerolog.New(zerolog.NewTestWriter(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()) @@ -155,7 +157,7 @@ func SubscribeOperatorFactoryEvents( for { select { case err := <-sub.Err(): - log.Error().Err(err).Msg("Error while watching for new contract events. Retrying Subscription") + l.Error().Err(err).Msg("Error while watching for new contract events. Retrying Subscription") sub.Unsubscribe() sub, err = chainClient.SubscribeFilterLogs(context.Background(), query, eventLogs) @@ -184,10 +186,11 @@ func TrackForwarder( authorizedForwarder common.Address, node *client.Chainlink, ) { + l := zerolog.New(zerolog.NewTestWriter(t)) chainID := chainClient.GetChainID() _, _, err := node.TrackForwarder(chainID, authorizedForwarder) require.NoError(t, err, "Forwarder track should be created") - log.Info().Str("NodeURL", node.Config.URL). + l.Info().Str("NodeURL", node.Config.URL). Str("ForwarderAddress", authorizedForwarder.Hex()). Str("ChaindID", chainID.String()). Msg("Forwarder tracked") diff --git a/integration-tests/actions/vrfv2_helpers.go b/integration-tests/actions/vrfv2_helpers.go index 9dc705f0554..7e4ab5272cd 100644 --- a/integration-tests/actions/vrfv2_helpers.go +++ b/integration-tests/actions/vrfv2_helpers.go @@ -6,7 +6,7 @@ import ( "math/big" "testing" - "github.com/rs/zerolog/log" + "github.com/rs/zerolog" uuid "github.com/satori/go.uuid" "github.com/stretchr/testify/require" @@ -52,11 +52,12 @@ func CreateVRFV2Jobs( c blockchain.EVMClient, minIncomingConfirmations int, ) []VRFV2JobInfo { + l := zerolog.New(zerolog.NewTestWriter(t)) jobInfo := make([]VRFV2JobInfo, 0) for _, n := range chainlinkNodes { vrfKey, err := n.MustCreateVRFKey() require.NoError(t, err, "Error creating VRF key") - log.Debug().Interface("Key JSON", vrfKey).Msg("Created proving key") + l.Debug().Interface("Key JSON", vrfKey).Msg("Created proving key") pubKeyCompressed := vrfKey.Data.ID jobUUID := uuid.NewV4() os := &client.VRFV2TxPipelineSpec{ diff --git a/integration-tests/benchmark/keeper_test.go b/integration-tests/benchmark/keeper_test.go index 45d9d1c43da..4d075f2997a 100644 --- a/integration-tests/benchmark/keeper_test.go +++ b/integration-tests/benchmark/keeper_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/rs/zerolog/log" + "github.com/rs/zerolog" "github.com/stretchr/testify/require" env_client "github.com/smartcontractkit/chainlink-env/client" @@ -158,16 +158,17 @@ type BenchmarkTestEntry struct { } func TestAutomationBenchmark(t *testing.T) { + l := zerolog.New(zerolog.NewTestWriter(t)) testEnvironment, benchmarkNetwork, registryToTest := SetupAutomationBenchmarkEnv(t) if testEnvironment.WillUseRemoteRunner() { return } networkTestName := strings.ReplaceAll(benchmarkNetwork.Name, " ", "") testName := fmt.Sprintf("%s%s", networkTestName, registryToTest) - log.Info().Str("Test Name", testName).Msg("Running Benchmark Test") + l.Info().Str("Test Name", testName).Msg("Running Benchmark Test") benchmarkTestEntry := tests[testName] - log.Info().Str("Namespace", testEnvironment.Cfg.Namespace).Msg("Connected to Keepers Benchmark Environment") + l.Info().Str("Namespace", testEnvironment.Cfg.Namespace).Msg("Connected to Keepers Benchmark Environment") chainClient, err := blockchain.NewEVMClient(benchmarkNetwork, testEnvironment) require.NoError(t, err, "Error connecting to blockchain") @@ -204,7 +205,7 @@ func TestAutomationBenchmark(t *testing.T) { ) t.Cleanup(func() { if err = actions.TeardownRemoteSuite(keeperBenchmarkTest.TearDownVals(t)); err != nil { - log.Error().Err(err).Msg("Error when tearing down remote suite") + l.Error().Err(err).Msg("Error when tearing down remote suite") } }) keeperBenchmarkTest.Setup(t, testEnvironment) @@ -347,6 +348,7 @@ func getEnv(key, fallback string) string { } func SetupAutomationBenchmarkEnv(t *testing.T) (*environment.Environment, blockchain.EVMNetwork, string) { + l := zerolog.New(zerolog.NewTestWriter(t)) registryToTest := getEnv("AUTOMATION_REGISTRY_TO_TEST", "Registry_2_0") activeEVMNetwork := networks.SelectedNetwork // Environment currently being used to run benchmark test on blockTime := "1" @@ -469,7 +471,7 @@ func SetupAutomationBenchmarkEnv(t *testing.T) (*environment.Environment, blockc internalHttpURLs = append(internalHttpURLs, activeEVMNetwork.HTTPURLs[0]) } } - log.Debug().Strs("internalWsURLs", internalWsURLs).Strs("internalHttpURLs", internalHttpURLs).Msg("internalURLs") + l.Debug().Strs("internalWsURLs", internalWsURLs).Strs("internalHttpURLs", internalHttpURLs).Msg("internalURLs") for i := 0; i < NumberOfNodes; i++ { useEnvVars := strings.ToLower(os.Getenv("TEST_USE_ENV_VAR_CONFIG")) diff --git a/integration-tests/chaos/automation_chaos_test.go b/integration-tests/chaos/automation_chaos_test.go index 9f776286f68..923ee5104d4 100644 --- a/integration-tests/chaos/automation_chaos_test.go +++ b/integration-tests/chaos/automation_chaos_test.go @@ -8,7 +8,7 @@ import ( "time" "github.com/onsi/gomega" - "github.com/rs/zerolog/log" + "github.com/rs/zerolog" "github.com/smartcontractkit/chainlink-env/chaos" "github.com/smartcontractkit/chainlink-env/environment" a "github.com/smartcontractkit/chainlink-env/pkg/alias" @@ -107,6 +107,7 @@ const ( func TestAutomationChaos(t *testing.T) { t.Parallel() + l := zerolog.New(zerolog.NewTestWriter(t)) testCases := map[string]struct { networkChart environment.ConnectedChart clChart environment.ConnectedChart @@ -251,7 +252,7 @@ func TestAutomationChaos(t *testing.T) { defaultUpkeepGasLimit, ) - log.Info().Msg("Waiting for all upkeeps to be performed") + l.Info().Msg("Waiting for all upkeeps to be performed") gom := gomega.NewGomegaWithT(t) gom.Eventually(func(g gomega.Gomega) { @@ -260,7 +261,7 @@ func TestAutomationChaos(t *testing.T) { counter, err := consumers[i].Counter(context.Background()) require.NoError(t, err, "Failed to retrieve consumer counter for upkeep at index %d", i) expect := 5 - log.Info().Int64("Upkeeps Performed", counter.Int64()).Int("Upkeep ID", i).Msg("Number of upkeeps performed") + l.Info().Int64("Upkeeps Performed", counter.Int64()).Int("Upkeep ID", i).Msg("Number of upkeeps performed") g.Expect(counter.Int64()).Should(gomega.BeNumerically(">=", int64(expect)), "Expected consumer counter to be greater than %d, but got %d", expect, counter.Int64()) } @@ -275,7 +276,7 @@ func TestAutomationChaos(t *testing.T) { counter, err := consumers[i].Counter(context.Background()) require.NoError(t, err, "Failed to retrieve consumer counter for upkeep at index %d", i) expect := 10 - log.Info().Int64("Upkeeps Performed", counter.Int64()).Int("Upkeep ID", i).Msg("Number of upkeeps performed") + l.Info().Int64("Upkeeps Performed", counter.Int64()).Int("Upkeep ID", i).Msg("Number of upkeeps performed") g.Expect(counter.Int64()).Should(gomega.BeNumerically(">=", int64(expect)), "Expected consumer counter to be greater than %d, but got %d", expect, counter.Int64()) } diff --git a/integration-tests/chaos/ocr2vrf_chaos_test.go b/integration-tests/chaos/ocr2vrf_chaos_test.go index c41dc63f584..ac12b7b92c5 100644 --- a/integration-tests/chaos/ocr2vrf_chaos_test.go +++ b/integration-tests/chaos/ocr2vrf_chaos_test.go @@ -6,6 +6,7 @@ import ( "strings" "testing" + "github.com/rs/zerolog" "github.com/smartcontractkit/chainlink-env/chaos" "github.com/smartcontractkit/chainlink-env/environment" a "github.com/smartcontractkit/chainlink-env/pkg/alias" @@ -24,8 +25,6 @@ import ( "github.com/smartcontractkit/chainlink/integration-tests/client" "github.com/smartcontractkit/chainlink/integration-tests/config" "github.com/smartcontractkit/chainlink/integration-tests/contracts" - - "github.com/rs/zerolog/log" ) var ( @@ -46,6 +45,7 @@ var ( func TestOCR2VRFChaos(t *testing.T) { t.Parallel() + l := zerolog.New(zerolog.NewTestWriter(t)) testCases := map[string]struct { networkChart environment.ConnectedChart clChart environment.ConnectedChart @@ -187,17 +187,17 @@ func TestOCR2VRFChaos(t *testing.T) { for i := uint16(0); i < ocr2vrf_constants.NumberOfRandomWordsToRequest; i++ { randomness, err := consumerContract.GetRandomnessByRequestId(nil, requestID, big.NewInt(int64(i))) require.NoError(t, err) - log.Info().Interface("Random Number", randomness).Interface("Randomness Number Index", i).Msg("Randomness retrieved from Consumer contract") + l.Info().Interface("Random Number", randomness).Interface("Randomness Number Index", i).Msg("Randomness retrieved from Consumer contract") require.NotEqual(t, 0, randomness.Uint64(), "Randomness retrieved from Consumer contract give an answer other than 0") } id, err := testEnvironment.Chaos.Run(testCase.chaosFunc(testEnvironment.Cfg.Namespace, testCase.chaosProps)) require.NoError(t, err, "Error running Chaos Experiment") - log.Info().Msg("Chaos Applied") + l.Info().Msg("Chaos Applied") err = testEnvironment.Chaos.WaitForAllRecovered(id) require.NoError(t, err, "Error waiting for Chaos Experiment to end") - log.Info().Msg("Chaos Recovered") + l.Info().Msg("Chaos Recovered") //Request and Redeem Randomness again to see that after Chaos Experiment whole process is still working requestID = ocr2vrf_actions.RequestAndRedeemRandomness( @@ -213,7 +213,7 @@ func TestOCR2VRFChaos(t *testing.T) { for i := uint16(0); i < ocr2vrf_constants.NumberOfRandomWordsToRequest; i++ { randomness, err := consumerContract.GetRandomnessByRequestId(nil, requestID, big.NewInt(int64(i))) require.NoError(t, err, "Error getting Randomness result from Consumer Contract") - log.Info().Interface("Random Number", randomness).Interface("Randomness Number Index", i).Msg("Randomness retrieved from Consumer contract") + l.Info().Interface("Random Number", randomness).Interface("Randomness Number Index", i).Msg("Randomness retrieved from Consumer contract") require.NotEqual(t, 0, randomness.Uint64(), "Randomness retrieved from Consumer contract give an answer other than 0") } }) diff --git a/integration-tests/chaos/ocr_chaos_test.go b/integration-tests/chaos/ocr_chaos_test.go index 9056fb09f6a..dd0eb4e5305 100644 --- a/integration-tests/chaos/ocr_chaos_test.go +++ b/integration-tests/chaos/ocr_chaos_test.go @@ -7,7 +7,7 @@ import ( "os" "testing" - "github.com/rs/zerolog/log" + "github.com/rs/zerolog" a "github.com/smartcontractkit/chainlink-env/pkg/alias" "github.com/smartcontractkit/chainlink-env/pkg/helm/chainlink" "github.com/smartcontractkit/chainlink-env/pkg/helm/ethereum" @@ -62,6 +62,7 @@ func TestMain(m *testing.M) { func TestOCRChaos(t *testing.T) { t.Parallel() + l := zerolog.New(zerolog.NewTestWriter(t)) testCases := map[string]struct { networkChart environment.ConnectedChart clChart environment.ConnectedChart @@ -201,7 +202,7 @@ func TestOCRChaos(t *testing.T) { } round, err := ocrInstances[0].GetLatestRound(context.Background()) g.Expect(err).ShouldNot(gomega.HaveOccurred()) - log.Info().Int64("RoundID", round.RoundId.Int64()).Msg("Latest OCR Round") + l.Info().Int64("RoundID", round.RoundId.Int64()).Msg("Latest OCR Round") if round.RoundId.Int64() == chaosStartRound && !chaosApplied { chaosApplied = true _, err = testEnvironment.Chaos.Run(testCase.chaosFunc(testEnvironment.Cfg.Namespace, testCase.chaosProps)) diff --git a/integration-tests/migration/migration_up_test.go b/integration-tests/migration/migration_up_test.go index 8e2ca589758..f804685c972 100644 --- a/integration-tests/migration/migration_up_test.go +++ b/integration-tests/migration/migration_up_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/rs/zerolog/log" + "github.com/rs/zerolog" "github.com/stretchr/testify/require" "github.com/smartcontractkit/chainlink-env/environment" @@ -29,6 +29,7 @@ func TestMain(m *testing.M) { } func TestMigrationDatabase(t *testing.T) { + l := zerolog.New(zerolog.NewTestWriter(t)) testEnvironment, err := testsetups.DBMigration(&testsetups.DBMigrationSpec{ FromSpec: testsetups.FromVersionSpec{ Image: "public.ecr.aws/chainlink/chainlink", @@ -46,7 +47,7 @@ func TestMigrationDatabase(t *testing.T) { var d []Data err = db.Select(&d, "select * from evm_chains;") require.NoError(t, err, "Error running SELECT") - log.Info().Interface("Rows", d).Send() + l.Info().Interface("Rows", d).Send() } func getDB(t *testing.T, testEnvironment *environment.Environment) *ctfClient.PostgresConnector { diff --git a/integration-tests/performance/directrequest_test.go b/integration-tests/performance/directrequest_test.go index eba7757175b..77fedba4e1f 100644 --- a/integration-tests/performance/directrequest_test.go +++ b/integration-tests/performance/directrequest_test.go @@ -9,6 +9,7 @@ import ( "time" "github.com/onsi/gomega" + "github.com/rs/zerolog" "github.com/smartcontractkit/chainlink-env/environment" "github.com/smartcontractkit/chainlink-env/pkg/helm/chainlink" "github.com/smartcontractkit/chainlink-env/pkg/helm/ethereum" @@ -16,18 +17,19 @@ 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/stretchr/testify/require" + networks "github.com/smartcontractkit/chainlink/integration-tests" "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/testsetups" - "github.com/stretchr/testify/require" - "github.com/rs/zerolog/log" uuid "github.com/satori/go.uuid" ) func TestDirectRequestPerformance(t *testing.T) { + l := zerolog.New(zerolog.NewTestWriter(t)) testEnvironment := setupDirectRequestTest(t) if testEnvironment.WillUseRemoteRunner() { return @@ -107,7 +109,7 @@ func TestDirectRequestPerformance(t *testing.T) { d, err := consumer.Data(context.Background()) g.Expect(err).ShouldNot(gomega.HaveOccurred(), "Getting data from consumer contract shouldn't fail") g.Expect(d).ShouldNot(gomega.BeNil(), "Expected the initial on chain data to be nil") - log.Debug().Int64("Data", d.Int64()).Msg("Found on chain") + l.Debug().Int64("Data", d.Int64()).Msg("Found on chain") g.Expect(d.Int64()).Should(gomega.BeNumerically("==", 5), "Expected the on-chain data to be 5, but found %d", d.Int64()) }, "2m", "1s").Should(gomega.Succeed()) } diff --git a/integration-tests/performance/flux_test.go b/integration-tests/performance/flux_test.go index d52c0b8aa9d..4441a225f82 100644 --- a/integration-tests/performance/flux_test.go +++ b/integration-tests/performance/flux_test.go @@ -9,6 +9,7 @@ import ( "time" "github.com/ethereum/go-ethereum/common" + "github.com/rs/zerolog" "github.com/stretchr/testify/require" "github.com/smartcontractkit/chainlink-env/environment" @@ -18,17 +19,18 @@ 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" + networks "github.com/smartcontractkit/chainlink/integration-tests" "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/testsetups" - "github.com/rs/zerolog/log" uuid "github.com/satori/go.uuid" ) func TestFluxPerformance(t *testing.T) { + l := zerolog.New(zerolog.NewTestWriter(t)) testEnvironment, testNetwork := setupFluxTest(t) if testEnvironment.WillUseRemoteRunner() { return @@ -84,7 +86,7 @@ func TestFluxPerformance(t *testing.T) { require.NoError(t, err, "Waiting for event subscriptions in nodes shouldn't fail") oracles, err := fluxInstance.GetOracles(context.Background()) require.NoError(t, err, "Getting oracle details from the Flux aggregator contract shouldn't fail") - log.Info().Str("Oracles", strings.Join(oracles, ",")).Msg("Oracles set") + l.Info().Str("Oracles", strings.Join(oracles, ",")).Msg("Oracles set") adapterFullURL := fmt.Sprintf("%s%s", mockServer.Config.ClusterURL, adapterPath) bta := client.BridgeTypeAttributes{ @@ -120,7 +122,7 @@ func TestFluxPerformance(t *testing.T) { require.NoError(t, err, "Waiting for event subscriptions in nodes shouldn't fail") data, err := fluxInstance.GetContractData(context.Background()) require.NoError(t, err, "Getting contract data from flux aggregator contract shouldn't fail") - log.Info().Interface("Data", data).Msg("Round data") + l.Info().Interface("Data", data).Msg("Round data") require.Equal(t, int64(1e5), data.LatestRoundData.Answer.Int64(), "Expected latest round answer to be %d, but found %d", int64(1e5), data.LatestRoundData.Answer.Int64()) require.Equal(t, int64(1), data.LatestRoundData.RoundId.Int64(), @@ -148,7 +150,7 @@ func TestFluxPerformance(t *testing.T) { "Expected available funds to be %d, but found %d", int64(999999999999999994), data.AvailableFunds.Int64()) require.Equal(t, int64(6), data.AllocatedFunds.Int64(), "Expected allocated funds to be %d, but found %d", int64(6), data.AllocatedFunds.Int64()) - log.Info().Interface("data", data).Msg("Round data") + l.Info().Interface("data", data).Msg("Round data") for _, oracleAddr := range nodeAddresses { payment, _ := fluxInstance.WithdrawablePayment(context.Background(), oracleAddr) diff --git a/integration-tests/performance/keeper_test.go b/integration-tests/performance/keeper_test.go index 681022e5e1a..f9e53be3e83 100644 --- a/integration-tests/performance/keeper_test.go +++ b/integration-tests/performance/keeper_test.go @@ -10,6 +10,7 @@ import ( "time" "github.com/onsi/gomega" + "github.com/rs/zerolog" "github.com/smartcontractkit/chainlink-env/environment" "github.com/smartcontractkit/chainlink-env/pkg/helm/chainlink" eth "github.com/smartcontractkit/chainlink-env/pkg/helm/ethereum" @@ -24,8 +25,6 @@ import ( "github.com/smartcontractkit/chainlink/integration-tests/client" "github.com/smartcontractkit/chainlink/integration-tests/contracts" "github.com/smartcontractkit/chainlink/integration-tests/testsetups" - - "github.com/rs/zerolog/log" ) var keeperDefaultRegistryConfig = contracts.KeeperRegistrySettings{ @@ -44,6 +43,7 @@ var keeperDefaultRegistryConfig = contracts.KeeperRegistrySettings{ } func TestKeeperPerformance(t *testing.T) { + l := zerolog.New(zerolog.NewTestWriter(t)) testEnvironment, chainClient, chainlinkNodes, contractDeployer, linkToken := setupKeeperTest(t, "basic-smoke") if testEnvironment.WillUseRemoteRunner() { return @@ -77,7 +77,7 @@ func TestKeeperPerformance(t *testing.T) { g.Expect(err).ShouldNot(gomega.HaveOccurred(), "Failed to retrieve consumer counter for upkeep at index %d", i) g.Expect(counter.Int64()).Should(gomega.BeNumerically(">", int64(10)), "Expected consumer counter to be greater than 10, but got %d", counter.Int64()) - log.Info().Int64("Upkeep counter", counter.Int64()).Msg("Number of upkeeps performed") + l.Info().Int64("Upkeep counter", counter.Int64()).Msg("Number of upkeeps performed") } }, "5m", "1s").Should(gomega.Succeed()) @@ -96,7 +96,7 @@ func TestKeeperPerformance(t *testing.T) { // Obtain the amount of times the upkeep has been executed so far countersAfterCancellation[i], err = consumers[i].Counter(context.Background()) require.NoError(t, err, "Failed to retrieve consumer counter for upkeep at index %d", i) - log.Info().Int("Index", i).Int64("Upkeeps Performed", countersAfterCancellation[i].Int64()).Msg("Cancelled Upkeep") + l.Info().Int("Index", i).Int64("Upkeeps Performed", countersAfterCancellation[i].Int64()).Msg("Cancelled Upkeep") } gom.Consistently(func(g gomega.Gomega) { diff --git a/integration-tests/performance/vrf_test.go b/integration-tests/performance/vrf_test.go index 168f3500310..3bf62bcb872 100644 --- a/integration-tests/performance/vrf_test.go +++ b/integration-tests/performance/vrf_test.go @@ -9,7 +9,7 @@ import ( "time" "github.com/onsi/gomega" - "github.com/rs/zerolog/log" + "github.com/rs/zerolog" uuid "github.com/satori/go.uuid" "github.com/stretchr/testify/require" @@ -17,6 +17,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" + networks "github.com/smartcontractkit/chainlink/integration-tests" "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/client" @@ -26,6 +27,7 @@ import ( func TestVRFBasic(t *testing.T) { t.Parallel() + l := zerolog.New(zerolog.NewTestWriter(t)) testEnvironment, testNetwork := setupVRFTest(t) if testEnvironment.WillUseRemoteRunner() { return @@ -63,7 +65,7 @@ func TestVRFBasic(t *testing.T) { profileFunction := func(chainlinkNode *client.Chainlink) { nodeKey, err := chainlinkNode.MustCreateVRFKey() require.NoError(t, err, "Creating VRF key shouldn't fail") - log.Debug().Interface("Key JSON", nodeKey).Msg("Created proving key") + l.Debug().Interface("Key JSON", nodeKey).Msg("Created proving key") pubKeyCompressed := nodeKey.Data.ID jobUUID := uuid.NewV4() os := &client.VRFTxPipelineSpec{ @@ -117,7 +119,7 @@ func TestVRFBasic(t *testing.T) { // There's a better formula to ensure that VRF response is as expected, detailed under Technical Walkthrough. // https://blog.chain.link/chainlink-vrf-on-chain-verifiable-randomness/ g.Expect(out.Uint64()).ShouldNot(gomega.BeNumerically("==", 0), "Expected the VRF job give an answer other than 0") - log.Debug().Uint64("Output", out.Uint64()).Msg("Randomness fulfilled") + l.Debug().Uint64("Output", out.Uint64()).Msg("Randomness fulfilled") }, timeout, "1s").Should(gomega.Succeed()) } profileTest := testsetups.NewChainlinkProfileTest(testsetups.ChainlinkProfileTestInputs{ diff --git a/integration-tests/smoke/automation_test.go b/integration-tests/smoke/automation_test.go index 140668168c0..9aa58dc69a1 100644 --- a/integration-tests/smoke/automation_test.go +++ b/integration-tests/smoke/automation_test.go @@ -10,9 +10,8 @@ import ( "testing" "time" - "github.com/rs/zerolog/log" - "github.com/onsi/gomega" + "github.com/rs/zerolog" "github.com/smartcontractkit/chainlink-env/environment" "github.com/smartcontractkit/chainlink-env/logging" @@ -117,7 +116,7 @@ func TestMain(m *testing.M) { func TestAutomatedBasic(t *testing.T) { t.Parallel() - + l := zerolog.New(zerolog.NewTestWriter(t)) chainClient, _, contractDeployer, linkToken, registry, registrar, onlyStartRunner := setupAutomationTest( t, "basic-upkeep", ethereum.RegistryVersion_2_0, defaultOCRRegistryConfig, ) @@ -137,7 +136,7 @@ func TestAutomatedBasic(t *testing.T) { automationDefaultUpkeepGasLimit, ) - log.Info().Msg("Waiting for all upkeeps to be performed") + l.Info().Msg("Waiting for all upkeeps to be performed") gom := gomega.NewGomegaWithT(t) gom.Eventually(func(g gomega.Gomega) { // Check if the upkeeps are performing multiple times by analyzing their counters and checking they are greater than 10 @@ -145,7 +144,7 @@ func TestAutomatedBasic(t *testing.T) { counter, err := consumers[i].Counter(context.Background()) require.NoError(t, err, "Failed to retrieve consumer counter for upkeep at index %d", i) expect := 5 - log.Info().Int64("Upkeeps Performed", counter.Int64()).Int("Upkeep ID", i).Msg("Number of upkeeps performed") + l.Info().Int64("Upkeeps Performed", counter.Int64()).Int("Upkeep ID", i).Msg("Number of upkeeps performed") g.Expect(counter.Int64()).Should(gomega.BeNumerically(">=", int64(expect)), "Expected consumer counter to be greater than %d, but got %d", expect, counter.Int64()) } @@ -166,10 +165,10 @@ func TestAutomatedBasic(t *testing.T) { // Obtain the amount of times the upkeep has been executed so far countersAfterCancellation[i], err = consumers[i].Counter(context.Background()) require.NoError(t, err, "Failed to retrieve consumer counter for upkeep at index %d", i) - log.Info().Int64("Upkeep Count", countersAfterCancellation[i].Int64()).Int("Upkeep Index", i).Msg("Cancelled upkeep") + l.Info().Int64("Upkeep Count", countersAfterCancellation[i].Int64()).Int("Upkeep Index", i).Msg("Cancelled upkeep") } - log.Info().Msg("Making sure the counter stays consistent") + l.Info().Msg("Making sure the counter stays consistent") gom.Consistently(func(g gomega.Gomega) { for i := 0; i < len(upkeepIDs); i++ { // Expect the counter to remain constant (At most increase by 1 to account for stale performs) because the upkeep was cancelled @@ -236,7 +235,7 @@ func TestAutomatedAddFunds(t *testing.T) { func TestAutomatedPauseUnPause(t *testing.T) { t.Parallel() - + l := zerolog.New(zerolog.NewTestWriter(t)) chainClient, _, contractDeployer, linkToken, registry, registrar, onlyStartRunner := setupAutomationTest( t, "pause-unpause", ethereum.RegistryVersion_2_0, defaultOCRRegistryConfig, ) @@ -264,7 +263,7 @@ func TestAutomatedPauseUnPause(t *testing.T) { g.Expect(err).ShouldNot(gomega.HaveOccurred(), "Failed to retrieve consumer counter for upkeep at index %d", i) g.Expect(counter.Int64()).Should(gomega.BeNumerically(">", int64(5)), "Expected consumer counter to be greater than 5, but got %d", counter.Int64()) - log.Info().Int("Upkeep Index", i).Int64("Upkeep counter", counter.Int64()).Msg("Number of upkeeps performed") + l.Info().Int("Upkeep Index", i).Int64("Upkeep counter", counter.Int64()).Msg("Number of upkeeps performed") } }, "5m", "1s").Should(gomega.Succeed()) // ~1m for cluster setup, ~2m for performing each upkeep 5 times, ~2m buffer @@ -282,7 +281,7 @@ func TestAutomatedPauseUnPause(t *testing.T) { // Obtain the amount of times the upkeep has been executed so far countersAfterPause[i], err = consumers[i].Counter(context.Background()) require.NoError(t, err, "Failed to retrieve consumer counter for upkeep at index %d", i) - log.Info().Int("Upkeep Index", i).Int64("Upkeeps Performed", countersAfterPause[i].Int64()).Msg("Paused Upkeep") + l.Info().Int("Upkeep Index", i).Int64("Upkeeps Performed", countersAfterPause[i].Int64()).Msg("Paused Upkeep") } gom.Consistently(func(g gomega.Gomega) { @@ -313,14 +312,14 @@ func TestAutomatedPauseUnPause(t *testing.T) { g.Expect(err).ShouldNot(gomega.HaveOccurred(), "Failed to retrieve consumer counter for upkeep at index %d", i) g.Expect(counter.Int64()).Should(gomega.BeNumerically(">", countersAfterPause[i].Int64()+1), "Expected consumer counter to be greater than %d, but got %d", countersAfterPause[i].Int64()+1, counter.Int64()) - log.Info().Int64("Upkeep counter", counter.Int64()).Msg("Number of upkeeps performed") + l.Info().Int64("Upkeep counter", counter.Int64()).Msg("Number of upkeeps performed") } }, "2m", "1s").Should(gomega.Succeed()) // ~1m to perform, 1m buffer } func TestAutomatedRegisterUpkeep(t *testing.T) { t.Parallel() - + l := zerolog.New(zerolog.NewTestWriter(t)) chainClient, _, contractDeployer, linkToken, registry, registrar, onlyStartRunner := setupAutomationTest( t, "register-upkeep", ethereum.RegistryVersion_2_0, defaultOCRRegistryConfig, ) @@ -351,7 +350,7 @@ func TestAutomatedRegisterUpkeep(t *testing.T) { g.Expect(err).ShouldNot(gomega.HaveOccurred(), "Failed to retrieve consumer counter for upkeep at index %d", i) g.Expect(counter.Int64()).Should(gomega.BeNumerically(">", int64(0)), "Expected consumer counter to be greater than 0, but got %d", counter.Int64()) - log.Info(). + l.Info(). Int64("Upkeep counter", counter.Int64()). Int64("Upkeep ID", int64(i)). Msg("Number of upkeeps performed") @@ -370,7 +369,7 @@ func TestAutomatedRegisterUpkeep(t *testing.T) { g.Expect(err).ShouldNot(gomega.HaveOccurred(), "Calling newly deployed upkeep's counter shouldn't fail") g.Expect(counter.Int64()).Should(gomega.BeNumerically(">", int64(0)), "Expected newly registered upkeep's counter to be greater than 0, but got %d", counter.Int64()) - log.Info().Int64("Upkeeps Performed", counter.Int64()).Msg("Newly Registered Upkeep") + l.Info().Int64("Upkeeps Performed", counter.Int64()).Msg("Newly Registered Upkeep") }, "2m", "1s").Should(gomega.Succeed()) // ~1m for upkeep to perform, 1m buffer gom.Eventually(func(g gomega.Gomega) { @@ -378,7 +377,7 @@ func TestAutomatedRegisterUpkeep(t *testing.T) { currentCounter, err := consumers[i].Counter(context.Background()) g.Expect(err).ShouldNot(gomega.HaveOccurred(), "Calling consumer's counter shouldn't fail") - log.Info(). + l.Info(). Int64("Upkeep ID", int64(i)). Int64("Upkeep counter", currentCounter.Int64()). Int64("initial counter", initialCounters[i].Int64()). @@ -452,7 +451,7 @@ func TestAutomatedPauseRegistry(t *testing.T) { func TestAutomatedKeeperNodesDown(t *testing.T) { t.Parallel() - + l := zerolog.New(zerolog.NewTestWriter(t)) chainClient, chainlinkNodes, contractDeployer, linkToken, registry, registrar, onlyStartRunner := setupAutomationTest( t, "keeper-nodes-down", ethereum.RegistryVersion_2_0, defaultOCRRegistryConfig, ) @@ -493,7 +492,7 @@ func TestAutomatedKeeperNodesDown(t *testing.T) { err = chainClient.WaitForEvents() require.NoError(t, err, "Error waiting for blockchain events") - log.Info().Msg("Successfully managed to take down the first half of the nodes") + l.Info().Msg("Successfully managed to take down the first half of the nodes") // Assert that upkeeps are still performed and their counters have increased gom.Eventually(func(g gomega.Gomega) { @@ -514,14 +513,14 @@ func TestAutomatedKeeperNodesDown(t *testing.T) { err = chainClient.WaitForEvents() require.NoError(t, err, "Error waiting for blockchain events") } - log.Info().Msg("Successfully managed to take down the second half of the nodes") + l.Info().Msg("Successfully managed to take down the second half of the nodes") // See how many times each upkeep was executed var countersAfterNoMoreNodes = make([]*big.Int, len(upkeepIDs)) for i := 0; i < len(upkeepIDs); i++ { countersAfterNoMoreNodes[i], err = consumers[i].Counter(context.Background()) require.NoError(t, err, "Failed to retrieve consumer counter for upkeep at index %d", i) - log.Info().Int("Upkeep Index", i).Int64("Performed", countersAfterNoMoreNodes[i].Int64()).Msg("Upkeeps Performed") + l.Info().Int("Upkeep Index", i).Int64("Performed", countersAfterNoMoreNodes[i].Int64()).Msg("Upkeeps Performed") } // Once all the nodes are taken down, there might be some straggling transactions which went through before @@ -594,7 +593,7 @@ func TestAutomatedPerformSimulation(t *testing.T) { func TestAutomatedCheckPerformGasLimit(t *testing.T) { t.Parallel() - + l := zerolog.New(zerolog.NewTestWriter(t)) chainClient, chainlinkNodes, contractDeployer, linkToken, registry, registrar, onlyStartRunner := setupAutomationTest( t, "gas-limit", ethereum.RegistryVersion_2_0, defaultOCRRegistryConfig, ) @@ -657,7 +656,7 @@ func TestAutomatedCheckPerformGasLimit(t *testing.T) { // Get existing performed count existingCnt, err := consumerPerformance.GetUpkeepCount(context.Background()) require.NoError(t, err, "Calling consumer's counter shouldn't fail") - log.Info().Int64("Upkeep counter", existingCnt.Int64()).Msg("Upkeep counter when check gas increased") + l.Info().Int64("Upkeep counter", existingCnt.Int64()).Msg("Upkeep counter when check gas increased") // In most cases count should remain constant, but it might increase by upto 1 due to pending perform gom.Consistently(func(g gomega.Gomega) { @@ -672,7 +671,7 @@ func TestAutomatedCheckPerformGasLimit(t *testing.T) { existingCnt, err = consumerPerformance.GetUpkeepCount(context.Background()) require.NoError(t, err, "Calling consumer's counter shouldn't fail") existingCntInt := existingCnt.Int64() - log.Info().Int64("Upkeep counter", existingCntInt).Msg("Upkeep counter when consistently block finished") + l.Info().Int64("Upkeep counter", existingCntInt).Msg("Upkeep counter when consistently block finished") // Now increase checkGasLimit on registry highCheckGasLimit := automationDefaultRegistryConfig @@ -695,6 +694,7 @@ func TestAutomatedCheckPerformGasLimit(t *testing.T) { func TestUpdateCheckData(t *testing.T) { t.Parallel() + l := zerolog.New(zerolog.NewTestWriter(t)) chainClient, _, contractDeployer, linkToken, registry, registrar, onlyStartRunner := setupAutomationTest( t, "update-check-data", ethereum.RegistryVersion_2_0, defaultOCRRegistryConfig, ) @@ -724,7 +724,7 @@ func TestUpdateCheckData(t *testing.T) { " for upkeep at index "+strconv.Itoa(i)) g.Expect(counter.Int64()).Should(gomega.Equal(int64(0)), "Expected perform data checker counter to be 0, but got %d", counter.Int64()) - log.Info().Int64("Upkeep perform data checker", counter.Int64()).Msg("Number of upkeeps performed") + l.Info().Int64("Upkeep perform data checker", counter.Int64()).Msg("Number of upkeeps performed") } }, "2m", "1s").Should(gomega.Succeed()) // ~1m for setup, 1m assertion @@ -751,7 +751,7 @@ func TestUpdateCheckData(t *testing.T) { " for upkeep at index "+strconv.Itoa(i)) g.Expect(counter.Int64()).Should(gomega.BeNumerically(">", int64(0)), "Expected perform data checker counter to be greater than 0, but got %d", counter.Int64()) - log.Info().Int64("Upkeep perform data checker", counter.Int64()).Msg("Number of upkeeps performed") + l.Info().Int64("Upkeep perform data checker", counter.Int64()).Msg("Number of upkeeps performed") } }, "2m", "1s").Should(gomega.Succeed()) // ~1m to perform once, 1m buffer } diff --git a/integration-tests/smoke/flux_test.go b/integration-tests/smoke/flux_test.go index a551322ccdc..35221251511 100644 --- a/integration-tests/smoke/flux_test.go +++ b/integration-tests/smoke/flux_test.go @@ -9,6 +9,7 @@ import ( "time" "github.com/ethereum/go-ethereum/common" + "github.com/rs/zerolog" "github.com/stretchr/testify/require" "go.uber.org/zap/zapcore" @@ -26,12 +27,12 @@ import ( "github.com/smartcontractkit/chainlink/integration-tests/client" "github.com/smartcontractkit/chainlink/integration-tests/contracts" - "github.com/rs/zerolog/log" uuid "github.com/satori/go.uuid" ) func TestFluxBasic(t *testing.T) { t.Parallel() + l := zerolog.New(zerolog.NewTestWriter(t)) testEnvironment, testNetwork := setupFluxTest(t) if testEnvironment.WillUseRemoteRunner() { return @@ -92,7 +93,7 @@ func TestFluxBasic(t *testing.T) { require.NoError(t, err, "Waiting for event subscriptions in nodes shouldn't fail") oracles, err := fluxInstance.GetOracles(context.Background()) require.NoError(t, err, "Getting oracle details from the Flux aggregator contract shouldn't fail") - log.Info().Str("Oracles", strings.Join(oracles, ",")).Msg("Oracles set") + l.Info().Str("Oracles", strings.Join(oracles, ",")).Msg("Oracles set") adapterFullURL := fmt.Sprintf("%s%s", mockServer.Config.ClusterURL, adapterPath) bta := client.BridgeTypeAttributes{ @@ -124,7 +125,7 @@ func TestFluxBasic(t *testing.T) { require.NoError(t, err, "Waiting for event subscriptions in nodes shouldn't fail") data, err := fluxInstance.GetContractData(context.Background()) require.NoError(t, err, "Getting contract data from flux aggregator contract shouldn't fail") - log.Info().Interface("Data", data).Msg("Round data") + l.Info().Interface("Data", data).Msg("Round data") require.Equal(t, int64(1e5), data.LatestRoundData.Answer.Int64(), "Expected latest round answer to be %d, but found %d", int64(1e5), data.LatestRoundData.Answer.Int64()) require.Equal(t, int64(1), data.LatestRoundData.RoundId.Int64(), @@ -152,7 +153,7 @@ func TestFluxBasic(t *testing.T) { "Expected available funds to be %d, but found %d", int64(999999999999999994), data.AvailableFunds.Int64()) require.Equal(t, int64(6), data.AllocatedFunds.Int64(), "Expected allocated funds to be %d, but found %d", int64(6), data.AllocatedFunds.Int64()) - log.Info().Interface("data", data).Msg("Round data") + l.Info().Interface("data", data).Msg("Round data") for _, oracleAddr := range nodeAddresses { payment, _ := fluxInstance.WithdrawablePayment(context.Background(), oracleAddr) diff --git a/integration-tests/smoke/keeper_test.go b/integration-tests/smoke/keeper_test.go index 26f191255c9..a5ebe8d6836 100644 --- a/integration-tests/smoke/keeper_test.go +++ b/integration-tests/smoke/keeper_test.go @@ -11,7 +11,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/onsi/gomega" - "github.com/rs/zerolog/log" + "github.com/rs/zerolog" "github.com/smartcontractkit/chainlink-env/environment" "github.com/smartcontractkit/chainlink-env/pkg/helm/chainlink" eth "github.com/smartcontractkit/chainlink-env/pkg/helm/ethereum" @@ -92,6 +92,7 @@ var ( func TestKeeperBasicSmoke(t *testing.T) { t.Parallel() + l := zerolog.New(zerolog.NewTestWriter(t)) registryVersions := map[string]ethereum.KeeperRegistryVersion{ "registry_1_1": ethereum.RegistryVersion_1_1, "registry_1_2": ethereum.RegistryVersion_1_2, @@ -131,7 +132,7 @@ func TestKeeperBasicSmoke(t *testing.T) { g.Expect(err).ShouldNot(gomega.HaveOccurred(), "Failed to retrieve consumer counter for upkeep at index %d", i) g.Expect(counter.Int64()).Should(gomega.BeNumerically(">", int64(10)), "Expected consumer counter to be greater than 10, but got %d", counter.Int64()) - log.Info().Int64("Upkeep counter", counter.Int64()).Msg("Number of upkeeps performed") + l.Info().Int64("Upkeep counter", counter.Int64()).Msg("Number of upkeeps performed") } }, "5m", "1s").Should(gomega.Succeed()) @@ -150,7 +151,7 @@ func TestKeeperBasicSmoke(t *testing.T) { // Obtain the amount of times the upkeep has been executed so far countersAfterCancellation[i], err = consumers[i].Counter(context.Background()) require.NoError(t, err, "Failed to retrieve consumer counter for upkeep at index %d", i) - log.Info().Int("Index", i).Int64("Upkeeps Performed", countersAfterCancellation[i].Int64()).Msg("Cancelled Upkeep") + l.Info().Int("Index", i).Int64("Upkeeps Performed", countersAfterCancellation[i].Int64()).Msg("Cancelled Upkeep") } gom.Consistently(func(g gomega.Gomega) { @@ -169,6 +170,7 @@ func TestKeeperBasicSmoke(t *testing.T) { func TestKeeperBlockCountPerTurn(t *testing.T) { t.Parallel() + l := zerolog.New(zerolog.NewTestWriter(t)) registryVersions := map[string]ethereum.KeeperRegistryVersion{ "registry_1_1": ethereum.RegistryVersion_1_1, "registry_1_2": ethereum.RegistryVersion_1_2, @@ -208,17 +210,17 @@ func TestKeeperBlockCountPerTurn(t *testing.T) { gom.Eventually(func(g gomega.Gomega) { counter, err := consumers[0].Counter(context.Background()) g.Expect(err).ShouldNot(gomega.HaveOccurred(), "Calling consumer's counter shouldn't fail") - log.Info().Int64("Upkeep counter", counter.Int64()).Msg("Number of upkeeps performed") + l.Info().Int64("Upkeep counter", counter.Int64()).Msg("Number of upkeeps performed") upkeepInfo, err := registry.GetUpkeepInfo(context.Background(), upkeepID) g.Expect(err).ShouldNot(gomega.HaveOccurred(), "Registry's getUpkeep shouldn't fail") latestKeeper := upkeepInfo.LastKeeper - log.Info().Str("keeper", latestKeeper).Msg("last keeper to perform upkeep") + l.Info().Str("keeper", latestKeeper).Msg("last keeper to perform upkeep") g.Expect(latestKeeper).ShouldNot(gomega.Equal(actions.ZeroAddress.String()), "Last keeper should be non zero") g.Expect(latestKeeper).ShouldNot(gomega.BeElementOf(keepersPerformed), "A new keeper node should perform this upkeep") - log.Info().Str("keeper", latestKeeper).Msg("New keeper performed upkeep") + l.Info().Str("keeper", latestKeeper).Msg("New keeper performed upkeep") keepersPerformed = append(keepersPerformed, latestKeeper) }, "1m", "1s").Should(gomega.Succeed()) @@ -230,7 +232,7 @@ func TestKeeperBlockCountPerTurn(t *testing.T) { g.Expect(latestKeeper).ShouldNot(gomega.Equal(actions.ZeroAddress.String()), "Last keeper should be non zero") g.Expect(latestKeeper).ShouldNot(gomega.BeElementOf(keepersPerformed), "A new keeper node should perform this upkeep") - log.Info().Str("Keeper", latestKeeper).Msg("New keeper performed upkeep") + l.Info().Str("Keeper", latestKeeper).Msg("New keeper performed upkeep") keepersPerformed = append(keepersPerformed, latestKeeper) }, "1m", "1s").Should(gomega.Succeed()) @@ -254,17 +256,17 @@ func TestKeeperBlockCountPerTurn(t *testing.T) { gom.Eventually(func(g gomega.Gomega) { counter, err := consumers[0].Counter(context.Background()) g.Expect(err).ShouldNot(gomega.HaveOccurred(), "Calling consumer's counter shouldn't fail") - log.Info().Int64("Upkeep counter", counter.Int64()).Msg("Num upkeeps performed") + l.Info().Int64("Upkeep counter", counter.Int64()).Msg("Num upkeeps performed") upkeepInfo, err := registry.GetUpkeepInfo(context.Background(), upkeepID) g.Expect(err).ShouldNot(gomega.HaveOccurred(), "Registry's getUpkeep shouldn't fail") latestKeeper := upkeepInfo.LastKeeper - log.Info().Str("keeper", latestKeeper).Msg("last keeper to perform upkeep") + l.Info().Str("keeper", latestKeeper).Msg("last keeper to perform upkeep") g.Expect(latestKeeper).ShouldNot(gomega.Equal(actions.ZeroAddress.String()), "Last keeper should be non zero") g.Expect(latestKeeper).ShouldNot(gomega.BeElementOf(keepersPerformed), "A new keeper node should perform this upkeep") - log.Info().Str("keeper", latestKeeper).Msg("New keeper performed upkeep") + l.Info().Str("keeper", latestKeeper).Msg("New keeper performed upkeep") keepersPerformed = append(keepersPerformed, latestKeeper) }, "1m", "1s").Should(gomega.Succeed()) }) @@ -347,6 +349,7 @@ func TestKeeperSimulation(t *testing.T) { func TestKeeperCheckPerformGasLimit(t *testing.T) { t.Parallel() + l := zerolog.New(zerolog.NewTestWriter(t)) registryVersions := map[string]ethereum.KeeperRegistryVersion{ "registry_1_2": ethereum.RegistryVersion_1_2, "registry_1_3": ethereum.RegistryVersion_1_3, @@ -419,7 +422,7 @@ func TestKeeperCheckPerformGasLimit(t *testing.T) { // Get existing performed count existingCnt, err := consumerPerformance.GetUpkeepCount(context.Background()) require.NoError(t, err, "Error calling consumer's counter") - log.Info().Int64("Upkeep counter", existingCnt.Int64()).Msg("Check Gas Increased") + l.Info().Int64("Upkeep counter", existingCnt.Int64()).Msg("Check Gas Increased") // In most cases count should remain constant, but there might be a straggling perform tx which // gets committed later. Since every keeper node cannot have more than 1 straggling tx, it @@ -436,7 +439,7 @@ func TestKeeperCheckPerformGasLimit(t *testing.T) { existingCnt, err = consumerPerformance.GetUpkeepCount(context.Background()) require.NoError(t, err, "Error calling consumer's counter") existingCntInt := existingCnt.Int64() - log.Info().Int64("Upkeep counter", existingCntInt).Msg("Upkeep counter when consistently block finished") + l.Info().Int64("Upkeep counter", existingCntInt).Msg("Upkeep counter when consistently block finished") // Now increase checkGasLimit on registry highCheckGasLimit := keeperDefaultRegistryConfig @@ -460,6 +463,7 @@ func TestKeeperCheckPerformGasLimit(t *testing.T) { func TestKeeperRegisterUpkeep(t *testing.T) { t.Parallel() + l := zerolog.New(zerolog.NewTestWriter(t)) registryVersions := map[string]ethereum.KeeperRegistryVersion{ "registry_1_1": ethereum.RegistryVersion_1_1, "registry_1_2": ethereum.RegistryVersion_1_2, @@ -504,7 +508,7 @@ func TestKeeperRegisterUpkeep(t *testing.T) { " for upkeep at index "+strconv.Itoa(i)) g.Expect(counter.Int64()).Should(gomega.BeNumerically(">", int64(0)), "Expected consumer counter to be greater than 0, but got %d", counter.Int64()) - log.Info(). + l.Info(). Int64("Upkeep counter", counter.Int64()). Int("Upkeep ID", i). Msg("Number of upkeeps performed") @@ -523,7 +527,7 @@ func TestKeeperRegisterUpkeep(t *testing.T) { g.Expect(err).ShouldNot(gomega.HaveOccurred(), "Calling newly deployed upkeep's counter shouldn't fail") g.Expect(counter.Int64()).Should(gomega.BeNumerically(">", int64(0)), "Expected newly registered upkeep's counter to be greater than 0, but got %d", counter.Int64()) - log.Info().Msg("Newly registered upkeeps performed " + strconv.Itoa(int(counter.Int64())) + " times") + l.Info().Msg("Newly registered upkeeps performed " + strconv.Itoa(int(counter.Int64())) + " times") }, "1m", "1s").Should(gomega.Succeed()) gom.Eventually(func(g gomega.Gomega) { @@ -531,7 +535,7 @@ func TestKeeperRegisterUpkeep(t *testing.T) { currentCounter, err := consumers[i].Counter(context.Background()) g.Expect(err).ShouldNot(gomega.HaveOccurred(), "Calling consumer's counter shouldn't fail") - log.Info(). + l.Info(). Int("Upkeep ID", i). Int64("Upkeep counter", currentCounter.Int64()). Int64("initial counter", initialCounters[i].Int64()). @@ -613,6 +617,7 @@ func TestKeeperAddFunds(t *testing.T) { func TestKeeperRemove(t *testing.T) { t.Parallel() + l := zerolog.New(zerolog.NewTestWriter(t)) registryVersions := map[string]ethereum.KeeperRegistryVersion{ "registry_1_1": ethereum.RegistryVersion_1_1, "registry_1_2": ethereum.RegistryVersion_1_2, @@ -675,7 +680,7 @@ func TestKeeperRemove(t *testing.T) { require.NoError(t, err, "Error setting new list of Keepers") err = chainClient.WaitForEvents() require.NoError(t, err, "Error waiting for events") - log.Info().Msg("Successfully removed keeper at address " + keepers[0] + " from the list of Keepers") + l.Info().Msg("Successfully removed keeper at address " + keepers[0] + " from the list of Keepers") // The upkeeps should still perform and their counters should have increased compared to the first check gom.Eventually(func(g gomega.Gomega) { @@ -843,6 +848,7 @@ func TestKeeperMigrateRegistry(t *testing.T) { func TestKeeperNodeDown(t *testing.T) { t.Parallel() + l := zerolog.New(zerolog.NewTestWriter(t)) registryVersions := map[string]ethereum.KeeperRegistryVersion{ "registry_1_1": ethereum.RegistryVersion_1_1, "registry_1_2": ethereum.RegistryVersion_1_2, @@ -896,7 +902,7 @@ func TestKeeperNodeDown(t *testing.T) { err = chainClient.WaitForEvents() require.NoError(t, err, "Error waiting for events") } - log.Info().Msg("Successfully managed to take down the first half of the nodes") + l.Info().Msg("Successfully managed to take down the first half of the nodes") // Assert that upkeeps are still performed and their counters have increased gom.Eventually(func(g gomega.Gomega) { @@ -917,14 +923,14 @@ func TestKeeperNodeDown(t *testing.T) { err = chainClient.WaitForEvents() require.NoError(t, err, "Error waiting for events") } - log.Info().Msg("Successfully managed to take down the second half of the nodes") + l.Info().Msg("Successfully managed to take down the second half of the nodes") // See how many times each upkeep was executed var countersAfterNoMoreNodes = make([]*big.Int, len(upkeepIDs)) for i := 0; i < len(upkeepIDs); i++ { countersAfterNoMoreNodes[i], err = consumers[i].Counter(context.Background()) require.NoError(t, err, "Error retrieving consumer counter %d", i) - log.Info(). + l.Info(). Int("Index", i). Int64("Upkeeps", countersAfterNoMoreNodes[i].Int64()). Msg("Upkeeps Performed") @@ -950,6 +956,7 @@ func TestKeeperNodeDown(t *testing.T) { func TestKeeperPauseUnPauseUpkeep(t *testing.T) { t.Parallel() + l := zerolog.New(zerolog.NewTestWriter(t)) chainClient, chainlinkNodes, contractDeployer, linkToken, onlyStartRunner := setupKeeperTest(t, "pause-upkeep") if onlyStartRunner { return @@ -978,7 +985,7 @@ func TestKeeperPauseUnPauseUpkeep(t *testing.T) { g.Expect(err).ShouldNot(gomega.HaveOccurred(), "Failed to retrieve consumer counter for upkeep at index %d", i) g.Expect(counter.Int64()).Should(gomega.BeNumerically(">", int64(5)), "Expected consumer counter to be greater than 5, but got %d", counter.Int64()) - log.Info().Int64("Upkeep counter", counter.Int64()).Msg("Number of upkeeps performed") + l.Info().Int64("Upkeep counter", counter.Int64()).Msg("Number of upkeeps performed") } }, "3m", "1s").Should(gomega.Succeed()) @@ -996,7 +1003,7 @@ func TestKeeperPauseUnPauseUpkeep(t *testing.T) { // Obtain the amount of times the upkeep has been executed so far countersAfterPause[i], err = consumers[i].Counter(context.Background()) require.NoError(t, err, "Error retrieving upkeep count at index %d", i) - log.Info(). + l.Info(). Int("Index", i). Int64("Upkeeps", countersAfterPause[i].Int64()). Msg("Paused Upkeep") @@ -1032,13 +1039,14 @@ func TestKeeperPauseUnPauseUpkeep(t *testing.T) { " for upkeep at index %d", i) g.Expect(counter.Int64()).Should(gomega.BeNumerically(">", int64(5)+countersAfterPause[i].Int64()), "Expected consumer counter to be greater than %d, but got %d", int64(5)+countersAfterPause[i].Int64(), counter.Int64()) - log.Info().Int64("Upkeeps", counter.Int64()).Msg("Upkeeps Performed") + l.Info().Int64("Upkeeps", counter.Int64()).Msg("Upkeeps Performed") } }, "3m", "1s").Should(gomega.Succeed()) } func TestKeeperUpdateCheckData(t *testing.T) { t.Parallel() + l := zerolog.New(zerolog.NewTestWriter(t)) chainClient, chainlinkNodes, contractDeployer, linkToken, onlyStartRunner := setupKeeperTest(t, "pause-upkeep") if onlyStartRunner { return @@ -1068,7 +1076,7 @@ func TestKeeperUpdateCheckData(t *testing.T) { g.Expect(err).ShouldNot(gomega.HaveOccurred(), "Failed to retrieve perform data checker for upkeep at index %d", i) g.Expect(counter.Int64()).Should(gomega.Equal(int64(0)), "Expected perform data checker counter to be 0, but got %d", counter.Int64()) - log.Info().Int64("Upkeep perform data checker", counter.Int64()).Msg("Number of upkeeps performed") + l.Info().Int64("Upkeep perform data checker", counter.Int64()).Msg("Number of upkeeps performed") } }, "2m", "1s").Should(gomega.Succeed()) @@ -1094,7 +1102,7 @@ func TestKeeperUpdateCheckData(t *testing.T) { g.Expect(err).ShouldNot(gomega.HaveOccurred(), "Failed to retrieve perform data checker counter for upkeep at index %d", i) g.Expect(counter.Int64()).Should(gomega.BeNumerically(">", int64(5)), "Expected perform data checker counter to be greater than 5, but got %d", counter.Int64()) - log.Info().Int64("Upkeep perform data checker", counter.Int64()).Msg("Number of upkeeps performed") + l.Info().Int64("Upkeep perform data checker", counter.Int64()).Msg("Number of upkeeps performed") } }, "3m", "1s").Should(gomega.Succeed()) } diff --git a/integration-tests/smoke/mercury_test.go b/integration-tests/smoke/mercury_test.go index 6051e2a4e6c..0fa2c353dbc 100644 --- a/integration-tests/smoke/mercury_test.go +++ b/integration-tests/smoke/mercury_test.go @@ -13,12 +13,13 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "github.com/go-resty/resty/v2" - "github.com/rs/zerolog/log" + "github.com/rs/zerolog" + "github.com/stretchr/testify/require" + "github.com/smartcontractkit/chainlink/integration-tests/client" "github.com/smartcontractkit/chainlink/integration-tests/contracts" "github.com/smartcontractkit/chainlink/integration-tests/contracts/ethereum/mercury/exchanger" "github.com/smartcontractkit/chainlink/integration-tests/testsetups" - "github.com/stretchr/testify/require" ) func StringToByte32(str string) [32]byte { @@ -95,6 +96,7 @@ func createEncodedCommitment(order Order) ([]byte, error) { } func TestMercurySmoke(t *testing.T) { + l := zerolog.New(zerolog.NewTestWriter(t)) const mercuryFeedId = "ETH-USD-Optimism-Goerli-1" _, isExistingTestEnv, testNetwork, chainlinkNodes, @@ -114,7 +116,7 @@ func TestMercurySmoke(t *testing.T) { // Wait for the DON to start generating reports d := 160 * time.Second - log.Info().Msgf("Sleeping for %s to wait for Mercury env to be ready..", d) + l.Info().Msgf("Sleeping for %s to wait for Mercury env to be ready..", d) time.Sleep(d) mercuryLookupUrl := fmt.Sprintf("%s/client", mercuryServerRemoteUrl) @@ -159,7 +161,7 @@ func TestMercurySmoke(t *testing.T) { // Get report from Mercury server report := &client.GetReportsResult{} resp, err := resty.New().R().SetResult(&report).Get(mercuryUrl) - log.Info().Msgf("Got response from Mercury server: %s", resp) + l.Info().Msgf("Got response from Mercury server: %s", resp) require.NoError(t, err, "Error getting report from Mercury Server") require.NotEmpty(t, report.ChainlinkBlob, "Report response does not contain chainlinkBlob") @@ -175,6 +177,6 @@ func TestMercurySmoke(t *testing.T) { tradeExecuted := map[string]interface{}{} err = exchangerABI.UnpackIntoMap(tradeExecuted, "TradeExecuted", receipt.Logs[1].Data) require.NoError(t, err) - log.Info().Interface("TradeExecuted", tradeExecuted).Msg("ResolveTradeWithReport logs") + l.Info().Interface("TradeExecuted", tradeExecuted).Msg("ResolveTradeWithReport logs") }) } diff --git a/integration-tests/smoke/ocr2vrf_test.go b/integration-tests/smoke/ocr2vrf_test.go index 4ff65f2eefe..d23e93d3a2a 100644 --- a/integration-tests/smoke/ocr2vrf_test.go +++ b/integration-tests/smoke/ocr2vrf_test.go @@ -6,6 +6,7 @@ import ( "strings" "testing" + "github.com/rs/zerolog" "github.com/smartcontractkit/chainlink-env/environment" "github.com/smartcontractkit/chainlink-env/pkg/helm/chainlink" eth "github.com/smartcontractkit/chainlink-env/pkg/helm/ethereum" @@ -22,12 +23,11 @@ import ( "github.com/smartcontractkit/chainlink/integration-tests/client" "github.com/smartcontractkit/chainlink/integration-tests/config" "github.com/smartcontractkit/chainlink/integration-tests/contracts" - - "github.com/rs/zerolog/log" ) func TestOCR2VRFRedeemModel(t *testing.T) { t.Parallel() + l := zerolog.New(zerolog.NewTestWriter(t)) testEnvironment, testNetwork := setupOCR2VRFEnvironment(t) if testEnvironment.WillUseRemoteRunner() { return @@ -80,13 +80,14 @@ func TestOCR2VRFRedeemModel(t *testing.T) { for i := uint16(0); i < ocr2vrf_constants.NumberOfRandomWordsToRequest; i++ { randomness, err := consumerContract.GetRandomnessByRequestId(nil, requestID, big.NewInt(int64(i))) require.NoError(t, err) - log.Info().Interface("Random Number", randomness).Interface("Randomness Number Index", i).Msg("Randomness retrieved from Consumer contract") + l.Info().Interface("Random Number", randomness).Interface("Randomness Number Index", i).Msg("Randomness retrieved from Consumer contract") require.NotEqual(t, 0, randomness.Uint64(), "Randomness retrieved from Consumer contract give an answer other than 0") } } func TestOCR2VRFFulfillmentModel(t *testing.T) { t.Parallel() + l := zerolog.New(zerolog.NewTestWriter(t)) testEnvironment, testNetwork := setupOCR2VRFEnvironment(t) if testEnvironment.WillUseRemoteRunner() { return @@ -138,7 +139,7 @@ func TestOCR2VRFFulfillmentModel(t *testing.T) { for i := uint16(0); i < ocr2vrf_constants.NumberOfRandomWordsToRequest; i++ { randomness, err := consumerContract.GetRandomnessByRequestId(nil, requestID, big.NewInt(int64(i))) require.NoError(t, err, "Error getting Randomness result from Consumer Contract") - log.Info().Interface("Random Number", randomness).Interface("Randomness Number Index", i).Msg("Randomness Fulfillment retrieved from Consumer contract") + l.Info().Interface("Random Number", randomness).Interface("Randomness Number Index", i).Msg("Randomness Fulfillment retrieved from Consumer contract") require.NotEqual(t, 0, randomness.Uint64(), "Randomness Fulfillment retrieved from Consumer contract give an answer other than 0") } } diff --git a/integration-tests/smoke/ocr_test.go b/integration-tests/smoke/ocr_test.go index 308cda4012a..17e0ae116f5 100644 --- a/integration-tests/smoke/ocr_test.go +++ b/integration-tests/smoke/ocr_test.go @@ -8,7 +8,7 @@ import ( "strings" "testing" - "github.com/rs/zerolog/log" + "github.com/rs/zerolog" "github.com/smartcontractkit/chainlink-env/environment" "github.com/smartcontractkit/chainlink-env/pkg/helm/chainlink" "github.com/smartcontractkit/chainlink-env/pkg/helm/ethereum" @@ -88,6 +88,7 @@ func setupOCRTest(t *testing.T) ( testEnvironment *environment.Environment, testNetwork blockchain.EVMNetwork, ) { + l := zerolog.New(zerolog.NewTestWriter(t)) testNetwork = networks.SelectedNetwork evmConfig := ethereum.New(nil) if !testNetwork.Simulated { @@ -112,7 +113,7 @@ func setupOCRTest(t *testing.T) ( "replicas": 6, "env": ocrEnvVars, }) - log.Debug().Interface("Env", ocrEnvVars).Msg("Using Environment Variable Config") + l.Debug().Interface("Env", ocrEnvVars).Msg("Using Environment Variable Config") } testEnvironment = environment.New(&environment.Config{ diff --git a/integration-tests/smoke/runlog_test.go b/integration-tests/smoke/runlog_test.go index a082d4aab3c..eb9cc67acd8 100644 --- a/integration-tests/smoke/runlog_test.go +++ b/integration-tests/smoke/runlog_test.go @@ -8,6 +8,7 @@ import ( "testing" "github.com/onsi/gomega" + "github.com/rs/zerolog" "github.com/smartcontractkit/chainlink-env/environment" "github.com/smartcontractkit/chainlink-env/pkg/helm/chainlink" "github.com/smartcontractkit/chainlink-env/pkg/helm/ethereum" @@ -24,12 +25,12 @@ import ( "github.com/smartcontractkit/chainlink/integration-tests/client" "github.com/smartcontractkit/chainlink/integration-tests/contracts" - "github.com/rs/zerolog/log" uuid "github.com/satori/go.uuid" ) func TestRunLogBasic(t *testing.T) { t.Parallel() + l := zerolog.New(zerolog.NewTestWriter(t)) testEnvironment, testNetwork := setupRunLogTest(t) if testEnvironment.WillUseRemoteRunner() { return @@ -108,7 +109,7 @@ func TestRunLogBasic(t *testing.T) { d, err := consumer.Data(context.Background()) g.Expect(err).ShouldNot(gomega.HaveOccurred(), "Getting data from consumer contract shouldn't fail") g.Expect(d).ShouldNot(gomega.BeNil(), "Expected the initial on chain data to be nil") - log.Debug().Int64("Data", d.Int64()).Msg("Found on chain") + l.Debug().Int64("Data", d.Int64()).Msg("Found on chain") g.Expect(d.Int64()).Should(gomega.BeNumerically("==", 5), "Expected the on-chain data to be 5, but found %d", d.Int64()) }, "2m", "1s").Should(gomega.Succeed()) } diff --git a/integration-tests/smoke/vrf_test.go b/integration-tests/smoke/vrf_test.go index 7d35922244b..a64a2670326 100644 --- a/integration-tests/smoke/vrf_test.go +++ b/integration-tests/smoke/vrf_test.go @@ -9,7 +9,7 @@ import ( "time" "github.com/onsi/gomega" - "github.com/rs/zerolog/log" + "github.com/rs/zerolog" uuid "github.com/satori/go.uuid" "github.com/stretchr/testify/require" "go.uber.org/zap/zapcore" @@ -28,6 +28,7 @@ import ( func TestVRFBasic(t *testing.T) { t.Parallel() + l := zerolog.New(zerolog.NewTestWriter(t)) testEnvironment, testNetwork := setupVRFTest(t) if testEnvironment.WillUseRemoteRunner() { return @@ -69,7 +70,7 @@ func TestVRFBasic(t *testing.T) { for _, n := range chainlinkNodes { nodeKey, err := n.MustCreateVRFKey() require.NoError(t, err, "Creating VRF key shouldn't fail") - log.Debug().Interface("Key JSON", nodeKey).Msg("Created proving key") + l.Debug().Interface("Key JSON", nodeKey).Msg("Created proving key") pubKeyCompressed := nodeKey.Data.ID jobUUID := uuid.NewV4() os := &client.VRFTxPipelineSpec{ @@ -121,9 +122,9 @@ func TestVRFBasic(t *testing.T) { // TODO: This is an imperfect check, given it's a random number, it CAN be 0, but chances are unlikely. // So we're just checking that the answer has changed to something other than the default (0) // There's a better formula to ensure that VRF response is as expected, detailed under Technical Walkthrough. - // https://blog.chain.link/chainlink-vrf-on-chain-verifiable-randomness/ + // https://bl.chain.link/chainlink-vrf-on-chain-verifiable-randomness/ g.Expect(out.Uint64()).ShouldNot(gomega.BeNumerically("==", 0), "Expected the VRF job give an answer other than 0") - log.Debug().Uint64("Output", out.Uint64()).Msg("Randomness fulfilled") + l.Debug().Uint64("Output", out.Uint64()).Msg("Randomness fulfilled") }, timeout, "1s").Should(gomega.Succeed()) } } diff --git a/integration-tests/smoke/vrfv2_test.go b/integration-tests/smoke/vrfv2_test.go index dc947e99fed..55347b51df8 100644 --- a/integration-tests/smoke/vrfv2_test.go +++ b/integration-tests/smoke/vrfv2_test.go @@ -8,6 +8,7 @@ import ( "testing" "time" + "github.com/rs/zerolog" "github.com/smartcontractkit/chainlink-testing-framework/utils" "go.uber.org/zap/zapcore" @@ -25,7 +26,6 @@ import ( "github.com/smartcontractkit/chainlink/integration-tests/client" "github.com/smartcontractkit/chainlink/integration-tests/contracts" - "github.com/rs/zerolog/log" uuid "github.com/satori/go.uuid" ) @@ -34,6 +34,7 @@ func TestVRFv2Basic(t *testing.T) { minimumConfirmations := 3 t.Parallel() + l := zerolog.New(zerolog.NewTestWriter(t)) testEnvironment, testNetwork := setupVRFv2Test(t) if testEnvironment.WillUseRemoteRunner() { return @@ -104,7 +105,7 @@ func TestVRFv2Basic(t *testing.T) { for _, n := range chainlinkNodes { vrfKey, err := n.MustCreateVRFKey() require.NoError(t, err) - log.Debug().Interface("Key JSON", vrfKey).Msg("Created proving key") + l.Debug().Interface("Key JSON", vrfKey).Msg("Created proving key") pubKeyCompressed := vrfKey.Data.ID jobUUID := uuid.NewV4() os := &client.VRFV2TxPipelineSpec{ @@ -151,7 +152,7 @@ func TestVRFv2Basic(t *testing.T) { randomness, err := consumer.GetAllRandomWords(context.Background(), int(words)) g.Expect(err).ShouldNot(gomega.HaveOccurred()) for _, w := range randomness { - log.Debug().Uint64("Output", w.Uint64()).Msg("Randomness fulfilled") + l.Debug().Uint64("Output", w.Uint64()).Msg("Randomness fulfilled") g.Expect(w.Uint64()).ShouldNot(gomega.BeNumerically("==", 0), "Expected the VRF job give an answer other than 0") } }, timeout, "1s").Should(gomega.Succeed()) diff --git a/integration-tests/soak/forwarder_ocr_test.go b/integration-tests/soak/forwarder_ocr_test.go index 0001689963d..4c8bf67e889 100644 --- a/integration-tests/soak/forwarder_ocr_test.go +++ b/integration-tests/soak/forwarder_ocr_test.go @@ -8,7 +8,7 @@ import ( "testing" "time" - "github.com/rs/zerolog/log" + "github.com/rs/zerolog" "github.com/stretchr/testify/require" "github.com/smartcontractkit/chainlink-env/environment" @@ -31,6 +31,7 @@ func TestMain(m *testing.M) { } func TestForwarderOCRSoak(t *testing.T) { + l := zerolog.New(zerolog.NewTestWriter(t)) testEnvironment, network := SetupForwarderOCRSoakEnv(t) if testEnvironment.WillUseRemoteRunner() { return @@ -50,12 +51,12 @@ func TestForwarderOCRSoak(t *testing.T) { }) t.Cleanup(func() { if err = actions.TeardownRemoteSuite(ocrSoakTest.TearDownVals(t)); err != nil { - log.Error().Err(err).Msg("Error when tearing down remote suite") + l.Error().Err(err).Msg("Error when tearing down remote suite") } }) ocrSoakTest.OperatorForwarderFlow = true ocrSoakTest.Setup(t, testEnvironment) - log.Info().Msg("Setup soak test") + l.Info().Msg("Setup soak test") ocrSoakTest.Run(t) } diff --git a/integration-tests/soak/ocr_test.go b/integration-tests/soak/ocr_test.go index 3ae0ceb3649..6a3689f4f57 100644 --- a/integration-tests/soak/ocr_test.go +++ b/integration-tests/soak/ocr_test.go @@ -10,7 +10,7 @@ import ( "time" "github.com/kelseyhightower/envconfig" - "github.com/rs/zerolog/log" + "github.com/rs/zerolog" "github.com/stretchr/testify/require" "github.com/smartcontractkit/chainlink-env/environment" @@ -28,6 +28,7 @@ import ( ) func TestOCRSoak(t *testing.T) { + l := zerolog.New(zerolog.NewTestWriter(t)) testEnvironment, network, testInputs := SetupOCREnvVarsSoakEnv(t) if testEnvironment.WillUseRemoteRunner() { return @@ -48,11 +49,11 @@ func TestOCRSoak(t *testing.T) { }) t.Cleanup(func() { if err := actions.TeardownRemoteSuite(ocrSoakTest.TearDownVals(t)); err != nil { - log.Error().Err(err).Msg("Error tearing down environment") + l.Error().Err(err).Msg("Error tearing down environment") } }) ocrSoakTest.Setup(t, testEnvironment) - log.Info().Msg("Set up soak test") + l.Info().Msg("Set up soak test") ocrSoakTest.Run(t) } diff --git a/integration-tests/testsetups/keeper_benchmark.go b/integration-tests/testsetups/keeper_benchmark.go index 5826a17dd8c..a1342fe3435 100644 --- a/integration-tests/testsetups/keeper_benchmark.go +++ b/integration-tests/testsetups/keeper_benchmark.go @@ -10,6 +10,7 @@ import ( goeath "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" + "github.com/rs/zerolog" "github.com/rs/zerolog/log" "github.com/slack-go/slack" "github.com/smartcontractkit/chainlink-env/environment" @@ -70,6 +71,7 @@ func NewKeeperBenchmarkTest(inputs KeeperBenchmarkTestInputs) *KeeperBenchmarkTe // Setup prepares contracts for the test func (k *KeeperBenchmarkTest) Setup(t *testing.T, env *environment.Environment) { + l := zerolog.New(zerolog.NewTestWriter(t)) startTime := time.Now() k.TestReporter.Summary.StartTime = startTime.UnixMilli() k.ensureInputValues(t) @@ -92,7 +94,7 @@ func (k *KeeperBenchmarkTest) Setup(t *testing.T, env *environment.Environment) if len(inputs.RegistryVersions) > 1 { for nodeIndex, node := range k.chainlinkNodes { for registryIndex := 1; registryIndex < len(inputs.RegistryVersions); registryIndex++ { - log.Debug().Str("URL", node.URL()).Int("NodeIndex", nodeIndex).Int("RegistryIndex", registryIndex).Msg("Create Tx key") + l.Debug().Str("URL", node.URL()).Int("NodeIndex", nodeIndex).Int("RegistryIndex", registryIndex).Msg("Create Tx key") _, _, err := node.CreateTxKey("evm", k.Inputs.BlockchainClient.GetChainID().String()) require.NoError(t, err, "Creating transaction key shouldn't fail") } @@ -100,7 +102,7 @@ func (k *KeeperBenchmarkTest) Setup(t *testing.T, env *environment.Environment) } for index := range inputs.RegistryVersions { - log.Info().Int("Index", index).Msg("Starting Test Setup") + l.Info().Int("Index", index).Msg("Starting Test Setup") linkToken, err := contractDeployer.DeployLinkTokenContract() require.NoError(t, err, "Deploying Link Token Contract shouldn't fail") @@ -138,15 +140,16 @@ func (k *KeeperBenchmarkTest) Setup(t *testing.T, env *environment.Environment) require.NoError(t, err, "Funding Chainlink nodes shouldn't fail") } - log.Info().Str("Setup Time", time.Since(startTime).String()).Msg("Finished Keeper Benchmark Test Setup") + l.Info().Str("Setup Time", time.Since(startTime).String()).Msg("Finished Keeper Benchmark Test Setup") err = k.SendSlackNotification(nil) if err != nil { - log.Warn().Msg("Sending test start slack notification failed") + l.Warn().Msg("Sending test start slack notification failed") } } // Run runs the keeper benchmark test func (k *KeeperBenchmarkTest) Run(t *testing.T) { + l := zerolog.New(zerolog.NewTestWriter(t)) k.TestReporter.Summary.Load.TotalCheckGasPerBlock = int64(k.Inputs.NumberOfContracts) * k.Inputs.CheckGasToBurn k.TestReporter.Summary.Load.TotalPerformGasPerBlock = int64((float64(k.Inputs.NumberOfContracts) / float64(k.Inputs.BlockInterval)) * float64(k.Inputs.PerformGasToBurn)) k.TestReporter.Summary.Load.AverageExpectedPerformsPerBlock = float64(k.Inputs.NumberOfContracts) / float64(k.Inputs.BlockInterval) @@ -223,19 +226,19 @@ func (k *KeeperBenchmarkTest) Run(t *testing.T) { for _, chainlinkNode := range k.chainlinkNodes { txData, err := chainlinkNode.MustReadTransactionAttempts() if err != nil { - log.Error().Err(err).Msg("Error reading transaction attempts from Chainlink Node") + l.Error().Err(err).Msg("Error reading transaction attempts from Chainlink Node") } k.TestReporter.AttemptedChainlinkTransactions = append(k.TestReporter.AttemptedChainlinkTransactions, txData) } k.TestReporter.Summary.Config.Chainlink, err = k.env.ResourcesSummary("app=chainlink-0") if err != nil { - log.Error().Err(err).Msg("Error getting resource summary of chainlink node") + l.Error().Err(err).Msg("Error getting resource summary of chainlink node") } k.TestReporter.Summary.Config.Geth, err = k.env.ResourcesSummary("app=geth") if err != nil && k.Inputs.BlockchainClient.NetworkSimulated() { - log.Error().Err(err).Msg("Error getting resource summary of geth node") + l.Error().Err(err).Msg("Error getting resource summary of geth node") } endTime := time.Now() @@ -246,7 +249,7 @@ func (k *KeeperBenchmarkTest) Run(t *testing.T) { actions.DeleteKeeperJobsWithId(t, k.chainlinkNodes, rIndex+1) } - log.Info().Str("Run Time", endTime.Sub(startTime).String()).Msg("Finished Keeper Benchmark Test") + l.Info().Str("Run Time", endTime.Sub(startTime).String()).Msg("Finished Keeper Benchmark Test") } // subscribeToUpkeepPerformedEvent subscribes to the event log for UpkeepPerformed event and @@ -257,6 +260,7 @@ func (k *KeeperBenchmarkTest) subscribeToUpkeepPerformedEvent( metricsReporter *testreporters.KeeperBenchmarkTestReporter, rIndex int, ) { + l := zerolog.New(zerolog.NewTestWriter(t)) contractABI, err := ethereum.KeeperRegistry11MetaData.GetAbi() require.NoError(t, err, "Error getting ABI") switch k.Inputs.RegistryVersions[rIndex] { @@ -284,7 +288,7 @@ func (k *KeeperBenchmarkTest) subscribeToUpkeepPerformedEvent( for { select { case err := <-sub.Err(): - log.Error().Err(err).Msg("Error while subscribing to Keeper Event Logs. Resubscribing...") + l.Error().Err(err).Msg("Error while subscribing to Keeper Event Logs. Resubscribing...") sub.Unsubscribe() sub, err = k.chainClient.SubscribeFilterLogs(context.Background(), query, eventLogs) @@ -300,7 +304,7 @@ func (k *KeeperBenchmarkTest) subscribeToUpkeepPerformedEvent( require.NoError(t, err, "Parsing upkeep performed log shouldn't fail") if parsedLog.Success { - log.Info(). + l.Info(). Str("Upkeep ID", parsedLog.Id.String()). Bool("Success", parsedLog.Success). Str("From", parsedLog.From.String()). @@ -308,7 +312,7 @@ func (k *KeeperBenchmarkTest) subscribeToUpkeepPerformedEvent( Msg("Got successful Upkeep Performed log on Registry") } else { - log.Warn(). + l.Warn(). Str("Upkeep ID", parsedLog.Id.String()). Bool("Success", parsedLog.Success). Str("From", parsedLog.From.String()). diff --git a/integration-tests/testsetups/ocr.go b/integration-tests/testsetups/ocr.go index e8f707e8556..9e4194b87c6 100644 --- a/integration-tests/testsetups/ocr.go +++ b/integration-tests/testsetups/ocr.go @@ -12,7 +12,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" - "github.com/rs/zerolog/log" + "github.com/rs/zerolog" "github.com/stretchr/testify/require" "github.com/smartcontractkit/chainlink-env/environment" @@ -71,6 +71,7 @@ func NewOCRSoakTest(inputs *OCRSoakTestInputs) *OCRSoakTest { // Setup sets up the test environment, deploying contracts and funding chainlink nodes func (o *OCRSoakTest) Setup(t *testing.T, env *environment.Environment) { + l := zerolog.New(zerolog.NewTestWriter(t)) o.ensureInputValues(t) o.testEnvironment = env var err error @@ -140,11 +141,12 @@ func (o *OCRSoakTest) Setup(t *testing.T, env *environment.Environment) { o.Inputs.ExpectedRoundTime, ) } - log.Info().Msg("OCR Soak Test Setup Complete") + l.Info().Msg("OCR Soak Test Setup Complete") } // Run starts the OCR soak test func (o *OCRSoakTest) Run(t *testing.T) { + l := zerolog.New(zerolog.NewTestWriter(t)) // Set initial value and create jobs err := actions.SetAllAdapterResponsesToTheSameValue(o.Inputs.StartingAdapterValue, o.ocrInstances, o.chainlinkNodes, o.mockServer) require.NoError(t, err, "Error setting adapter responses") @@ -155,7 +157,7 @@ func (o *OCRSoakTest) Run(t *testing.T) { require.NoError(t, err, "Error creating OCR jobs") } - log.Info(). + l.Info(). Str("Test Duration", o.Inputs.TestDuration.Truncate(time.Second).String()). Str("Round Timeout", o.Inputs.RoundTimeout.String()). Int("Number of OCR Contracts", len(o.ocrInstances)). @@ -176,17 +178,17 @@ func (o *OCRSoakTest) Run(t *testing.T) { select { case <-testDuration.C: testOver = true - log.Warn().Msg("Soak Test Duration Reached. Completing Final Round") + l.Warn().Msg("Soak Test Duration Reached. Completing Final Round") case answer := <-answerUpdated: if o.processNewAnswer(t, answer) { remainingExpectedAnswers-- } if remainingExpectedAnswers <= 0 { if testOver { - log.Info().Msg("Soak Test Complete") + l.Info().Msg("Soak Test Complete") return } - log.Info(). + l.Info(). Str("Wait time", o.Inputs.TimeBetweenRounds.String()). Msg("All Expected Answers Reported. Waiting to Start a New Round") remainingExpectedAnswers = len(o.ocrInstances) @@ -196,7 +198,7 @@ func (o *OCRSoakTest) Run(t *testing.T) { lastAdapterValue, currentAdapterValue = currentAdapterValue, lastAdapterValue o.triggerNewRound(t, currentAdapterValue) case <-expiredRoundTrigger.C: - log.Warn().Msg("OCR round timed out") + l.Warn().Msg("OCR round timed out") expiredRoundTrigger = time.NewTimer(o.Inputs.RoundTimeout) remainingExpectedAnswers = len(o.ocrInstances) o.triggerNewRound(t, rand.Intn(o.Inputs.StartingAdapterValue*25-1-o.Inputs.StartingAdapterValue)+o.Inputs.StartingAdapterValue) // #nosec G404 | Just triggering a random number @@ -228,14 +230,15 @@ func (o *OCRSoakTest) processNewEvent( ocrInstance contracts.OffchainAggregator, contractABI *abi.ABI, ) { + l := zerolog.New(zerolog.NewTestWriter(t)) errorChan := make(chan error) eventConfirmed := make(chan bool) err := o.chainClient.ProcessEvent(eventDetails.Name, event, eventConfirmed, errorChan) if err != nil { - log.Error().Err(err).Str("Hash", event.TxHash.Hex()).Str("Event", eventDetails.Name).Msg("Error trying to process event") + l.Error().Err(err).Str("Hash", event.TxHash.Hex()).Str("Event", eventDetails.Name).Msg("Error trying to process event") return } - log.Debug(). + l.Debug(). Str("Event", eventDetails.Name). Str("Address", event.Address.Hex()). Str("Hash", event.TxHash.Hex()). @@ -243,7 +246,7 @@ func (o *OCRSoakTest) processNewEvent( for { select { case err := <-errorChan: - log.Error().Err(err).Msg("Error while confirming event") + l.Error().Err(err).Msg("Error while confirming event") return case confirmed := <-eventConfirmed: if confirmed { @@ -252,7 +255,7 @@ func (o *OCRSoakTest) processNewEvent( require.NoError(t, err, "Parsing AnswerUpdated event log in OCR instance shouldn't fail") answerUpdated <- answer } - log.Info(). + l.Info(). Str("Contract", event.Address.Hex()). Str("Event Name", eventDetails.Name). Uint64("Header Number", event.BlockNumber). @@ -265,11 +268,12 @@ func (o *OCRSoakTest) processNewEvent( // marshalls new answer events into manageable Go struct for further processing and reporting func (o *OCRSoakTest) processNewAnswer(t *testing.T, newAnswer *ethereum.OffchainAggregatorAnswerUpdated) bool { + l := zerolog.New(zerolog.NewTestWriter(t)) // Updated Info answerAddress := newAnswer.Raw.Address.Hex() _, tracked := o.TestReporter.ContractReports[answerAddress] if !tracked { - log.Error().Str("Untracked Address", answerAddress).Msg("Received AnswerUpdated event on an untracked OCR instance") + l.Error().Str("Untracked Address", answerAddress).Msg("Received AnswerUpdated event on an untracked OCR instance") return false } processedAnswer := &testreporters.OCRAnswerUpdated{} @@ -293,6 +297,7 @@ func (o *OCRSoakTest) processNewAnswer(t *testing.T, newAnswer *ethereum.Offchai // triggers a new OCR round by setting a new mock adapter value func (o *OCRSoakTest) triggerNewRound(t *testing.T, currentAdapterValue int) { + l := zerolog.New(zerolog.NewTestWriter(t)) startingBlockNum, err := o.chainClient.LatestBlockNumber(context.Background()) require.NoError(t, err, "Error retrieving latest block number") @@ -301,7 +306,7 @@ func (o *OCRSoakTest) triggerNewRound(t *testing.T, currentAdapterValue int) { } err = actions.SetAllAdapterResponsesToTheSameValue(currentAdapterValue, o.ocrInstances, o.chainlinkNodes, o.mockServer) require.NoError(t, err, "Error setting adapter responses") - log.Info(). + l.Info(). Int("Value", currentAdapterValue). Msg("Starting a New OCR Round") } @@ -327,6 +332,7 @@ func (o *OCRSoakTest) subscribeOCREvents( t *testing.T, answerUpdated chan *ethereum.OffchainAggregatorAnswerUpdated, ) { + l := zerolog.New(zerolog.NewTestWriter(t)) contractABI, err := ethereum.OffchainAggregatorMetaData.GetAbi() require.NoError(t, err, "Getting contract abi for OCR shouldn't fail") latestBlockNum, err := o.chainClient.LatestBlockNumber(context.Background()) @@ -348,7 +354,7 @@ func (o *OCRSoakTest) subscribeOCREvents( for { select { case err := <-sub.Err(): - log.Error().Err(err).Msg("Error while watching for new contract events. Retrying Subscription") + l.Error().Err(err).Msg("Error while watching for new contract events. Retrying Subscription") sub.Unsubscribe() sub, err = o.chainClient.SubscribeFilterLogs(context.Background(), query, eventLogs) diff --git a/integration-tests/testsetups/vrfv2.go b/integration-tests/testsetups/vrfv2.go index a22ab9a0a95..668d10bfe6f 100644 --- a/integration-tests/testsetups/vrfv2.go +++ b/integration-tests/testsetups/vrfv2.go @@ -7,6 +7,7 @@ import ( "testing" "time" + "github.com/rs/zerolog" "github.com/rs/zerolog/log" "github.com/stretchr/testify/require" @@ -14,6 +15,7 @@ import ( "github.com/smartcontractkit/chainlink-testing-framework/blockchain" ctfClient "github.com/smartcontractkit/chainlink-testing-framework/client" reportModel "github.com/smartcontractkit/chainlink-testing-framework/testreporters" + "github.com/smartcontractkit/chainlink/integration-tests/client" "github.com/smartcontractkit/chainlink/integration-tests/testreporters" ) @@ -77,7 +79,8 @@ func (v *VRFV2SoakTest) Setup(t *testing.T, env *environment.Environment, isLoca // Run starts the VRFV2 soak test func (v *VRFV2SoakTest) Run(t *testing.T) { - log.Info(). + l := zerolog.New(zerolog.NewTestWriter(t)) + l.Info(). Str("Test Duration", v.Inputs.TestDuration.Truncate(time.Second).String()). Int("Max number of requests per minute wanted", v.Inputs.RequestsPerMinute). Msg("Starting VRFV2 Soak Test") @@ -115,8 +118,8 @@ func (v *VRFV2SoakTest) Run(t *testing.T) { break // breaks the for loop and stops the test } } - log.Info().Int("Requests", v.NumberOfRequests).Msg("Total Completed Requests") - log.Info().Str("Run Time", time.Since(startTime).String()).Msg("Finished VRFV2 Soak Test Requests") + l.Info().Int("Requests", v.NumberOfRequests).Msg("Total Completed Requests") + l.Info().Str("Run Time", time.Since(startTime).String()).Msg("Finished VRFV2 Soak Test Requests") require.Equal(t, 0, v.ErrorCount, "Expected 0 errors") }