Documentation
¶
Overview ¶
Copyright © 2022 Polygon <engineering@polygon.technology>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var LoadtestCmd = &cobra.Command{ Use: "loadtest rpc-endpoint", Short: "A simple script for quickly running a load test", Long: `Loadtest gives us a simple way to run a generic load test against an eth/EVM style json RPC endpoint`, RunE: func(cmd *cobra.Command, args []string) error { log.Debug().Msg("Starting Loadtest") err := runLoadTest(cmd.Context()) if err != nil { return err } return nil }, Args: func(cmd *cobra.Command, args []string) error { zerolog.DurationFieldUnit = time.Second zerolog.DurationFieldInteger = true if len(args) != 1 { return fmt.Errorf("expected exactly one argument") } url, err := url.Parse(args[0]) if err != nil { log.Error().Err(err).Msg("Unable to parse url input error") return err } if url.Scheme != "http" && url.Scheme != "https" && url.Scheme != "ws" && url.Scheme != "wss" { return fmt.Errorf("the scheme %s is not supported", url.Scheme) } inputLoadTestParams.URL = url r := regexp.MustCompile(fmt.Sprintf("^[%s]+$", strings.Join(validLoadTestModes, ""))) if !r.MatchString(*inputLoadTestParams.Mode) { return fmt.Errorf("the mode %s is not recognized", *inputLoadTestParams.Mode) } if *inputLoadTestParams.AdaptiveBackoffFactor <= 0.0 { return fmt.Errorf("the backoff factor needs to be non-zero positive") } return nil }, }
LoadtestCmd represents the loadtest command
Functions ¶
This section is empty.