Skip to content

Commit

Permalink
Fix load benchmark test (AUTO-9278) (#12427)
Browse files Browse the repository at this point in the history
* remove chainid references in benchmark test

* fix TTL issue in load test
  • Loading branch information
anirudhwarrier authored Mar 14, 2024
1 parent 83c8688 commit 6eeb3bc
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 24 deletions.
47 changes: 24 additions & 23 deletions integration-tests/benchmark/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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
}

Expand All @@ -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) {
Expand Down
12 changes: 11 additions & 1 deletion integration-tests/load/automationv2_1/automationv2_1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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")
}
}
})

Expand Down

0 comments on commit 6eeb3bc

Please sign in to comment.