types

package
v0.0.0-...-db344e9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EstimateCallCount

func EstimateCallCount(rates []int, durations []int, nRepeats *int) (int, error)

EstimateCallCount calculates the total number of calls for a load test

Types

type DeepOutput

type DeepOutput string
const (
	RawDeepOutput     DeepOutput = "raw"
	MetricsDeepOutput DeepOutput = "metrics"
)

type Erc20TxBuilder

type Erc20TxBuilder interface {
	TxBuilder
	// Returns the transfer token value
	GetTransferValue() (*big.Int, error)

	// Returns the token balance for the specified address
	GetTokenBalance(address common.Address) (*big.Int, error)

	// Returns the suppliers token balance
	GetSupplierBalance() (*big.Int, error)

	// Returns the token name
	GetTokenSymbol() string

	// Funds the specified account
	FundAccount(address common.Address, amount *big.Int) error
}

type Erc721TxBuilder

type Erc721TxBuilder interface {
	TxBuilder
}

type ErrorPair

type ErrorPair [2]interface{}

type JsonError

type JsonError struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data,omitempty"`
}

type JsonrpcMessage

type JsonrpcMessage struct {
	Version string          `json:"jsonrpc,omitempty"`
	ID      int64           `json:"id,omitempty"`
	Method  string          `json:"method,omitempty"`
	Params  []interface{}   `json:"params,omitempty"`
	Error   *JsonError      `json:"error,omitempty"`
	Result  json.RawMessage `json:"result,omitempty"`
}

A value of this type can a JSON-RPC request, notification, successful response or error response. Which one it is depends on the fields.

type LoadTest

type LoadTest struct {
	TestParameters TestGenerationParameters `json:"test_parameters"`
	Attacks        []VegetaAttack           `json:"attacks"`
}

type LoadTestColumnWise

type LoadTestColumnWise struct {
	Rates      []int           `json:"rates"`
	Durations  []int           `json:"durations"`
	Calls      [][]interface{} `json:"calls"`
	VegetaArgs []interface{}   `json:"vegeta_args"`
}

type LoadTestDeepOutput

type LoadTestDeepOutput struct {
	TargetRate            []int            `json:"target_rate"`
	ActualRate            []*float64       `json:"actual_rate"`
	TargetDuration        []int            `json:"target_duration"`
	ActualDuration        []*float64       `json:"actual_duration"`
	Requests              []int            `json:"requests"`
	Throughput            []*float64       `json:"throughput"`
	Success               []*float64       `json:"success"`
	Min                   []*float64       `json:"min"`
	Mean                  []*float64       `json:"mean"`
	P50                   []*float64       `json:"p50"`
	P90                   []*float64       `json:"p90"`
	P95                   []*float64       `json:"p95"`
	P99                   []*float64       `json:"p99"`
	Max                   []*float64       `json:"max"`
	StatusCodes           []map[string]int `json:"status_codes"`
	Errors                [][]string       `json:"errors"`
	FirstRequestTimestamp []*string        `json:"first_request_timestamp"`
	LastRequestTimestamp  []*string        `json:"last_request_timestamp"`
	LastResponseTimestamp []*string        `json:"last_response_timestamp"`
	FinalWaitTime         []*float64       `json:"final_wait_time"`
	NInvalidJSONErrors    []int            `json:"n_invalid_json_errors"`
	NRPCErrors            []int            `json:"n_rpc_errors"`
}

type LoadTestDeepOutputDatum

type LoadTestDeepOutputDatum struct {
	TargetRate            int            `json:"target_rate"`
	ActualRate            *float64       `json:"actual_rate"`
	TargetDuration        int            `json:"target_duration"`
	ActualDuration        *float64       `json:"actual_duration"`
	Requests              int            `json:"requests"`
	Throughput            *float64       `json:"throughput"`
	Success               *float64       `json:"success"`
	Min                   *float64       `json:"min"`
	Mean                  *float64       `json:"mean"`
	P50                   *float64       `json:"p50"`
	P90                   *float64       `json:"p90"`
	P95                   *float64       `json:"p95"`
	P99                   *float64       `json:"p99"`
	Max                   *float64       `json:"max"`
	StatusCodes           map[string]int `json:"status_codes"`
	Errors                []string       `json:"errors"`
	FirstRequestTimestamp *string        `json:"first_request_timestamp"`
	LastRequestTimestamp  *string        `json:"last_request_timestamp"`
	LastResponseTimestamp *string        `json:"last_response_timestamp"`
	FinalWaitTime         *float64       `json:"final_wait_time"`
	NInvalidJSONErrors    int            `json:"n_invalid_json_errors"`
	NRPCErrors            int            `json:"n_rpc_errors"`
}

