diff --git a/integration-tests/actions/seth/actions.go b/integration-tests/actions/seth/actions.go index b29314a0850..dbca0f6a2b8 100644 --- a/integration-tests/actions/seth/actions.go +++ b/integration-tests/actions/seth/actions.go @@ -1075,3 +1075,20 @@ func GetReportStalenessData(t *testing.T, chainClient *seth.Client, startBlock, return } + +func GetStalenessReportCleanupFn(t *testing.T, logger zerolog.Logger, chainClient *seth.Client, startBlock uint64, registry contracts.KeeperRegistry, registryVersion ethereum.KeeperRegistryVersion) func() { + return func() { + if t.Failed() { + endBlock, err := chainClient.Client.BlockNumber(context.Background()) + require.NoError(t, err, "Failed to get end block") + + total, ok, reverted, stale, err := GetReportStalenessData(t, chainClient, big.NewInt(int64(startBlock)), big.NewInt(int64(endBlock)), registry, registryVersion) + require.NoError(t, err, "Failed to get staleness data") + if stale > 0 || reverted > 0 { + logger.Warn().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") + } else { + logger.Info().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") + } + } + } +} diff --git a/integration-tests/actions/seth/automation_ocr_helpers.go b/integration-tests/actions/seth/automation_ocr_helpers.go index 283ddfc026f..9e95bc26fa5 100644 --- a/integration-tests/actions/seth/automation_ocr_helpers.go +++ b/integration-tests/actions/seth/automation_ocr_helpers.go @@ -29,7 +29,7 @@ func DeployAutoOCRRegistryAndRegistrar( } // DeployConsumers deploys and registers keeper consumers. If ephemeral addresses are enabled, it will deploy and register the consumers from ephemeral addresses, but each upkpeep will be registered with root key address as the admin. Which means -// that functions like setting upkeep configuration, pausing, unpausing, etc. will be done by the root key address. It deployes mutlicall contract and sends link funds to each deployment address. +// that functions like setting upkeep configuration, pausing, unpausing, etc. will be done by the root key address. It deploys multicall contract and sends link funds to each deployment address. func DeployConsumers(t *testing.T, chainClient *seth.Client, registry contracts.KeeperRegistry, registrar contracts.KeeperRegistrar, linkToken contracts.LinkToken, numberOfUpkeeps int, linkFundsForEachUpkeep *big.Int, upkeepGasLimit uint32, isLogTrigger bool, isMercury bool) ([]contracts.KeeperConsumer, []*big.Int) { err := DeployMultiCallAndFundDeploymentAddresses(chainClient, linkToken, numberOfUpkeeps, linkFundsForEachUpkeep) require.NoError(t, err, "Sending link funds to deployment addresses shouldn't fail") @@ -47,8 +47,8 @@ func DeployConsumers(t *testing.T, chainClient *seth.Client, registry contracts. return upkeeps, upkeepIds } -// DeployPerformanceConsumers deploys and registers keeper performance consumers. If ephemeral addresses are enabled, it will deploy and register the consumers from ephemeral addresses, but each upkpeep will be registered with root key address as the admin. -// that functions like setting upkeep configuration, pausing, unpausing, etc. will be done by the root key address. It deployes mutlicall contract and sends link funds to each deployment address. +// DeployPerformanceConsumers deploys and registers keeper performance consumers. If ephemeral addresses are enabled, it will deploy and register the consumers from ephemeral addresses, but each upkeep will be registered with root key address as the admin. +// that functions like setting upkeep configuration, pausing, unpausing, etc. will be done by the root key address. It deploys multicall contract and sends link funds to each deployment address. func DeployPerformanceConsumers( t *testing.T, chainClient *seth.Client, @@ -79,7 +79,7 @@ func DeployPerformanceConsumers( } // DeployPerformDataCheckerConsumers deploys and registers keeper performance data checkers consumers. If ephemeral addresses are enabled, it will deploy and register the consumers from ephemeral addresses, but each upkpeep will be registered with root key address as the admin. -// that functions like setting upkeep configuration, pausing, unpausing, etc. will be done by the root key address. It deployes mutlicall contract and sends link funds to each deployment address. +// that functions like setting upkeep configuration, pausing, unpausing, etc. will be done by the root key address. It deployes multicall contract and sends link funds to each deployment address. func DeployPerformDataCheckerConsumers( t *testing.T, chainClient *seth.Client, diff --git a/integration-tests/load/automationv2_1/automationv2_1_test.go b/integration-tests/load/automationv2_1/automationv2_1_test.go index 8f158d8001e..98a3291a13b 100644 --- a/integration-tests/load/automationv2_1/automationv2_1_test.go +++ b/integration-tests/load/automationv2_1/automationv2_1_test.go @@ -528,8 +528,6 @@ Load Config: l.Error().Err(err).Msg("Error sending slack notification") } - // a.ChainClient.Cfg.PendingNonceProtectionEnabled = false - g, err := wasp.NewGenerator(&wasp.Config{ T: t, LoadType: wasp.RPS, diff --git a/integration-tests/smoke/automation_test.go b/integration-tests/smoke/automation_test.go index 8dfe8145400..1458c2607f5 100644 --- a/integration-tests/smoke/automation_test.go +++ b/integration-tests/smoke/automation_test.go @@ -174,18 +174,7 @@ func SetupAutomationBasic(t *testing.T, nodeUpgrade bool) { startTime := time.Now() t.Cleanup(func() { - if t.Failed() { - eb, err := a.ChainClient.Client.BlockNumber(context.Background()) - require.NoError(t, err, "Failed to get end block") - - total, ok, reverted, stale, err := actions_seth.GetReportStalenessData(t, a.ChainClient, big.NewInt(int64(sb)), big.NewInt(int64(eb)), a.Registry, registryVersion) - require.NoError(t, err, "Failed to get staleness data") - if stale > 0 || reverted > 0 { - l.Warn().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } else { - l.Info().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } - } + actions_seth.GetStalenessReportCleanupFn(t, a.Logger, a.ChainClient, sb, a.Registry, registryVersion)() }) // TODO Tune this timeout window after stress testing @@ -301,18 +290,9 @@ func TestSetUpkeepTriggerConfig(t *testing.T) { } } - if t.Failed() { - eb, err := a.ChainClient.Client.BlockNumber(context.Background()) - require.NoError(t, err, "Failed to get end block") - - total, ok, reverted, stale, err := actions_seth.GetReportStalenessData(t, a.ChainClient, big.NewInt(int64(sb)), big.NewInt(int64(eb)), a.Registry, registryVersion) - require.NoError(t, err, "Failed to get staleness data") - if stale > 0 || reverted > 0 { - l.Warn().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } else { - l.Info().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } - } + t.Cleanup(func() { + actions_seth.GetStalenessReportCleanupFn(t, a.Logger, a.ChainClient, sb, a.Registry, registryVersion)() + }) l.Info().Msg("Waiting for all upkeeps to perform") gom := gomega.NewGomegaWithT(t) @@ -484,18 +464,7 @@ func TestAutomationAddFunds(t *testing.T) { ) t.Cleanup(func() { - if t.Failed() { - eb, err := a.ChainClient.Client.BlockNumber(context.Background()) - require.NoError(t, err, "Failed to get end block") - - total, ok, reverted, stale, err := actions_seth.GetReportStalenessData(t, a.ChainClient, big.NewInt(int64(sb)), big.NewInt(int64(eb)), a.Registry, registryVersion) - require.NoError(t, err, "Failed to get staleness data") - if stale > 0 || reverted > 0 { - l.Warn().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } else { - l.Info().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } - } + actions_seth.GetStalenessReportCleanupFn(t, a.Logger, a.ChainClient, sb, a.Registry, registryVersion)() }) l.Info().Msg("Making sure for 2m no upkeeps are performed") @@ -573,18 +542,7 @@ func TestAutomationPauseUnPause(t *testing.T) { ) t.Cleanup(func() { - if t.Failed() { - eb, err := a.ChainClient.Client.BlockNumber(context.Background()) - require.NoError(t, err, "Failed to get end block") - - total, ok, reverted, stale, err := actions_seth.GetReportStalenessData(t, a.ChainClient, big.NewInt(int64(sb)), big.NewInt(int64(eb)), a.Registry, registryVersion) - require.NoError(t, err, "Failed to get staleness data") - if stale > 0 || reverted > 0 { - l.Warn().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } else { - l.Info().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } - } + actions_seth.GetStalenessReportCleanupFn(t, a.Logger, a.ChainClient, sb, a.Registry, registryVersion)() }) gom := gomega.NewGomegaWithT(t) @@ -683,18 +641,7 @@ func TestAutomationRegisterUpkeep(t *testing.T) { ) t.Cleanup(func() { - if t.Failed() { - eb, err := a.ChainClient.Client.BlockNumber(context.Background()) - require.NoError(t, err, "Failed to get end block") - - total, ok, reverted, stale, err := actions_seth.GetReportStalenessData(t, a.ChainClient, big.NewInt(int64(sb)), big.NewInt(int64(eb)), a.Registry, registryVersion) - require.NoError(t, err, "Failed to get staleness data") - if stale > 0 || reverted > 0 { - l.Warn().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } else { - l.Info().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } - } + actions_seth.GetStalenessReportCleanupFn(t, a.Logger, a.ChainClient, sb, a.Registry, registryVersion)() }) var initialCounters = make([]*big.Int, len(upkeepIDs)) @@ -763,7 +710,6 @@ func TestAutomationPauseRegistry(t *testing.T) { registryVersion := rv t.Run(name, func(t *testing.T) { t.Parallel() - l := logging.GetTestLogger(t) config, err := tc.GetConfig("Smoke", tc.Automation) require.NoError(t, err, "Failed to get config") @@ -789,18 +735,7 @@ func TestAutomationPauseRegistry(t *testing.T) { ) t.Cleanup(func() { - if t.Failed() { - eb, err := a.ChainClient.Client.BlockNumber(context.Background()) - require.NoError(t, err, "Failed to get end block") - - total, ok, reverted, stale, err := actions_seth.GetReportStalenessData(t, a.ChainClient, big.NewInt(int64(sb)), big.NewInt(int64(eb)), a.Registry, registryVersion) - require.NoError(t, err, "Failed to get staleness data") - if stale > 0 || reverted > 0 { - l.Warn().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } else { - l.Info().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } - } + actions_seth.GetStalenessReportCleanupFn(t, a.Logger, a.ChainClient, sb, a.Registry, registryVersion)() }) gom := gomega.NewGomegaWithT(t) @@ -878,18 +813,7 @@ func TestAutomationKeeperNodesDown(t *testing.T) { ) t.Cleanup(func() { - if t.Failed() { - eb, err := a.ChainClient.Client.BlockNumber(context.Background()) - require.NoError(t, err, "Failed to get end block") - - total, ok, reverted, stale, err := actions_seth.GetReportStalenessData(t, a.ChainClient, big.NewInt(int64(sb)), big.NewInt(int64(eb)), a.Registry, registryVersion) - require.NoError(t, err, "Failed to get staleness data") - if stale > 0 || reverted > 0 { - l.Warn().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } else { - l.Info().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } - } + actions_seth.GetStalenessReportCleanupFn(t, a.Logger, a.ChainClient, sb, a.Registry, registryVersion)() }) gom := gomega.NewGomegaWithT(t) @@ -971,7 +895,6 @@ func TestAutomationPerformSimulation(t *testing.T) { registryVersion := rv t.Run(name, func(t *testing.T) { t.Parallel() - l := logging.GetTestLogger(t) config, err := tc.GetConfig("Smoke", tc.Automation) require.NoError(t, err, "Failed to get config") @@ -998,18 +921,7 @@ func TestAutomationPerformSimulation(t *testing.T) { ) t.Cleanup(func() { - if t.Failed() { - eb, err := a.ChainClient.Client.BlockNumber(context.Background()) - require.NoError(t, err, "Failed to get end block") - - total, ok, reverted, stale, err := actions_seth.GetReportStalenessData(t, a.ChainClient, big.NewInt(int64(sb)), big.NewInt(int64(eb)), a.Registry, registryVersion) - require.NoError(t, err, "Failed to get staleness data") - if stale > 0 || reverted > 0 { - l.Warn().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } else { - l.Info().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } - } + actions_seth.GetStalenessReportCleanupFn(t, a.Logger, a.ChainClient, sb, a.Registry, registryVersion)() }) gom := gomega.NewGomegaWithT(t) @@ -1080,18 +992,7 @@ func TestAutomationCheckPerformGasLimit(t *testing.T) { ) t.Cleanup(func() { - if t.Failed() { - eb, err := a.ChainClient.Client.BlockNumber(context.Background()) - require.NoError(t, err, "Failed to get end block") - - total, ok, reverted, stale, err := actions_seth.GetReportStalenessData(t, a.ChainClient, big.NewInt(int64(sb)), big.NewInt(int64(eb)), a.Registry, registryVersion) - require.NoError(t, err, "Failed to get staleness data") - if stale > 0 || reverted > 0 { - l.Warn().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } else { - l.Info().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } - } + actions_seth.GetStalenessReportCleanupFn(t, a.Logger, a.ChainClient, sb, a.Registry, registryVersion)() }) gom := gomega.NewGomegaWithT(t) @@ -1243,18 +1144,7 @@ func TestUpdateCheckData(t *testing.T) { ) t.Cleanup(func() { - if t.Failed() { - eb, err := a.ChainClient.Client.BlockNumber(context.Background()) - require.NoError(t, err, "Failed to get end block") - - total, ok, reverted, stale, err := actions_seth.GetReportStalenessData(t, a.ChainClient, big.NewInt(int64(sb)), big.NewInt(int64(eb)), a.Registry, registryVersion) - require.NoError(t, err, "Failed to get staleness data") - if stale > 0 || reverted > 0 { - l.Warn().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } else { - l.Info().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } - } + actions_seth.GetStalenessReportCleanupFn(t, a.Logger, a.ChainClient, sb, a.Registry, registryVersion)() }) gom := gomega.NewGomegaWithT(t) @@ -1319,6 +1209,9 @@ func TestSetOffchainConfigWithMaxGasPrice(t *testing.T) { t, registryVersion, automationDefaultRegistryConfig(config), false, false, &config, ) + sb, err := a.ChainClient.Client.BlockNumber(context.Background()) + require.NoError(t, err, "Failed to get start block") + consumers, upkeepIDs := actions_seth.DeployConsumers( t, a.ChainClient, @@ -1331,8 +1224,12 @@ func TestSetOffchainConfigWithMaxGasPrice(t *testing.T) { false, false, ) - gom := gomega.NewGomegaWithT(t) + t.Cleanup(func() { + actions_seth.GetStalenessReportCleanupFn(t, a.Logger, a.ChainClient, sb, a.Registry, registryVersion)() + }) + + gom := gomega.NewGomegaWithT(t) l.Info().Msg("waiting for all upkeeps to be performed at least once") gom.Eventually(func(g gomega.Gomega) { for i := 0; i < len(upkeepIDs); i++ { diff --git a/integration-tests/smoke/keeper_test.go b/integration-tests/smoke/keeper_test.go index 8b39924f6a3..00e45256cea 100644 --- a/integration-tests/smoke/keeper_test.go +++ b/integration-tests/smoke/keeper_test.go @@ -112,18 +112,7 @@ func TestKeeperBasicSmoke(t *testing.T) { ) t.Cleanup(func() { - if t.Failed() { - eb, err := chainClient.Client.BlockNumber(context.Background()) - require.NoError(t, err, "Failed to get end block") - - total, ok, reverted, stale, err := actions_seth.GetReportStalenessData(t, chainClient, big.NewInt(int64(sb)), big.NewInt(int64(eb)), registry, registryVersion) - require.NoError(t, err, "Failed to get staleness data") - if stale > 0 || reverted > 0 { - l.Warn().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } else { - l.Info().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } - } + actions_seth.GetStalenessReportCleanupFn(t, l, chainClient, sb, registry, registryVersion)() }) _, err = actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}, fmt.Sprint(chainClient.ChainID)) @@ -207,18 +196,7 @@ func TestKeeperBlockCountPerTurn(t *testing.T) { require.NoError(t, err, "Error creating keeper jobs") t.Cleanup(func() { - if t.Failed() { - eb, err := chainClient.Client.BlockNumber(context.Background()) - require.NoError(t, err, "Failed to get end block") - - total, ok, reverted, stale, err := actions_seth.GetReportStalenessData(t, chainClient, big.NewInt(int64(sb)), big.NewInt(int64(eb)), registry, registryVersion) - require.NoError(t, err, "Failed to get staleness data") - if stale > 0 || reverted > 0 { - l.Warn().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } else { - l.Info().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } - } + actions_seth.GetStalenessReportCleanupFn(t, l, chainClient, sb, registry, registryVersion)() }) keepersPerformedLowFreq := map[*big.Int][]string{} @@ -366,18 +344,7 @@ func TestKeeperSimulation(t *testing.T) { require.NoError(t, err, "Error creating keeper jobs") t.Cleanup(func() { - if t.Failed() { - eb, err := chainClient.Client.BlockNumber(context.Background()) - require.NoError(t, err, "Failed to get end block") - - total, ok, reverted, stale, err := actions_seth.GetReportStalenessData(t, chainClient, big.NewInt(int64(sb)), big.NewInt(int64(eb)), registry, registryVersion) - require.NoError(t, err, "Failed to get staleness data") - if stale > 0 || reverted > 0 { - l.Warn().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } else { - l.Info().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } - } + actions_seth.GetStalenessReportCleanupFn(t, l, chainClient, sb, registry, registryVersion)() }) consumerPerformance := consumersPerformance[0] @@ -456,18 +423,7 @@ func TestKeeperCheckPerformGasLimit(t *testing.T) { require.NoError(t, err, "Error creating keeper jobs") t.Cleanup(func() { - if t.Failed() { - eb, err := chainClient.Client.BlockNumber(context.Background()) - require.NoError(t, err, "Failed to get end block") - - total, ok, reverted, stale, err := actions_seth.GetReportStalenessData(t, chainClient, big.NewInt(int64(sb)), big.NewInt(int64(eb)), registry, registryVersion) - require.NoError(t, err, "Failed to get staleness data") - if stale > 0 || reverted > 0 { - l.Warn().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } else { - l.Info().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } - } + actions_seth.GetStalenessReportCleanupFn(t, l, chainClient, sb, registry, registryVersion)() }) gom := gomega.NewGomegaWithT(t) @@ -599,18 +555,7 @@ func TestKeeperRegisterUpkeep(t *testing.T) { require.NoError(t, err, "Error creating keeper jobs") t.Cleanup(func() { - if t.Failed() { - eb, err := chainClient.Client.BlockNumber(context.Background()) - require.NoError(t, err, "Failed to get end block") - - total, ok, reverted, stale, err := actions_seth.GetReportStalenessData(t, chainClient, big.NewInt(int64(sb)), big.NewInt(int64(eb)), registry, registryVersion) - require.NoError(t, err, "Failed to get staleness data") - if stale > 0 || reverted > 0 { - l.Warn().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } else { - l.Info().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } - } + actions_seth.GetStalenessReportCleanupFn(t, l, chainClient, sb, registry, registryVersion)() }) var initialCounters = make([]*big.Int, len(upkeepIDs)) @@ -707,18 +652,7 @@ func TestKeeperAddFunds(t *testing.T) { require.NoError(t, err, "Error creating keeper jobs") t.Cleanup(func() { - if t.Failed() { - eb, err := chainClient.Client.BlockNumber(context.Background()) - require.NoError(t, err, "Failed to get end block") - - total, ok, reverted, stale, err := actions_seth.GetReportStalenessData(t, chainClient, big.NewInt(int64(sb)), big.NewInt(int64(eb)), registry, registryVersion) - require.NoError(t, err, "Failed to get staleness data") - if stale > 0 || reverted > 0 { - l.Warn().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } else { - l.Info().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } - } + actions_seth.GetStalenessReportCleanupFn(t, l, chainClient, sb, registry, registryVersion)() }) // Since the upkeep is currently underfunded, check that it doesn't get executed @@ -793,18 +727,7 @@ func TestKeeperRemove(t *testing.T) { require.NoError(t, err, "Error creating keeper jobs") t.Cleanup(func() { - if t.Failed() { - eb, err := chainClient.Client.BlockNumber(context.Background()) - require.NoError(t, err, "Failed to get end block") - - total, ok, reverted, stale, err := actions_seth.GetReportStalenessData(t, chainClient, big.NewInt(int64(sb)), big.NewInt(int64(eb)), registry, registryVersion) - require.NoError(t, err, "Failed to get staleness data") - if stale > 0 || reverted > 0 { - l.Warn().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } else { - l.Info().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } - } + actions_seth.GetStalenessReportCleanupFn(t, l, chainClient, sb, registry, registryVersion)() }) var initialCounters = make([]*big.Int, len(upkeepIDs)) @@ -890,18 +813,7 @@ func TestKeeperPauseRegistry(t *testing.T) { require.NoError(t, err, "Error creating keeper jobs") t.Cleanup(func() { - if t.Failed() { - eb, err := chainClient.Client.BlockNumber(context.Background()) - require.NoError(t, err, "Failed to get end block") - - total, ok, reverted, stale, err := actions_seth.GetReportStalenessData(t, chainClient, big.NewInt(int64(sb)), big.NewInt(int64(eb)), registry, registryVersion) - require.NoError(t, err, "Failed to get staleness data") - if stale > 0 || reverted > 0 { - l.Warn().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } else { - l.Info().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } - } + actions_seth.GetStalenessReportCleanupFn(t, l, chainClient, sb, registry, registryVersion)() }) // Observe that the upkeeps which are initially registered are performing @@ -966,18 +878,7 @@ func TestKeeperMigrateRegistry(t *testing.T) { require.NoError(t, err, "Error creating keeper jobs") t.Cleanup(func() { - if t.Failed() { - eb, err := chainClient.Client.BlockNumber(context.Background()) - require.NoError(t, err, "Failed to get end block") - - total, ok, reverted, stale, err := actions_seth.GetReportStalenessData(t, chainClient, big.NewInt(int64(sb)), big.NewInt(int64(eb)), registry, ethereum.RegistryVersion_1_2) - require.NoError(t, err, "Failed to get staleness data") - if stale > 0 || reverted > 0 { - l.Warn().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } else { - l.Info().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } - } + actions_seth.GetStalenessReportCleanupFn(t, l, chainClient, sb, registry, ethereum.RegistryVersion_1_2)() }) // Deploy the second registry, second registrar, and the same number of upkeeps as the first one @@ -1081,18 +982,7 @@ func TestKeeperNodeDown(t *testing.T) { require.NoError(t, err, "Error creating keeper jobs") t.Cleanup(func() { - if t.Failed() { - eb, err := chainClient.Client.BlockNumber(context.Background()) - require.NoError(t, err, "Failed to get end block") - - total, ok, reverted, stale, err := actions_seth.GetReportStalenessData(t, chainClient, big.NewInt(int64(sb)), big.NewInt(int64(eb)), registry, registryVersion) - require.NoError(t, err, "Failed to get staleness data") - if stale > 0 || reverted > 0 { - l.Warn().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } else { - l.Info().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } - } + actions_seth.GetStalenessReportCleanupFn(t, l, chainClient, sb, registry, registryVersion)() }) var initialCounters = make([]*big.Int, len(upkeepIDs)) @@ -1202,18 +1092,7 @@ func TestKeeperPauseUnPauseUpkeep(t *testing.T) { require.NoError(t, err, "Error creating keeper jobs") t.Cleanup(func() { - if t.Failed() { - eb, err := chainClient.Client.BlockNumber(context.Background()) - require.NoError(t, err, "Failed to get end block") - - total, ok, reverted, stale, err := actions_seth.GetReportStalenessData(t, chainClient, big.NewInt(int64(sb)), big.NewInt(int64(eb)), registry, ethereum.RegistryVersion_1_3) - require.NoError(t, err, "Failed to get staleness data") - if stale > 0 || reverted > 0 { - l.Warn().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } else { - l.Info().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } - } + actions_seth.GetStalenessReportCleanupFn(t, l, chainClient, sb, registry, ethereum.RegistryVersion_1_3)() }) gom := gomega.NewGomegaWithT(t) @@ -1306,18 +1185,7 @@ func TestKeeperUpdateCheckData(t *testing.T) { require.NoError(t, err, "Error creating keeper jobs") t.Cleanup(func() { - if t.Failed() { - eb, err := chainClient.Client.BlockNumber(context.Background()) - require.NoError(t, err, "Failed to get end block") - - total, ok, reverted, stale, err := actions_seth.GetReportStalenessData(t, chainClient, big.NewInt(int64(sb)), big.NewInt(int64(eb)), registry, ethereum.RegistryVersion_1_3) - require.NoError(t, err, "Failed to get staleness data") - if stale > 0 || reverted > 0 { - l.Warn().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } else { - l.Info().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } - } + actions_seth.GetStalenessReportCleanupFn(t, l, chainClient, sb, registry, ethereum.RegistryVersion_1_3)() }) gom := gomega.NewGomegaWithT(t) diff --git a/integration-tests/testconfig/automation/automation.toml b/integration-tests/testconfig/automation/automation.toml index 726bc1ab39e..4df2cbebc52 100644 --- a/integration-tests/testconfig/automation/automation.toml +++ b/integration-tests/testconfig/automation/automation.toml @@ -58,9 +58,6 @@ spec_type="minimum" chainlink_node_log_level="info" use_prometheus=false -[Reorg.Seth] -ephemeral_addresses_number = 20 - # load test specific overrides [Load.Seth] ephemeral_addresses_number = 100