loadtest

package
v0.0.0-...-bd70b13 Latest Latest
Warning

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

Go to latest
Published: May 2, 2019 License: Apache-2.0 Imports: 31 Imported by: 0

README

Tendermint Load Testing Framework

By default, tm-load-test is built using a client that makes use of the native Tendermint RPC client to interact with a Tendermint network running the kvstore application.

If, however, you want to customize the load testing client for your own ABCI application, you can do so by implementing the loadtest.ClientFactory and loadtest.Client interfaces. An example of this is the provided Tendermint RPC-based client factory and client here.

Interactions

At a high level, a client executes interactions, where a single interaction is made up of a series of requests. For the provided kvstore application, the two requests that make up an interaction are:

  1. Put a value into the kvstore by way of a broadcast_tx_sync request. This request is directed at a random Tendermint node in the network.
  2. Retrieve the value from the kvstore for the original key and make sure that the retrieved value is the same as the stored value. This request is also directed at a (potentially different) random node in the Tendermint network.

You can implement your own complex scenarios for your own application within an "interaction".

Custom Client Project Setup

To create your own load testing tool for your environment, you will need to create your own equivalent of the tm-load-test command, but register your client during startup for use from the configuration file.

// my-tm-load-test.go
package main

import (
    "github.com/tendermint/networks/pkg/loadtest"
)

func init() {
    // Register your custom client factory here
    loadtest.RegisterClientFactory("myclient", &MyCustomClientFactory{})
}

func main() {
    // This will parse command line flags, configuration, etc. and actually
    // execute the load testing framework in either master or slave mode,
    // depending on the command line parameters supplied.
    loadtest.Run()
}

Building and Running Your Load Test Application

Then, produce your own executable for your load testing application:

go build -o build/my-tm-load-test ./path/to/my-tm-load-test.go

It can then be executed with the same parameters and configuration file as the standard tm-load-test application.

Documentation

Index

Constants

View Source
const DefaultHealthCheckInterval = 10 * time.Second

DefaultHealthCheckInterval is the interval at which slave nodes are expected to send a `LoadTestUnderway` message after starting their load testing.

View Source
const DefaultHistogramBinCount int64 = 100

DefaultHistogramBinCount indicates the maximum number of bins in a histogram. A value of 100 will give us percentiles.

View Source
const DefaultMaxMissedHealthCheckPeriod = ((DefaultMaxMissedHealthChecks + 1) * DefaultHealthCheckInterval)

DefaultMaxMissedHealthCheckPeriod is the time after which a slave is considered to have failed if we don't hear from it during that period.

View Source
const DefaultMaxMissedHealthChecks = 2

DefaultMaxMissedHealthChecks is the number of health checks that a slave can miss before being considered as "failed" (i.e. one more missed health check than `DefaultMaxMissedHealthChecks` will result in total load testing failure).

View Source
const SingleTestSummaryPlot = `` /* 8111-byte string literal not displayed */

SingleTestSummaryPlot is an HTML page template that facilitates plotting the summary results (using plotly.js) of a single load test.

Variables

This section is empty.

Functions

func AddStatistic

func AddStatistic(stats *messages.SummaryStats, timeTaken time.Duration, err error)

AddStatistic adds a single statistic to the given SummaryStats object.

func ErrorMessageForCode

func ErrorMessageForCode(code ErrorCode, additionalInfo ...string) string

ErrorMessageForCode translates the given error code into a human-readable, English message.

func FlattenResponseTimeHistogram

func FlattenResponseTimeHistogram(h *messages.ResponseTimeHistogram, indent string) (string, string)

FlattenResponseTimeHistogram will take the given histogram object and convert it into two flattened arrays, where the first returned array will be the bins and the second will be the counts.

func GetSupportedClientFactoryIDs

func GetSupportedClientFactoryIDs() []string

GetSupportedClientFactoryIDs returns a list of supported client factory IDs.

func IsErrorCode

func IsErrorCode(err error, code ErrorCode) bool

