Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Stress test refactor #1501

Merged
merged 14 commits into from
Jan 22, 2024
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ Getting the correct TSS address for Bitcoin now requires proviidng the Bitcoin c
* [1546](https://github.com/zeta-chain/node/pull/1546) - fix reset of pending nonces on genesis import
* [1555](https://github.com/zeta-chain/node/pull/1555) - Reduce websocket message limit to 10MB
* [1567](https://github.com/zeta-chain/node/pull/1567) - add bitcoin chain id to fetch the tss address rpc endpoint
* [1501](https://github.com/zeta-chain/node/pull/1501) - fix stress test - use new refactored config file and smoketest runner
* [1589](https://github.com/zeta-chain/node/pull/1589) - add bitcoin chain id to `get tss address` and `get tss address historical` cli query

### Refactoring
Expand Down
39 changes: 39 additions & 0 deletions cmd/zetae2e/init.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package main

import (
"fmt"

"github.com/zeta-chain/zetacore/cmd/zetae2e/local"

"github.com/spf13/cobra"
"github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/config"
)

var initConf = config.Config{}
var configFile = ""

func NewInitCmd() *cobra.Command {
var InitCmd = &cobra.Command{
Use: "init",
Short: "initialize config file for e2e tests",
Run: initConfig,
}

InitCmd.Flags().StringVar(&initConf.RPCs.EVM, "ethURL", "http://eth:8545", "--ethURL http://eth:8545")
InitCmd.Flags().StringVar(&initConf.RPCs.ZetaCoreGRPC, "grpcURL", "zetacore0:9090", "--grpcURL zetacore0:9090")
InitCmd.Flags().StringVar(&initConf.RPCs.ZetaCoreRPC, "rpcURL", "http://zetacore0:26657", "--rpcURL http://zetacore0:26657")
InitCmd.Flags().StringVar(&initConf.RPCs.Zevm, "zevmURL", "http://zetacore0:8545", "--zevmURL http://zetacore0:8545")
InitCmd.Flags().StringVar(&initConf.RPCs.Bitcoin, "btcURL", "bitcoin:18443", "--grpcURL bitcoin:18443")

InitCmd.Flags().StringVar(&initConf.ZetaChainID, "chainID", "athens_101-1", "--chainID athens_101-1")
InitCmd.Flags().StringVar(&configFile, local.FlagConfigFile, "smoketest.config", "--cfg ./smoketest.config")

return InitCmd
}

func initConfig(_ *cobra.Command, _ []string) {
err := config.WriteConfig(configFile, initConf)
if err != nil {
fmt.Printf("error writing config file: %s", err.Error())
}
}
6 changes: 3 additions & 3 deletions cmd/zetae2e/local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
const (
flagContractsDeployed = "deployed"
flagWaitForHeight = "wait-for"
flagConfigFile = "config"
FlagConfigFile = "config"
flagVerbose = "verbose"
flagTestAdmin = "test-admin"
flagTestCustom = "test-custom"
Expand Down Expand Up @@ -51,7 +51,7 @@ func NewLocalCmd() *cobra.Command {
"block height for tests to begin, ex. --wait-for 100",
)
cmd.Flags().String(
flagConfigFile,
FlagConfigFile,
"",
"config file to use for the tests",
)
Expand Down Expand Up @@ -149,7 +149,7 @@ func localE2ETest(cmd *cobra.Command, _ []string) {
}()

// initialize tests config
conf, err := getConfig(cmd)
conf, err := GetConfig(cmd)
if err != nil {
panic(err)
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/zetae2e/local/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import (
crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types"
)

// getConfig returns config from file from the command line flag
func getConfig(cmd *cobra.Command) (config.Config, error) {
configFile, err := cmd.Flags().GetString(flagConfigFile)
// GetConfig returns config from file from the command line flag
func GetConfig(cmd *cobra.Command) (config.Config, error) {
configFile, err := cmd.Flags().GetString(FlagConfigFile)
if err != nil {
return config.Config{}, err
}
Expand Down
2 changes: 2 additions & 0 deletions cmd/zetae2e/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ func NewRootCmd() *cobra.Command {
cmd.AddCommand(
NewRunCmd(),
local.NewLocalCmd(),
NewStressTestCmd(),
NewInitCmd(),
)

return cmd
Expand Down
Loading