assert

package
v0.0.0-...-a706f41 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: MPL-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertContainerState

func AssertContainerState(t *testing.T, service libservice.Service, state string)

AssertContainerState validates service container status

func AssertEnvoyHTTPrbacFilters

func AssertEnvoyHTTPrbacFilters(t *testing.T, port int)

GetEnvoyHTTPrbacFilters validates that proxy was configured with an http connection manager AssertEnvoyHTTPrbacFilters validates that proxy was configured with an http connection manager this assertion is currently unused current tests use http protocol

func AssertEnvoyMetricAtLeast

func AssertEnvoyMetricAtLeast(t *testing.T, adminPort int, prefix, metric string, count int)

AssertEnvoyMetricAtLeast assert the filered metric by prefix and metric is <= count

func AssertEnvoyMetricAtMost

func AssertEnvoyMetricAtMost(t *testing.T, adminPort int, prefix, metric string, count int)

AssertEnvoyMetricAtMost assert the filered metric by prefix and metric is >= count

func AssertEnvoyPresentsCertURI

func AssertEnvoyPresentsCertURI(t *testing.T, port int, serviceName string)

AssertEnvoyPresentsCertURI makes GET request to /certs endpoint and validates that two certificates URI is available in the response

func AssertEnvoyRunning

func AssertEnvoyRunning(t *testing.T, port int)

AssertEnvoyRunning assert the envoy is running by querying its stats page

func AssertFortioName

func AssertFortioName(t *testing.T, urlbase string, name string, reqHost string)

AssertFortioName is a convenience function for AssertFortioNameWithClient, using a [cleanhttp.DefaultClient()]

func AssertFortioNameWithClient

func AssertFortioNameWithClient(t *testing.T, urlbase string, name string, reqHost string, client *http.Client)

AssertFortioNameWithClient asserts that the fortio service replying at urlbase/debug has a `FORTIO_NAME` env variable set. This validates that the client is sending traffic to the right envoy proxy.

If reqHost is set, the Host field of the HTTP request will be set to its value.

It retries with timeout defaultHTTPTimeout and wait defaultHTTPWait.

client must be a custom http.Client

func AssertServiceHasHealthyInstances

func AssertServiceHasHealthyInstances(t *testing.T, node libcluster.Agent, service string, onlypassing bool, count int)

AssertServiceHasHealthyInstances asserts the number of instances of service equals count for a given service. https://developer.hashicorp.com/consul/docs/connect/config-entries/service-resolver#onlypassing

func AssertUpstreamEndpointStatus

func AssertUpstreamEndpointStatus(t *testing.T, adminPort int, clusterName, healthStatus string, count int)

AssertUpstreamEndpointStatus validates that proxy was configured with provided clusterName in the healthStatus

func AssertUpstreamEndpointStatusWithClient

func AssertUpstreamEndpointStatusWithClient(
	t *testing.T,
	client *http.Client,
	addr string,
	clusterName string,
	healthStatus string,
	count int,
)

func CatalogNodeExists

func CatalogNodeExists(t *testing.T, c *api.Client, nodeName string)

CatalogNodeExists verifies the node name exists in the Consul catalog

func CatalogServiceExists

func CatalogServiceExists(t *testing.T, c *api.Client, svc string, opts *api.QueryOptions)

CatalogServiceExists verifies the service name exists in the Consul catalog

func CatalogServiceHasInstanceCount

func CatalogServiceHasInstanceCount(t *testing.T, c *api.Client, svc string, count int, opts *api.QueryOptions)

CatalogServiceHasInstanceCount verifies the service name exists in the Consul catalog and has the specified number of instances.

func CatalogServiceIsHealthy

func CatalogServiceIsHealthy(t *testing.T, c *api.Client, svc string, opts *api.QueryOptions)

CatalogServiceIsHealthy verifies the service name exists and all instances pass healthchecks

func GRPCPing

func GRPCPing(t *testing.T, addr string)

GRPCPing sends a fgrpc.PingMessage to a fortio server at addr, analogous to the CLI command `fortio grpcping`. It retries for up to 1m, with a 25ms gap.

func GetEnvoyListenerTCPFilters

func GetEnvoyListenerTCPFilters(t *testing.T, adminPort int)

GetEnvoyListenerTCPFilters validates that proxy was configured with tcp protocol and one rbac listener filter

func GetEnvoyListenerTCPFiltersWithClient

func GetEnvoyListenerTCPFiltersWithClient(
	t *testing.T,
	client *http.Client,
	addr string,
)

func GetEnvoyOutput

func GetEnvoyOutput(port int, path string, query map[string]string) (string, int, error)

func GetEnvoyOutputWithClient

func GetEnvoyOutputWithClient(client *http.Client, addr string, path string, query map[string]string) (string, int, error)

func HTTPServiceEchoes

func HTTPServiceEchoes(t *testing.T, ip string, port int, path string)

func HTTPServiceEchoesResHeader

func HTTPServiceEchoesResHeader(t *testing.T, ip string, port int, path string, expectedResHeader map[string]string)

func HTTPServiceEchoesResHeaderWithClient

func HTTPServiceEchoesResHeaderWithClient(t *testing.T, client *http.Client, addr string, path string, expectedResHeader map[string]string)

func HTTPServiceEchoesWithClient

func HTTPServiceEchoesWithClient(t *testing.T, client *http.Client, addr string, path string)

func HTTPServiceEchoesWithHeaders

func HTTPServiceEchoesWithHeaders(t *testing.T, ip string, port int, path string, headers map[string]string)

func PeeringExports

func PeeringExports(t *testing.T, client *api.Client, peerName string, exports int)

PeeringExports verifies the correct number of exported services with a default retry.

func PeeringExportsOpts

func PeeringExportsOpts(t *testing.T, client *api.Client, peerName string, exports int, opts *api.QueryOptions)

PeeringExportsOpts verifies the correct number of exported services with a default retry with options.

func PeeringStatus

func PeeringStatus(t *testing.T, client *api.Client, peerName string, status api.PeeringState)

PeeringStatus verifies the peering connection is the specified state with a default retry.

func PeeringStatusOpts

func PeeringStatusOpts(t *testing.T, client *api.Client, peerName string, status api.PeeringState, opts *api.QueryOptions)

PeeringStatusOpts verifies the peering connection is the specified state with a default retry with options.

func ServiceLogContains

func ServiceLogContains(t *testing.T, service libservice.Service, target string) bool

ServiceLogContains returns true if the service container has the target string in its logs

Types

This section is empty.

Jump to

Keyboard shortcuts

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