type LoadTestGenerator

type LoadTestGenerator func(...interface{}) []VegetaAttack

type LoadTestMode

type LoadTestMode string
const (
	StressMode LoadTestMode = "stress"
	SpikeMode  LoadTestMode = "spike"
	SoakMode   LoadTestMode = "soak"
)

type LoadTestOutput

type LoadTestOutput struct {
	TargetRate            []int                                   `json:"target_rate"`
	ActualRate            []*float64                              `json:"actual_rate"`
	TargetDuration        []int                                   `json:"target_duration"`
	ActualDuration        []*float64                              `json:"actual_duration"`
	Requests              []int                                   `json:"requests"`
	Throughput            []*float64                              `json:"throughput"`
	Success               []*float64                              `json:"success"`
	Min                   []*float64                              `json:"min"`
	Mean                  []*float64                              `json:"mean"`
	P50                   []*float64                              `json:"p50"`
	P90                   []*float64                              `json:"p90"`
	P95                   []*float64                              `json:"p95"`
	P99                   []*float64                              `json:"p99"`
	Max                   []*float64                              `json:"max"`
	StatusCodes           []map[string]int                        `json:"status_codes"`
	Errors                [][]string                              `json:"errors"`
	FirstRequestTimestamp []*string                               `json:"first_request_timestamp"`
	LastRequestTimestamp  []*string                               `json:"last_request_timestamp"`
	LastResponseTimestamp []*string                               `json:"last_response_timestamp"`
	FinalWaitTime         []*float64                              `json:"final_wait_time"`
	DeepRawOutput         []*string                               `json:"deep_raw_output"`
	DeepMetrics           map[ResponseCategory]LoadTestDeepOutput `json:"deep_metrics"`
	DeepRPCErrorPairs     [][]ErrorPair                           `json:"deep_rpc_error_pairs"`
}

func BuildLoadTestOutput

func BuildLoadTestOutput(listOfMaps []*LoadTestOutputDatum) LoadTestOutput

type LoadTestOutputDatum

type LoadTestOutputDatum struct {
	TargetRate            int                                          `json:"target_rate"`
	ActualRate            *float64                                     `json:"actual_rate"`
	TargetDuration        int                                          `json:"target_duration"`
	ActualDuration        *float64                                     `json:"actual_duration"`
	Requests              int                                          `json:"requests"`
	Throughput            *float64                                     `json:"throughput"`
	Success               *float64                                     `json:"success"`
	Min                   *float64                                     `json:"min"`
	Mean                  *float64                                     `json:"mean"`
	P50                   *float64                                     `json:"p50"`
	P90                   *float64                                     `json:"p90"`
	P95                   *float64                                     `json:"p95"`
	P99                   *float64                                     `json:"p99"`
	Max                   *float64                                     `json:"max"`
	StatusCodes           map[string]int                               `json:"status_codes"`
	Errors                []string                                     `json:"errors"`
	FirstRequestTimestamp *string                                      `json:"first_request_timestamp"`
	LastRequestTimestamp  *string                                      `json:"last_request_timestamp"`
	LastResponseTimestamp *string                                      `json:"last_response_timestamp"`
	FinalWaitTime         *float64                                     `json:"final_wait_time"`
	DeepRawOutput         *string                                      `json:"deep_raw_output"`
	DeepMetrics           map[ResponseCategory]LoadTestDeepOutputDatum `json:"deep_metrics"`
	DeepRPCErrorPairs     []ErrorPair                                  `json:"deep_rpc_error_pairs"`
}

type MultiLoadTestGenerator

type MultiLoadTestGenerator func(...interface{}) map[string]LoadTest

type MultiVegetaArgs

type MultiVegetaArgs []VegetaArgs

type Node

type Node struct {
	Name          string      `json:"name"`
	URL           string      `json:"url"`
	Remote        string      `json:"remote"`
	ClientVersion string      `json:"client_version"`
	Network       interface{} `json:"network"` // Can be string, int, or nil
}

type Nodes

type Nodes map[string]Node

type RandomSeed

type RandomSeed int64

type RawLoadTestOutputDatum

