assertions

package
v1.17.0-beta29 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// SafeTimeToSyncStats represents a safe estimate for metrics reporting interval. We provide a buffer beyond
	// the time that metrics reporting occurs, to account for latencies. Tests should use the SafeTimeToSyncStats
	// to ensure that we are polling the stats endpoints infrequently enough that they will have updated each time
	SafeTimeToSyncStats = timeToSyncStats + time.Second*3
)

Variables

View Source
var DefaultStatsPortFwd = StatsPortFwd{
	ResourceName:      "deployment/gloo",
	ResourceNamespace: defaults.GlooSystem,
	LocalPort:         stats.DefaultPort,
	TargetPort:        stats.DefaultPort,
}

DefaultStatsPortFwd is a commonly used port-forward configuration, since Gloo Deployment stats are the most valuable This is used in Gloo Enterprise

Functions

func EventuallyStatisticsMatchAssertions

func EventuallyStatisticsMatchAssertions(statsPortFwd StatsPortFwd, assertions ...types.AsyncAssertion)

EventuallyStatisticsMatchAssertions first opens a fort-forward and then performs a series of Asynchronous assertions. The fort-forward is cleaned up with the function returns

func EventuallyWithOffsetStatisticsMatchAssertions

func EventuallyWithOffsetStatisticsMatchAssertions(offset int, statsPortFwd StatsPortFwd, assertions ...types.AsyncAssertion)

EventuallyWithOffsetStatisticsMatchAssertions first opens a fort-forward and then performs a series of Asynchronous assertions. The fort-forward is cleaned up with the function returns

func ExpectStatLastValueMatches added in v1.15.19

func ExpectStatLastValueMatches(measure *stats2.Int64Measure, lastValueMatcher types.GomegaMatcher)

ExpectStatLastValueMatches is a helper function that retrieves the last value of a statistic and asserts that it matches the passed matcher

func ExpectStatSumMatches added in v1.15.19

func ExpectStatSumMatches(measure *stats2.Int64Measure, sumValueMatcher types.GomegaMatcher)

ExpectStatSumMatches is a helper function that retrieves the sum of a statistic and asserts that it matches the passed matcher

func IntStatisticReachesConsistentValueAssertion

func IntStatisticReachesConsistentValueAssertion(prometheusStat string, inARow int) (types.AsyncAssertion, *int)

IntStatisticReachesConsistentValueAssertion returns an assertion that a prometheus stats has reached a consistent value It optionally returns the value of that statistic as well Arguments:

prometheusStat (string) - The name of the statistic we will be evaluating
inARow (int) - We periodically poll the statistic value from a metrics endpoint. InARow represents
			   the number of consecutive times the statistic must be the same for it to be considered "consistent"
			   For example, if InARow=4, we must poll the endpoint 4 times consecutively and return the same value

func LogLevelAssertion

func LogLevelAssertion(logLevel zapcore.Level) types.AsyncAssertion

LogLevelAssertion returns an Assertion to verify that the dynamic log level matches the provided value

Types

type StatsPortFwd

type StatsPortFwd struct {
	ResourceName      string
	ResourceNamespace string
	LocalPort         int
	TargetPort        int
}

StatsPortFwd represents the set of configuration required to generated port-forward to access statistics locally

Jump to

Keyboard shortcuts

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