IsErrorCode is a convenience function that attempts to cast the given error to an Error struct and checks its error code against the given code.

func LogStats

func LogStats(logger logging.Logger, stats *messages.CombinedStats)

LogStats is a utility function to log the given statistics for easy reading, especially from the command line.

func LogSummaryStats

func LogSummaryStats(logger logging.Logger, logPrefix string, stats *messages.SummaryStats, totalTestTime int64)

LogSummaryStats is a utility function for displaying summary statistics through the logging interface. This is useful when working with tm-load-test from the command line.

func MakeTxKV

func MakeTxKV() ([]byte, []byte, []byte)

MakeTxKV returns a text transaction, along with expected key, value pair

func MergeCombinedStats

func MergeCombinedStats(dest, src *messages.CombinedStats)

MergeCombinedStats will merge the given src CombinedStats object's contents into the dest object.

func MergeSummaryStats

func MergeSummaryStats(dest, src *messages.SummaryStats)

MergeSummaryStats will merge the given source stats into the destination stats, modifying the destination stats object.

func NewMaster

func NewMaster(cfg *Config, probe Probe) (*actor.PID, *actor.RootContext, error)

NewMaster will instantiate a new master node. On success, returns an actor PID with which one can interact with the master node. On failure, returns an error.

func NewResponseTimeHistogram

func NewResponseTimeHistogram(timeout time.Duration) *messages.ResponseTimeHistogram

NewResponseTimeHistogram instantiates an empty response time histogram with the given timeout as an upper bound on the size of the histogram.

func NewSlave

func NewSlave(cfg *Config, probe Probe) (*actor.PID, *actor.RootContext, error)

NewSlave will instantiate a new slave node with the given configuration.

func NewSummaryStats

func NewSummaryStats(timeout time.Duration, totalClients int64) *messages.SummaryStats

NewSummaryStats instantiates an empty, configured SummaryStats object.

func ParseSummaryStats

func ParseSummaryStats(rows [][]string) (*messages.SummaryStats, int, int64, error)

