testtoxiproxy

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package testtoxiproxy provides a small Toxiproxy HTTP client for integration tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client communicates with a Toxiproxy HTTP API.

func New

func New(endpoint string) *Client

New returns a Toxiproxy client for endpoint.

func (*Client) AddTimeout

func (client *Client) AddTimeout(ctx context.Context, proxy, name string) error

AddTimeout drops downstream traffic until the named toxic is removed.

func (*Client) CreateProxy

func (client *Client) CreateProxy(ctx context.Context, name, listen, upstream string) (*Proxy, error)

CreateProxy creates an enabled proxy that listens locally and forwards upstream.

func (*Client) DeleteProxy

func (client *Client) DeleteProxy(ctx context.Context, name string) error

DeleteProxy removes a proxy.

func (*Client) RemoveToxic

func (client *Client) RemoveToxic(ctx context.Context, proxy, name string) error

RemoveToxic deletes a toxic from a proxy.

func (*Client) SetEnabled

func (client *Client) SetEnabled(ctx context.Context, name string, enabled bool) error

SetEnabled enables or disables a proxy.

func (*Client) Wait

func (client *Client) Wait(ctx context.Context) error

Wait polls Toxiproxy until its version endpoint accepts a request or ctx expires.

type Proxy

type Proxy struct {
	Name string
	// contains filtered or unexported fields
}

Proxy identifies a proxy created by Client.

Jump to

Keyboard shortcuts

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