Documentation ¶
Index ¶
- Constants
- type CertificateDecodeError
- type CertificateReadError
- type Client
- func (c *Client) AddWorker(adress string, port int, secret string, cert *tls.Certificate, ...) error
- func (c *Client) Connect(ctx context.Context, logger *zerolog.Logger) error
- func (c *Client) Disconnect() error
- func (c *Client) Ping(ctx context.Context, logger *zerolog.Logger) error
- func (c *Client) Run(ctx context.Context, logger *zerolog.Logger, ...) (chan Result, error)
- type ConnectError
- type DisconnectError
- type InvalidConnectionError
- type Result
- type Worker
- type WrappableError
Constants ¶
const AuthSchemeBasic = "basic"
AuthSchemeBasic is used as the authentication method description.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CertificateDecodeError ¶
type CertificateDecodeError struct{}
func (*CertificateDecodeError) Error ¶
func (e *CertificateDecodeError) Error() string
type CertificateReadError ¶
type CertificateReadError struct {
Err error
}
func (*CertificateReadError) Error ¶
func (e *CertificateReadError) Error() string
func (*CertificateReadError) Unwrap ¶
func (e *CertificateReadError) Unwrap() error
type Client ¶
type Client struct { Workers []*Worker // contains filtered or unexported fields }
Client is a instructor client.
func (*Client) AddWorker ¶
func (c *Client) AddWorker( adress string, port int, secret string, cert *tls.Certificate, dialer func(context.Context, string) (net.Conn, error)) error
AddWorker adds a new worker to the client. A worker is defined by it's connection attributes, which are it's ip address, port, a token secret, a TLS certificate, and an optional dialer function, which mainly serves for testing purposes.
func (*Client) Connect ¶
Connect opens a connection to every worker added to this client. It closes existing connections first, then creates a new one.
func (*Client) Disconnect ¶
Disconnect closes connections to all workers belonging to this client.
func (*Client) Run ¶
func (c *Client) Run( ctx context.Context, logger *zerolog.Logger, endpoints []*config.InstructorEndpoint, amount, minWaitTime, maxWaitTime int) (chan Result, error)
Run requests every worker to perform a loadtest. It returns an error on failure to initialize the requests, otherwise it returns a channel in which the results will be written, but returns immediately.
logger will be used to log messages mid-process, endpoints are the endpoints which workers will target to, amount specifies the amount of users each worker simulates, minWaitTime and maxWaitTime specify the time to wait between requests in milliseconds.
To cancel requesting the workers, ctx has to be canceled.
type ConnectError ¶
type ConnectError struct {
Err error
}
func (*ConnectError) Error ¶
func (e *ConnectError) Error() string
func (*ConnectError) Unwrap ¶
func (e *ConnectError) Unwrap() error
type DisconnectError ¶
type DisconnectError struct {
Err error
}
func (*DisconnectError) Error ¶
func (e *DisconnectError) Error() string
func (*DisconnectError) Unwrap ¶
func (e *DisconnectError) Unwrap() error
type InvalidConnectionError ¶
type InvalidConnectionError struct {
Err error
}
func (*InvalidConnectionError) Error ¶
func (e *InvalidConnectionError) Error() string
func (*InvalidConnectionError) Unwrap ¶
func (e *InvalidConnectionError) Unwrap() error
type Worker ¶
type Worker struct { Adress string Port int Certificate *tls.Certificate Secret string // contains filtered or unexported fields }
Worker represents the configuration and connection of a Worker.