ParseSummaryStats will attempt to read a `*messages.SummaryStats` object from the given set of rows/columns (assuming they're from a CSV file), and on success will return that object and the number of lines read from the CSV reader. Otherwise an error will be returned.

NOTE: Only a single `*messages.SummaryStats` object will be parsed from the given set of rows. The moment one full object has been parsed, the function will return.

func PlotSingleTestSummaryResults

func PlotSingleTestSummaryResults(inputDir, outputDir string) error

PlotSingleTestSummaryResults will look in the given `inputDir` for a `summary.csv` file (generated by the single-test load testing) and write the relevant plotly.js files out to the given `outputDir` (one for each histogram, basically).

func RandomSleep

func RandomSleep(minSleep, maxSleep time.Duration)

RandomSleep will sleep for a random period of between the given minimum and maximum times.

func ReadCombinedStats

func ReadCombinedStats(r io.Reader) (*messages.CombinedStats, error)

ReadCombinedStats will attempt to read a CombinedStats object from the given reader, assuming it's in CSV format, or return an error.

func ReadCombinedStatsFromFile

func ReadCombinedStatsFromFile(csvFile string) (*messages.CombinedStats, error)

ReadCombinedStatsFromFile will read the combined stats from the given CSV file on success, or return an error.

func RegisterClientFactory

func RegisterClientFactory(id string, factory ClientFactory)

RegisterClientFactory allows us to register a particular kind of client factory with a unique ID to make it available to the load testing infrastructure via the configuration file.

func RenderSingleTestSummaryPlot

func RenderSingleTestSummaryPlot(cfg *Config, stats *messages.CombinedStats, nodesData map[string]map[string]MetricFamilyData) (string, error)

RenderSingleTestSummaryPlot is a convenience method to render the single test summary plot to a string, ready to be written to an output file.

func Run

func Run()

Run must be executed from your `main` function in your Go code. This can be used to fast-track the construction of your own load testing tool for your Tendermint ABCI application.

func RunMaster

func RunMaster(configFile string) error

RunMaster will build and execute a master node for load testing and will block until the testing is complete or fails.

func RunMasterWithConfig

func RunMasterWithConfig(cfg *Config) error

RunMasterWithConfig runs a master node with the given configuration and blocks until the testing is complete or it fails.

func RunSlave

func RunSlave(configFile string) error

RunSlave will build and execute a slave node for load testing and will block until the testing is complete or fails.

func RunSlaveWithConfig

func RunSlaveWithConfig(cfg *Config) error

RunSlaveWithConfig runs a slave node with the given configuration and blocks until the testing is complete or it fails.

func SummarizeCombinedStats

func SummarizeCombinedStats(stats *messages.CombinedStats) *messages.CombinedStats

SummarizeCombinedStats will summarize the error reporting such that only a maximum of 10 kinds of errors are returned. This is to help avoid hitting the GRPC message size limits when sending data back to the master. It creates a new `CombinedStats` object without modifying the original one.

func SummarizeSummaryStats

func SummarizeSummaryStats(stats *messages.SummaryStats) *messages.SummaryStats

func WriteCombinedStats

func WriteCombinedStats(writer io.Writer, stats *messages.CombinedStats) error

WriteCombinedStats will write the given combined statistics using the specified writer.

func WriteCombinedStatsToFile

func WriteCombinedStatsToFile(outputFile string, stats *messages.CombinedStats) error

WriteCombinedStatsToFile will write the given stats object to the specified output CSV file. If the given output path does not exist, it will be created.

func WriteSummaryStats

func WriteSummaryStats(writer *csv.Writer, indentCount int, linePrefix string, stats *messages.SummaryStats, totalTestTime int64) error

WriteSummaryStats will write the given summary statistics using the specified CSV writer.

Types

type CalculatedStats

type CalculatedStats struct {
	AvgTotalClientTime float64           // Average total time that we were waiting for a single client's interactions/requests to complete.
	CountPerClient     float64           // Number of interactions/requests per client.
	AvgTimePerClient   float64           // Average time per interaction/request per client.
	PerSecPerClient    float64           // Interactions/requests per second per client.
	PerSec             float64           // Interactions/requests per second overall.
	AbsPerSec          float64           // Interactions/requests per second overall, including wait times.
	FailureRate        float64           // The % of interactions/requests that failed.
	TopErrors          []*FlattenedError // The top 10 errors by error count.
}

CalculatedStats includes a number of parameters that can be calculated from a `messages.SummaryStats` object.

func CalculateStats

func CalculateStats(stats *messages.SummaryStats, totalTestTime int64) *CalculatedStats

type Client

type Client interface {
	// Interact is intended to perform the relevant requests that make up an
	// interaction with a Tendermint node.
	Interact()

	// GetStats must return the combined statistics for all interactions and
	// requests for this client.
	GetStats() *messages.CombinedStats
}

Client instances are responsible for performing interactions with Tendermint nodes.

type ClientConfig

type ClientConfig struct {
	Type               string            `toml:"type"`                // The type of client to spawn.
	Spawn              int               `toml:"spawn"`               // The number of clients to spawn, per slave.
	SpawnRate          float64           `toml:"spawn_rate"`          // The rate at which to spawn clients, per second, on each slave.
	MaxInteractions    int               `toml:"max_interactions"`    // The maximum number of interactions emanating from each client.
	MaxTestTime        ParseableDuration `toml:"max_test_time"`       // The maximum duration of the test, beyond which this client must be stopped.
	RequestWaitMin     ParseableDuration `toml:"request_wait_min"`    // The minimum wait period before each request before sending another one.
	RequestWaitMax     ParseableDuration `toml:"request_wait_max"`    // The maximum wait period before each request before sending another one.
	RequestTimeout     ParseableDuration `toml:"request_timeout"`     // The maximum time allowed before considering a request to have timed out.
	InteractionTimeout ParseableDuration `toml:"interaction_timeout"` // The maximum time allowed for an overall interaction.
}

ClientConfig contains the configuration for clients being spawned on slaves.

func (*ClientConfig) Validate

func (c *ClientConfig) Validate() error

type ClientFactory

type ClientFactory interface {
	// NewStats must create and initialize an empty CombinedStats object for
	// this kind of client.
	NewStats(params ClientParams) *messages.CombinedStats

	NewClient(params ClientParams) Client
}

ClientFactory produces clients.

func GetClientFactory

func GetClientFactory(id string) ClientFactory

GetClientFactory will attempt to look up the client factory with the given ID. If it exists, it will be returned. If not, nil will be returned.

type ClientParams

type ClientParams struct {
	TargetNodes        []string      // The addresses of the target nodes for this client.
	InteractionTimeout time.Duration // The maximum time to allow for an interaction.
	RequestWaitMin     time.Duration // The minimum time to wait prior to executing a request.
	RequestWaitMax     time.Duration // The maximum time to wait prior to executing a request.
	RequestTimeout     time.Duration // The maximum time to allow for a request.
	TotalClients       int64         // The total number of clients for which to initialize the load testing.
}

ClientParams allows us to encapsulate the parameters for instantiating a load testing client.

type Config

type Config struct {
	Master      MasterConfig      `toml:"master"`       // The master's load testing configuration.
	Slave       SlaveConfig       `toml:"slave"`        // The slaves' load testing configuration.
	TestNetwork TestNetworkConfig `toml:"test_network"` // The test network layout/configuration.
	Clients     ClientConfig      `toml:"clients"`      // Load testing client-related configuration.
}

Config is the central configuration structure for our load testing, from both the master and slaves' perspectives.

func LoadConfig

func LoadConfig(filename string) (*Config, error)

LoadConfig will attempt to load configuration from the given file.

func ParseConfig

func ParseConfig(data string) (*Config, error)

ParseConfig will parse the configuration from the given string.

func (*Config) Validate

func (c *Config) Validate() error

Validate does a deep check on the configuration to make sure it makes sense.

type Error

type Error struct {
	Code     ErrorCode
	Message  string
	Upstream error
}

Error is a way of wrapping the meaningful exit code we want to provide on failure.

func NewError

func NewError(code ErrorCode, upstream error, additionalInfo ...string) *Error

NewError allows us to create new Error structures from the given code and upstream error (can be nil).

func (Error) Error

func (e Error) Error() string

Error implements error.

type ErrorCode

type ErrorCode int

ErrorCode allows us to encapsulate specific failure codes for the node processes.

const (
	NoError ErrorCode = iota
	ErrFailedToDecodeConfig
	ErrFailedToReadConfigFile
	ErrInvalidConfig
	ErrFailedToCreateActor
	ErrTimedOutWaitingForSlaves
	ErrSlaveFailed
	ErrMasterFailed
	ErrKilled
	ErrStatsSanityCheckFailed
)

Error/exit codes for load testing-related errors.

type FlattenedError

type FlattenedError struct {
	ErrorType string
	Count     int64
}

FlattenedError is the key/value pair from `messages.SummaryStats.ErrorsByType` flattened into a structure for easy sorting.

func FlattenedSortedErrors

func FlattenedSortedErrors(stats *messages.SummaryStats) []*FlattenedError

type Master

type Master struct {
	// contains filtered or unexported fields
}

Master is an actor that coordinates and collects information from the slaves, which are responsible for the actual load testing.

func (*Master) Receive

func (m *Master) Receive(ctx actor.Context)

Receive handles incoming messages to the master node.

type MasterConfig

type MasterConfig struct {
	Bind               string            `toml:"bind"`                 // The address to which to bind the master (host:port).
	ExpectSlaves       int               `toml:"expect_slaves"`        // The number of slaves to expect to connect before starting the load test.
	ExpectSlavesWithin ParseableDuration `toml:"expect_slaves_within"` // The time period within which to expect to hear from all slaves, otherwise causes a failure.
	ResultsDir         string            `toml:"results_dir"`          // The root of the results output directory.
}

MasterConfig provides the configuration for the load testing master.

func (*MasterConfig) Validate

func (m *MasterConfig) Validate() error

type MetricFamilyData

type MetricFamilyData struct {
	ID         string
	Help       string
	Timestamps []float64
	Data       []float64
}

MetricFamilyData is read from a node's Prometheus statistics CSV file. It represents the data of a single metric family.

type NodePrometheusStats

type NodePrometheusStats map[string]map[int64]float64

NodePrometheusStats represents a single test network node's stats from its Prometheus endpoint. The mapping goes "Metric family ID -> Seconds since test start -> Data point"

func GetNodePrometheusStats

func GetNodePrometheusStats(c *http.Client, endpoint *PrometheusEndpoint, ts int64) (NodePrometheusStats, map[string]string, error)

GetNodePrometheusStats will perform a blocking GET request to the given URL to fetch the text-formatted Prometheus metrics for a particular node, parse those metrics, and then either return the parsed metrics or an error.

func (NodePrometheusStats) ExtractTimestamps

func (s NodePrometheusStats) ExtractTimestamps() []int64

ExtractTimestamps will extract the timestamps from the given NodePrometheusStats map.

func (NodePrometheusStats) Merge

Merge will incorporate the given `src` object's metric families' stats into this one.

type NoopClient

type NoopClient struct {
	// contains filtered or unexported fields
}

NoopClient is a client that does nothing.

func NewNoopClient

func NewNoopClient(factory *NoopClientFactory) *NoopClient

func (*NoopClient) GetStats

func (c *NoopClient) GetStats() *messages.CombinedStats

GetStats returns an empty set of statistics.

func (*NoopClient) Interact

func (c *NoopClient) Interact()

Interact does nothing.

type NoopClientFactory

type NoopClientFactory struct{}

NoopClientFactory builds noop clients (that do nothing).

func (*NoopClientFactory) NewClient

func (f *NoopClientFactory) NewClient(params ClientParams) Client

func (*NoopClientFactory) NewStats

type NoopProbe

type NoopProbe struct{}

func (*NoopProbe) OnShutdown

func (p *NoopProbe) OnShutdown(ctx actor.Context, err error)

func (*NoopProbe) OnStartup

func (p *NoopProbe) OnStartup(ctx actor.Context)

func (*NoopProbe) OnStopped

func (p *NoopProbe) OnStopped(ctx actor.Context)

type ParseableDuration

type ParseableDuration time.Duration

ParseableDuration represents a time.Duration that implements encoding.TextUnmarshaler.

func (*ParseableDuration) UnmarshalText

func (d *ParseableDuration) UnmarshalText(text []byte) error

UnmarshalText allows us a convenient way to unmarshal durations.

type Probe

type Probe interface {
	OnStartup(ctx actor.Context)
	OnShutdown(ctx actor.Context, err error)
	OnStopped(ctx actor.Context)
}

Probe allows us to hook into the actors facilitating the load testing to obtain insight into what's going on inside of them.

type PrometheusEndpoint

type PrometheusEndpoint struct {
	ID  string
	URL string
}

PrometheusEndpoint is what we parse from the `prometheus_urls` parameter in the target network config for each node.

type PrometheusStats

type PrometheusStats struct {
	StartTime                time.Time                      // When was the load test started?
	MetricFamilyDescriptions map[string]string              // Mapping of metric family ID -> description
	TargetNodesStats         map[string]NodePrometheusStats // Target node stats organized by hostname.
	// contains filtered or unexported fields
}

PrometheusStats encapsulates all of the statistics we retrieved from the Prometheus endpoints for our target nodes.

func NewPrometheusStats

func NewPrometheusStats(logger logging.Logger) *PrometheusStats

NewPrometheusStats creates a new, ready-to-use PrometheusStats object.

func (*PrometheusStats) Dump

func (ps *PrometheusStats) Dump(outputPath string) error

Dump will write each node's stats to a separate file, named according to the host ID, in the given output directory.

func (*PrometheusStats) Merge

func (ps *PrometheusStats) Merge(s nodePrometheusStats)

Merge will take the given `nodePrometheusStats` object and merge its contents with what `ps` currently has.

func (*PrometheusStats) RunCollectors

func (ps *PrometheusStats) RunCollectors(cfg *Config, shutdownc, donec chan bool, logger logging.Logger)

RunCollectors will kick off one goroutine per Tendermint node from which we're collecting Prometheus stats.

type RPCClient

type RPCClient struct {
	// contains filtered or unexported fields
}

RPCClient is a load testing client that interacts with multiple different Tendermint nodes in a Tendermint network.

func NewRPCClient

func NewRPCClient(factory *RPCClientFactory, targetURLs []string, interactionTimeout, requestWaitMin, requestWaitMax, requestTimeout time.Duration) *RPCClient

NewRPCClient instantiates a Tendermint RPC-based load testing client.

func (*RPCClient) GetStats

func (c *RPCClient) GetStats() *messages.CombinedStats

GetStats returns the aggregated interaction and request statistics for all of this client's interactions with the Tendermint nodes.

func (*RPCClient) Interact

func (c *RPCClient) Interact()

Interact will attempt to put a value into a Tendermint node, and then, after a small delay, attempt to retrieve it.

type RPCClientFactory

type RPCClientFactory struct{}

RPCClientFactory allows us to build RPC clients.

func (*RPCClientFactory) NewClient

func (f *RPCClientFactory) NewClient(params ClientParams) Client

NewClient instantiates a new client for interaction with a Tendermint network.

func (*RPCClientFactory) NewStats

func (f *RPCClientFactory) NewStats(params ClientParams) *messages.CombinedStats

NewStats initializes an empty CombinedStats object for this RPC client.

type SingleTestNodeChart

type SingleTestNodeChart struct {
	ID        template.JS
	Title     template.JS
	Hostnames template.JS
	NodesData template.JS
}

SingleTestNodeChart encapsulates parameters for a specific metric family.

type SingleTestSummaryContext

type SingleTestSummaryContext struct {
	// Summary parameters
	ClientType            template.HTML
	SlaveNodeCount        template.HTML
	ClientSpawn           template.HTML
	ClientSpawnRate       template.HTML
	ClientRequestWaitMin  template.HTML
	ClientRequestWaitMax  template.HTML
	ClientRequestTimeout  template.HTML
	ClientMaxInteractions template.HTML
	TotalTestTime         template.HTML

	// Interaction-related parameters
	InteractionsTotalClients template.HTML
	InteractionsPerSec       template.HTML
	InteractionsCount        template.HTML
	InteractionsErrors       template.HTML
	InteractionsErrorRate    template.HTML
	InteractionsMinTime      template.HTML
	InteractionsMaxTime      template.HTML

	// For the interaction response times histogram
	InteractionsResponseTimesBins   template.JS
	InteractionsResponseTimesCounts template.JS

	// Top errors encountered by interactions
	ErrorCounts []SingleTestSummaryErrorCount

	// Request-related parameters
	Requests []SingleTestSummaryRequestParams

	// Node-related chart parameters
	NodeCharts []SingleTestNodeChart
}

SingleTestSummaryContext represents context for being able to render a single load test's summary plot.

func NewSingleTestSummaryContext

func NewSingleTestSummaryContext(cfg *Config, stats *messages.CombinedStats, nodesData map[string]map[string]MetricFamilyData) SingleTestSummaryContext

NewSingleTestSummaryContext creates the relevant context to be able to render the single load test plot.

type SingleTestSummaryErrorCount

type SingleTestSummaryErrorCount struct {
	Description template.HTML
	Count       template.HTML
}

SingleTestSummaryErrorCount helps us represent one of the top errors encountered by an interaction or request.

type SingleTestSummaryRequestParams

type SingleTestSummaryRequestParams struct {
	Name      template.HTML
	PerSec    template.HTML
	Count     template.HTML
	Errors    template.HTML
	ErrorRate template.HTML
	MinTime   template.HTML
	MaxTime   template.HTML

	// For the request response times histogram
	ResponseTimesBins   template.JS
	ResponseTimesCounts template.JS

	// Error counts
	ErrorCounts []SingleTestSummaryErrorCount
}

SingleTestSummaryRequestParams encapsulates parameters for a single request type in the above plot.

type Slave

type Slave struct {
	// contains filtered or unexported fields
}

Slave is an actor that facilitates load testing. It initially needs to connect to a master node to register itself, and then when the master node gives the signal it will kick off the load testing.

func (*Slave) Receive

func (s *Slave) Receive(ctx actor.Context)

Receive handles incoming messages to the slave node.

type SlaveConfig

type SlaveConfig struct {
	Bind           string            `toml:"bind"`            // The address to which to bind slave nodes (host:port).
	Master         string            `toml:"master"`          // The master's external address (host:port).
	UpdateInterval ParseableDuration `toml:"update_interval"` // The interval with which to send stats updates to the master.
}

SlaveConfig provides configuration specific to the load testing slaves.

func (*SlaveConfig) Validate

func (s *SlaveConfig) Validate() error

type StandardProbe

type StandardProbe struct {
	// contains filtered or unexported fields
}

func NewStandardProbe

func NewStandardProbe() *StandardProbe

func (*StandardProbe) OnShutdown

func (p *StandardProbe) OnShutdown(ctx actor.Context, err error)

func (*StandardProbe) OnStartup

func (p *StandardProbe) OnStartup(ctx actor.Context)

func (*StandardProbe) OnStopped

func (p *StandardProbe) OnStopped(ctx actor.Context)

func (*StandardProbe) Wait

func (p *StandardProbe) Wait() error

type TestNetworkConfig

type TestNetworkConfig struct {
	EnablePrometheus       bool              `toml:"enable_prometheus"`        // Should we enable collections of Prometheus stats during testing?
	PrometheusPollInterval ParseableDuration `toml:"prometheus_poll_interval"` // How often should we poll the Prometheus endpoint?
	PrometheusPollTimeout  ParseableDuration `toml:"prometheus_poll_timeout"`  // At what point do we consider a Prometheus polling operation a failure?

	Targets []TestNetworkTargetConfig `toml:"targets"` // Configuration for each of the Tendermint nodes in the network.
}

TestNetworkConfig encapsulates information about the network under test.

func (*TestNetworkConfig) GetTargetRPCURLs

func (c *TestNetworkConfig) GetTargetRPCURLs() []string

GetTargetRPCURLs will return a simple, flattened list of URLs for all of the target nodes' RPC addresses.

func (*TestNetworkConfig) Validate

func (c *TestNetworkConfig) Validate() error

type TestNetworkTargetConfig

type TestNetworkTargetConfig struct {
	ID             string `toml:"id"`                        // A short, descriptive identifier for this node.
	URL            string `toml:"url"`                       // The RPC URL for this target node.
	PrometheusURLs string `toml:"prometheus_urls,omitempty"` // The URL(s) (comma-separated) to poll for this target node, if Prometheus polling is enabled.

	Outages string `toml:"outages,omitempty"` // Specify an outage schedule to try to affect for this host.
}

TestNetworkTargetConfig encapsulates the configuration for each node in the Tendermint test network.

func (TestNetworkTargetConfig) GetPrometheusEndpoints

func (c TestNetworkTargetConfig) GetPrometheusEndpoints() []*PrometheusEndpoint

GetPrometheusEndpoints will extract the endpoint info for all of the validly specified Prometheus endpoints. The right format for `prometheus_urls` parameter resembles the following: id1=http://server1,id2=http://server2

func (*TestNetworkTargetConfig) Validate

func (c *TestNetworkTargetConfig) Validate(i int) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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