From 6eeb3bcb6468c1a6ae3df83254648e1086841e2d Mon Sep 17 00:00:00 2001 From: Anirudh Warrier <12178754+anirudhwarrier@users.noreply.github.com> Date: Thu, 14 Mar 2024 14:35:07 +0400 Subject: [PATCH] Fix load benchmark test (AUTO-9278) (#12427) * remove chainid references in benchmark test * fix TTL issue in load test --- integration-tests/benchmark/keeper_test.go | 47 ++++++++++--------- .../automationv2_1/automationv2_1_test.go | 12 ++++- 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/integration-tests/benchmark/keeper_test.go b/integration-tests/benchmark/keeper_test.go index d6c4c6b2587..e6cda6d7f27 100644 --- a/integration-tests/benchmark/keeper_test.go +++ b/integration-tests/benchmark/keeper_test.go @@ -141,7 +141,7 @@ func TestAutomationBenchmark(t *testing.T) { networkName := strings.ReplaceAll(benchmarkNetwork.Name, " ", "") testName := fmt.Sprintf("%s%s", networkName, *config.Keeper.Common.RegistryToTest) l.Info().Str("Test Name", testName).Msg("Running Benchmark Test") - benchmarkTestNetwork := getNetworkConfig(networkName, &config) + benchmarkTestNetwork := getNetworkConfig(&config) l.Info().Str("Namespace", testEnvironment.Cfg.Namespace).Msg("Connected to Keepers Benchmark Environment") @@ -239,14 +239,15 @@ func repeatRegistries(registryVersion eth_contracts.KeeperRegistryVersion, numbe return repeatedRegistries } -func getNetworkConfig(networkName string, config *tc.TestConfig) NetworkConfig { +func getNetworkConfig(config *tc.TestConfig) NetworkConfig { + evmNetwork := networks.MustGetSelectedNetworkConfig(config.GetNetworkConfig())[0] var nc NetworkConfig var ok bool - if nc, ok = networkConfig[networkName]; !ok { + if nc, ok = networkConfig[evmNetwork.Name]; !ok { return defaultNetworkConfig } - if networkName == "SimulatedGeth" || networkName == "geth" { + if evmNetwork.Name == networks.SimulatedEVM.Name || evmNetwork.Name == networks.SimulatedEVMNonDev.Name { return nc } @@ -256,63 +257,63 @@ func getNetworkConfig(networkName string, config *tc.TestConfig) NetworkConfig { } var networkConfig = map[string]NetworkConfig{ - "SimulatedGeth": { + networks.SimulatedEVM.Name: { upkeepSLA: int64(120), //2 minutes blockTime: time.Second, deltaStage: 30 * time.Second, funding: big.NewFloat(100_000), }, - "geth": { + networks.SimulatedEVMNonDev.Name: { upkeepSLA: int64(120), //2 minutes blockTime: time.Second, deltaStage: 30 * time.Second, funding: big.NewFloat(100_000), }, - "GoerliTestnet": { + networks.GoerliTestnet.Name: { upkeepSLA: int64(4), blockTime: 12 * time.Second, deltaStage: time.Duration(0), }, - "ArbitrumGoerli": { - upkeepSLA: int64(20), - blockTime: time.Second, - deltaStage: time.Duration(0), - }, - "OptimismGoerli": { - upkeepSLA: int64(20), - blockTime: time.Second, - deltaStage: time.Duration(0), - }, - "SepoliaTestnet": { + networks.SepoliaTestnet.Name: { upkeepSLA: int64(4), blockTime: 12 * time.Second, deltaStage: time.Duration(0), }, - "PolygonMumbai": { + networks.PolygonMumbai.Name: { upkeepSLA: int64(4), blockTime: 12 * time.Second, deltaStage: time.Duration(0), }, - "BaseGoerli": { + networks.BaseGoerli.Name: { upkeepSLA: int64(60), blockTime: 2 * time.Second, deltaStage: 20 * time.Second, }, - "ArbitrumSepolia": { + networks.ArbitrumSepolia.Name: { + upkeepSLA: int64(120), + blockTime: time.Second, + deltaStage: 20 * time.Second, + }, + networks.OptimismSepolia.Name: { upkeepSLA: int64(120), blockTime: time.Second, deltaStage: 20 * time.Second, }, - "LineaGoerli": { + networks.LineaGoerli.Name: { upkeepSLA: int64(120), blockTime: time.Second, deltaStage: 20 * time.Second, }, - "GnosisChiado": { + networks.GnosisChiado.Name: { upkeepSLA: int64(120), blockTime: 6 * time.Second, deltaStage: 20 * time.Second, }, + networks.PolygonZkEvmCardona.Name: { + upkeepSLA: int64(120), + blockTime: time.Second, + deltaStage: 20 * time.Second, + }, } func SetupAutomationBenchmarkEnv(t *testing.T, keeperTestConfig types.KeeperBenchmarkTestConfig) (*environment.Environment, blockchain.EVMNetwork) { diff --git a/integration-tests/load/automationv2_1/automationv2_1_test.go b/integration-tests/load/automationv2_1/automationv2_1_test.go index bfd39ad4d54..0b902423339 100644 --- a/integration-tests/load/automationv2_1/automationv2_1_test.go +++ b/integration-tests/load/automationv2_1/automationv2_1_test.go @@ -181,7 +181,7 @@ Load Config: } testEnvironment := environment.New(&environment.Config{ - TTL: loadDuration + time.Hour*6, + TTL: loadDuration.Round(time.Hour) + time.Hour, NamespacePrefix: fmt.Sprintf( "automation-%s-%s", testType, @@ -712,6 +712,16 @@ Test Duration: %s` t.Cleanup(func() { if err = actions.TeardownRemoteSuite(t, testEnvironment.Cfg.Namespace, chainlinkNodes, nil, &loadedTestConfig, chainClient); err != nil { l.Error().Err(err).Msg("Error when tearing down remote suite") + testEnvironment.Cfg.TTL = time.Hour * 48 + err := testEnvironment.Run() + if err != nil { + l.Error().Err(err).Msg("Error increasing TTL of namespace") + } + } else if chainClient.NetworkSimulated() { + err := testEnvironment.Client.RemoveNamespace(testEnvironment.Cfg.Namespace) + if err != nil { + l.Error().Err(err).Msg("Error removing namespace") + } } })