type RawLoadTestOutputDatum struct {
	Latencies             map[string]float64 `json:"latencies"`
	BytesIn               map[string]float64 `json:"bytes_in"`
	BytesOut              map[string]float64 `json:"bytes_out"`
	Earliest              string             `json:"earliest"`
	Latest                string             `json:"latest"`
	End                   string             `json:"end"`
	Duration              int                `json:"duration"`
	Wait                  int                `json:"wait"`
	Requests              int                `json:"requests"`
	Rate                  float64            `json:"rate"`
	Throughput            float64            `json:"throughput"`
	Success               float64            `json:"success"`
	StatusCodes           map[string]int     `json:"status_codes"`
	Errors                []string           `json:"errors"`
	FirstRequestTimestamp string             `json:"first_request_timestamp"`
	LastRequestTimestamp  string             `json:"last_request_timestamp"`
	LastResponseTimestamp string             `json:"last_response_timestamp"`
	FinalWaitTime         int                `json:"final_wait_time"`
}

type ResponseCategory

type ResponseCategory string
const (
	AllResponses        ResponseCategory = "all"
	SuccessfulResponses ResponseCategory = "successful"
	FailedResponses     ResponseCategory = "failed"
)

type RunType

type RunType string
const (
	SingleTest RunType = "single_test"
)

type SenderAccount

type SenderAccount struct {
	MnemonicIndex int
	Nonce         uint64
	Wallet        *accounts.Account
	Address       common.Address
	PrivateKey    *ecdsa.PrivateKey
}

func NewSenderAccount

func NewSenderAccount(mnemonicIndex int, nonce uint64, wallet *accounts.Account, privateKey *ecdsa.PrivateKey) (*SenderAccount, error)

func (*SenderAccount) GetAddress

func (sa *SenderAccount) GetAddress() common.Address

func (*SenderAccount) GetNonce

func (sa *SenderAccount) GetNonce() uint64

func (*SenderAccount) IncrNonce

func (sa *SenderAccount) IncrNonce()

type SingleRunResultsPayload

type SingleRunResultsPayload struct {
	DependencyVersions map[string]*string        `json:"dependency_versions"`
	CLIArgs            []string                  `json:"cli_args"`
	Type               RunType                   `json:"type"`
	TRunStart          int64                     `json:"t_run_start"`
	TRunEnd            int64                     `json:"t_run_end"`
	Nodes              Nodes                     `json:"nodes"`
	Results            map[string]LoadTestOutput `json:"results"`
}

type SingleRunTestPayload

type SingleRunTestPayload struct {
	Type           RunType                  `json:"type"`
	Name           string                   `json:"name"`
	TestParameters TestGenerationParameters `json:"test_parameters"`
}

type TestGenerationParameters

type TestGenerationParameters struct {
	TestName   string              `json:"test_name"`
	RandomSeed RandomSeed          `json:"random_seed"`
	Rates      []int               `json:"rates"`
	Durations  []int               `json:"durations"`
	VegetaArgs VegetaArgsShorthand `json:"vegeta_args"`
	Network    string              `json:"network"`
}

type TxBuilder

type TxBuilder interface {
	// Estimates the base runtime transaction gas limit
	EstimateGasForBaseTx() (*big.Int, error)

	// Returns the value of each cycle transaction, if any
	GetValue() *big.Int

	// Constructs the specific runtime transactions
	ConstructTransactions(accounts []*SenderAccount, numTxs int) ([]*types.Transaction, error)

	// Initializes the runtime
	Initialize() error
}

type TxType

type TxType string
const (
	EOA    TxType = "EOA"
	ERC20  TxType = "ERC20"
	ERC721 TxType = "ERC721"
)

type VegetaArgs

type VegetaArgs interface{} // Can be string or nil

type VegetaArgsShorthand

type VegetaArgsShorthand interface{} // Can be VegetaArgs or MultiVegetaArgs

type VegetaAttack

type VegetaAttack struct {
	Rate       int               `json:"rate"`
	Duration   int               `json:"duration"`
	Calls      []*JsonrpcMessage `json:"calls"`
	VegetaArgs *string           `json:"vegeta_args"` // Can be string or nil
}

func CreateLoadTest

func CreateLoadTest(calls []*JsonrpcMessage, rates []int, durations []int, vegetaArgs interface{}, repeatCalls bool) ([]VegetaAttack, error)

CreateLoadTest creates a load test configuration

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL