Skip to content

Commit

Permalink
triage why logs are not getting the correct test struct
Browse files Browse the repository at this point in the history
  • Loading branch information
tateexon committed Sep 13, 2023
1 parent d5e27ec commit 4c80930
Show file tree
Hide file tree
Showing 38 changed files with 181 additions and 146 deletions.
5 changes: 3 additions & 2 deletions integration-tests/actions/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/smartcontractkit/chainlink-env/environment"
"github.com/smartcontractkit/chainlink-testing-framework/blockchain"
ctfClient "github.com/smartcontractkit/chainlink-testing-framework/client"
"github.com/smartcontractkit/chainlink-testing-framework/logging"
"github.com/smartcontractkit/chainlink-testing-framework/testreporters"
"github.com/smartcontractkit/chainlink-testing-framework/utils"

Expand Down Expand Up @@ -251,7 +252,7 @@ func TeardownSuite(
failingLogLevel zapcore.Level, // Examines logs after the test, and fails the test if any Chainlink logs are found at or above provided level
clients ...blockchain.EVMClient,
) error {
l := utils.GetTestLogger(t)
l := logging.GetTestLogger(t)
if err := testreporters.WriteTeardownLogs(t, env, optionalTestReporter, failingLogLevel); err != nil {
return errors.Wrap(err, "Error dumping environment logs, leaving environment running for manual retrieval")
}
Expand Down Expand Up @@ -295,7 +296,7 @@ func TeardownRemoteSuite(
optionalTestReporter testreporters.TestReporter, // Optionally pass in a test reporter to log further metrics
client blockchain.EVMClient,
) error {
l := utils.GetTestLogger(t)
l := logging.GetTestLogger(t)
var err error
if err = testreporters.SendReport(t, namespace, "./", optionalTestReporter); err != nil {
l.Warn().Err(err).Msg("Error writing test report")
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/actions/automation_ocr_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/lib/pq"

"github.com/smartcontractkit/chainlink-testing-framework/blockchain"
"github.com/smartcontractkit/chainlink-testing-framework/utils"
"github.com/smartcontractkit/chainlink-testing-framework/logging"
"github.com/smartcontractkit/chainlink/v2/core/services/job"
"github.com/smartcontractkit/chainlink/v2/core/services/keystore/chaintype"
"github.com/smartcontractkit/chainlink/v2/core/store/models"
Expand Down Expand Up @@ -48,7 +48,7 @@ func BuildAutoOCR2ConfigVarsWithKeyIndex(
deltaStage time.Duration,
keyIndex int,
) (contracts.OCRv2Config, error) {
l := utils.GetTestLogger(t)
l := logging.GetTestLogger(t)
S, oracleIdentities, err := GetOracleIdentitiesWithKeyIndex(chainlinkNodes, keyIndex)
if err != nil {
return contracts.OCRv2Config{}, err
Expand Down Expand Up @@ -172,7 +172,7 @@ func CreateOCRKeeperJobs(
keyIndex int,
registryVersion ethereum.KeeperRegistryVersion,
) {
l := utils.GetTestLogger(t)
l := logging.GetTestLogger(t)
bootstrapNode := chainlinkNodes[0]
bootstrapP2PIds, err := bootstrapNode.MustReadP2PKeys()
require.NoError(t, err, "Shouldn't fail reading P2P keys from bootstrap node")
Expand Down
14 changes: 7 additions & 7 deletions integration-tests/actions/keeper_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/stretchr/testify/require"

"github.com/smartcontractkit/chainlink-testing-framework/blockchain"
"github.com/smartcontractkit/chainlink-testing-framework/utils"
"github.com/smartcontractkit/chainlink-testing-framework/logging"

"github.com/smartcontractkit/chainlink/integration-tests/client"
"github.com/smartcontractkit/chainlink/integration-tests/contracts"
Expand Down Expand Up @@ -335,7 +335,7 @@ func RegisterUpkeepContracts(t *testing.T, linkToken contracts.LinkToken, linkFu
}

func RegisterUpkeepContractsWithCheckData(t *testing.T, linkToken contracts.LinkToken, linkFunds *big.Int, client blockchain.EVMClient, upkeepGasLimit uint32, registry contracts.KeeperRegistry, registrar contracts.KeeperRegistrar, numberOfContracts int, upkeepAddresses []string, checkData [][]byte, isLogTrigger bool) []*big.Int {
l := utils.GetTestLogger(t)
l := logging.GetTestLogger(t)
registrationTxHashes := make([]common.Hash, 0)
upkeepIds := make([]*big.Int, 0)
for contractCount, upkeepAddress := range upkeepAddresses {
Expand Down Expand Up @@ -394,7 +394,7 @@ func RegisterUpkeepContractsWithCheckData(t *testing.T, linkToken contracts.Link
}

func DeployKeeperConsumers(t *testing.T, contractDeployer contracts.ContractDeployer, client blockchain.EVMClient, numberOfContracts int, isLogTrigger bool) []contracts.KeeperConsumer {
l := utils.GetTestLogger(t)
l := logging.GetTestLogger(t)
keeperConsumerContracts := make([]contracts.KeeperConsumer, 0)

for contractCount := 0; contractCount < numberOfContracts; contractCount++ {
Expand Down Expand Up @@ -437,7 +437,7 @@ func DeployKeeperConsumersPerformance(
checkGasToBurn, // How much gas should be burned on checkUpkeep() calls
performGasToBurn int64, // How much gas should be burned on performUpkeep() calls
) []contracts.KeeperConsumerPerformance {
l := utils.GetTestLogger(t)
l := logging.GetTestLogger(t)
upkeeps := make([]contracts.KeeperConsumerPerformance, 0)

for contractCount := 0; contractCount < numberOfContracts; contractCount++ {
Expand Down Expand Up @@ -474,7 +474,7 @@ func DeployPerformDataChecker(
numberOfContracts int,
expectedData []byte,
) []contracts.KeeperPerformDataChecker {
l := utils.GetTestLogger(t)
l := logging.GetTestLogger(t)
upkeeps := make([]contracts.KeeperPerformDataChecker, 0)

for contractCount := 0; contractCount < numberOfContracts; contractCount++ {
Expand Down Expand Up @@ -506,7 +506,7 @@ func DeployUpkeepCounters(
testRange *big.Int,
interval *big.Int,
) []contracts.UpkeepCounter {
l := utils.GetTestLogger(t)
l := logging.GetTestLogger(t)
upkeepCounters := make([]contracts.UpkeepCounter, 0)

for contractCount := 0; contractCount < numberOfContracts; contractCount++ {
Expand Down Expand Up @@ -539,7 +539,7 @@ func DeployUpkeepPerformCounterRestrictive(
testRange *big.Int,
averageEligibilityCadence *big.Int,
) []contracts.UpkeepPerformCounterRestrictive {
l := utils.GetTestLogger(t)
l := logging.GetTestLogger(t)
upkeepCounters := make([]contracts.UpkeepPerformCounterRestrictive, 0)

for contractCount := 0; contractCount < numberOfContracts; contractCount++ {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"go.dedis.ch/kyber/v3/group/edwards25519"
"gopkg.in/guregu/null.v4"

"github.com/smartcontractkit/chainlink-testing-framework/utils"
"github.com/smartcontractkit/chainlink-testing-framework/logging"
"github.com/smartcontractkit/chainlink/v2/core/services/job"
"github.com/smartcontractkit/chainlink/v2/core/services/keystore/chaintype"
"github.com/smartcontractkit/libocr/offchainreporting2plus/confighelper"
Expand All @@ -39,7 +39,7 @@ func CreateOCR2VRFJobs(
chainID int64,
keyIndex int,
) {
l := utils.GetTestLogger(t)
l := logging.GetTestLogger(t)
p2pV2Bootstrapper := createBootstrapJob(t, bootstrapNode, OCR2VRFPluginConfig.DKGConfig.DKGContractAddress, chainID)

createNonBootstrapJobs(t, nonBootstrapNodes, OCR2VRFPluginConfig, chainID, keyIndex, p2pV2Bootstrapper)
Expand Down Expand Up @@ -120,7 +120,7 @@ func BuildOCR2DKGConfigVars(
t *testing.T,
ocr2VRFPluginConfig *OCR2VRFPluginConfig,
) contracts.OCRv2Config {
l := utils.GetTestLogger(t)
l := logging.GetTestLogger(t)
var onchainPublicKeys []common.Address
for _, onchainPublicKey := range ocr2VRFPluginConfig.OCR2Config.OnchainPublicKeys {
onchainPublicKeys = append(onchainPublicKeys, common.HexToAddress(onchainPublicKey))
Expand Down Expand Up @@ -272,7 +272,7 @@ func BuildOCR2VRFConfigVars(
t *testing.T,
ocr2VRFPluginConfig *OCR2VRFPluginConfig,
) contracts.OCRv2Config {
l := utils.GetTestLogger(t)
l := logging.GetTestLogger(t)
var onchainPublicKeys []common.Address
for _, onchainPublicKey := range ocr2VRFPluginConfig.OCR2Config.OnchainPublicKeys {
onchainPublicKeys = append(onchainPublicKeys, common.HexToAddress(onchainPublicKey))
Expand Down
10 changes: 5 additions & 5 deletions integration-tests/actions/ocr2vrf_actions/ocr2vrf_steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
ocr2vrftypes "github.com/smartcontractkit/ocr2vrf/types"

"github.com/smartcontractkit/chainlink-testing-framework/blockchain"
"github.com/smartcontractkit/chainlink-testing-framework/utils"
"github.com/smartcontractkit/chainlink-testing-framework/logging"

"github.com/smartcontractkit/chainlink/v2/core/services/keystore/chaintype"
chainlinkutils "github.com/smartcontractkit/chainlink/v2/core/utils"
Expand All @@ -25,7 +25,7 @@ import (
)

func SetAndWaitForVRFBeaconProcessToFinish(t *testing.T, ocr2VRFPluginConfig *OCR2VRFPluginConfig, vrfBeacon contracts.VRFBeacon) {
l := utils.GetTestLogger(t)
l := logging.GetTestLogger(t)
ocr2VrfConfig := BuildOCR2VRFConfigVars(t, ocr2VRFPluginConfig)
l.Debug().Interface("OCR2 VRF Config", ocr2VrfConfig).Msg("OCR2 VRF Config prepared")

Expand All @@ -45,7 +45,7 @@ func SetAndWaitForVRFBeaconProcessToFinish(t *testing.T, ocr2VRFPluginConfig *OC
}

func SetAndWaitForDKGProcessToFinish(t *testing.T, ocr2VRFPluginConfig *OCR2VRFPluginConfig, dkg contracts.DKG) {
l := utils.GetTestLogger(t)
l := logging.GetTestLogger(t)
ocr2DkgConfig := BuildOCR2DKGConfigVars(t, ocr2VRFPluginConfig)

// set config for DKG OCR
Expand Down Expand Up @@ -208,7 +208,7 @@ func RequestAndRedeemRandomness(
confirmationDelay *big.Int,
randomnessTransmissionEventTimeout time.Duration,
) *big.Int {
l := utils.GetTestLogger(t)
l := logging.GetTestLogger(t)
receipt, err := consumer.RequestRandomness(
numberOfRandomWordsToRequest,
subscriptionID,
Expand Down Expand Up @@ -244,7 +244,7 @@ func RequestRandomnessFulfillmentAndWaitForFulfilment(
confirmationDelay *big.Int,
randomnessTransmissionEventTimeout time.Duration,
) *big.Int {
l := utils.GetTestLogger(t)
l := logging.GetTestLogger(t)
receipt, err := consumer.RequestRandomnessFulfillment(
numberOfRandomWordsToRequest,
subscriptionID,
Expand Down
8 changes: 4 additions & 4 deletions integration-tests/actions/operator_forwarder_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/stretchr/testify/require"

"github.com/smartcontractkit/chainlink-testing-framework/blockchain"
"github.com/smartcontractkit/chainlink-testing-framework/utils"
"github.com/smartcontractkit/chainlink-testing-framework/logging"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/operator_factory"

"github.com/smartcontractkit/chainlink/integration-tests/client"
Expand Down Expand Up @@ -91,7 +91,7 @@ func ProcessNewEvent(
contractABI *abi.ABI,
chainClient blockchain.EVMClient,
) {
l := utils.GetTestLogger(t)
l := logging.GetTestLogger(t)
errorChan := make(chan error)
eventConfirmed := make(chan bool)
err := chainClient.ProcessEvent(eventDetails.Name, event, eventConfirmed, errorChan)
Expand Down Expand Up @@ -138,7 +138,7 @@ func SubscribeOperatorFactoryEvents(
chainClient blockchain.EVMClient,
operatorFactoryInstance contracts.OperatorFactory,
) {
l := utils.GetTestLogger(t)
l := logging.GetTestLogger(t)
contractABI, err := operator_factory.OperatorFactoryMetaData.GetAbi()
require.NoError(t, err, "Getting contract abi for OperatorFactory shouldn't fail")
latestBlockNum, err := chainClient.LatestBlockNumber(context.Background())
Expand Down Expand Up @@ -186,7 +186,7 @@ func TrackForwarder(
authorizedForwarder common.Address,
node *client.ChainlinkK8sClient,
) {
l := utils.GetTestLogger(t)
l := logging.GetTestLogger(t)
chainID := chainClient.GetChainID()
_, _, err := node.TrackForwarder(chainID, authorizedForwarder)
require.NoError(t, err, "Forwarder track should be created")
Expand Down
7 changes: 3 additions & 4 deletions integration-tests/benchmark/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ import (
"github.com/smartcontractkit/chainlink-env/pkg/helm/ethereum"
"github.com/smartcontractkit/chainlink-env/pkg/helm/reorg"
"github.com/smartcontractkit/chainlink-testing-framework/blockchain"
"github.com/smartcontractkit/chainlink-testing-framework/utils"

"github.com/smartcontractkit/chainlink-testing-framework/logging"
"github.com/smartcontractkit/chainlink-testing-framework/networks"

"github.com/smartcontractkit/chainlink/integration-tests/actions"
Expand Down Expand Up @@ -142,7 +141,7 @@ type NetworkConfig struct {
}

func TestAutomationBenchmark(t *testing.T) {
l := utils.GetTestLogger(t)
l := logging.GetTestLogger(t)
testEnvironment, benchmarkNetwork := SetupAutomationBenchmarkEnv(t)
if testEnvironment.WillUseRemoteRunner() {
return
Expand Down Expand Up @@ -299,7 +298,7 @@ func getEnv(key, fallback string) string {
}

func SetupAutomationBenchmarkEnv(t *testing.T) (*environment.Environment, blockchain.EVMNetwork) {
l := utils.GetTestLogger(t)
l := logging.GetTestLogger(t)
testNetwork := networks.SelectedNetwork // Environment currently being used to run benchmark test on
blockTime := "1"
networkDetailTOML := `MinIncomingConfirmations = 1`
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/chaos/automation_chaos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import (
"github.com/smartcontractkit/chainlink-env/pkg/helm/chainlink"
"github.com/smartcontractkit/chainlink-env/pkg/helm/ethereum"
"github.com/smartcontractkit/chainlink-testing-framework/blockchain"
"github.com/smartcontractkit/chainlink-testing-framework/utils"

"github.com/smartcontractkit/chainlink-testing-framework/logging"
"github.com/smartcontractkit/chainlink-testing-framework/networks"
"github.com/smartcontractkit/chainlink-testing-framework/utils"

"github.com/smartcontractkit/chainlink/integration-tests/actions"
"github.com/smartcontractkit/chainlink/integration-tests/client"
Expand Down Expand Up @@ -109,7 +109,7 @@ const (

func TestAutomationChaos(t *testing.T) {
t.Parallel()
l := utils.GetTestLogger(t)
l := logging.GetTestLogger(t)

testCases := map[string]struct {
networkChart environment.ConnectedChart
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/chaos/ocr2vrf_chaos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import (
"github.com/smartcontractkit/chainlink-env/pkg/helm/chainlink"
"github.com/smartcontractkit/chainlink-env/pkg/helm/ethereum"
"github.com/smartcontractkit/chainlink-testing-framework/blockchain"
"github.com/smartcontractkit/chainlink-testing-framework/utils"

"github.com/smartcontractkit/chainlink-testing-framework/logging"
"github.com/smartcontractkit/chainlink-testing-framework/networks"
"github.com/smartcontractkit/chainlink-testing-framework/utils"

"github.com/smartcontractkit/chainlink/integration-tests/actions"
"github.com/smartcontractkit/chainlink/integration-tests/actions/ocr2vrf_actions"
Expand All @@ -30,7 +30,7 @@ import (

func TestOCR2VRFChaos(t *testing.T) {
t.Parallel()
l := utils.GetTestLogger(t)
l := logging.GetTestLogger(t)
loadedNetwork := networks.SelectedNetwork

defaultOCR2VRFSettings := map[string]interface{}{
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/chaos/ocr_chaos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import (
mockservercfg "github.com/smartcontractkit/chainlink-env/pkg/helm/mockserver-cfg"
"github.com/smartcontractkit/chainlink-testing-framework/blockchain"
ctfClient "github.com/smartcontractkit/chainlink-testing-framework/client"
"github.com/smartcontractkit/chainlink-testing-framework/utils"

"github.com/smartcontractkit/chainlink-testing-framework/logging"
"github.com/smartcontractkit/chainlink-testing-framework/networks"
"github.com/smartcontractkit/chainlink-testing-framework/utils"

"github.com/smartcontractkit/chainlink/integration-tests/actions"
"github.com/smartcontractkit/chainlink/integration-tests/client"
Expand Down Expand Up @@ -59,7 +59,7 @@ func TestMain(m *testing.M) {

func TestOCRChaos(t *testing.T) {
t.Parallel()
l := utils.GetTestLogger(t)
l := logging.GetTestLogger(t)
testCases := map[string]struct {
networkChart environment.ConnectedChart
clChart environment.ConnectedChart
Expand Down
Loading

0 comments on commit 4c80930

Please sign in to comment.