Documentation ¶
Index ¶
- Constants
- Variables
- func Clean(ctx context.Context, tb testing.TB, resource interface{})
- func NewSSHKey() (ssh.PublicKey, *ssh.ClientConfig, error)
- func Rand() *rand.Rand
- func RandomString(length int) string
- func RegisterCleaner(cleaner Cleaner)
- func RegisterMetric(name string, met Metric) error
- func RegisterTB(tb testing.TB) func(context.Context)
- type Benchmark
- type Cleaner
- type Metric
- type Registry
- func (r *Registry) Clean(ctx context.Context, tb testing.TB, resource interface{})
- func (r *Registry) NewSSHKey() (ssh.PublicKey, *ssh.ClientConfig, error)
- func (r *Registry) RandomString(length int) string
- func (r *Registry) RegisterCleaner(cleaner Cleaner)
- func (r *Registry) RegisterMetric(name string, met Metric) error
- func (r *Registry) RegisterTB(tb testing.TB) func(context.Context)
- type ResultSubmitter
- type TBContext
- type TBState
- type Test
Constants ¶
const ( // RunDurationMetricName is the name of the metric for test and benchmark run // durations. RunDurationMetricName = "run_duration_s" // RunLastMetricName is the name of the metric for the test and benchmark last // run timestamp. RunLastMetricName = "run_last_timestamp" )
const ( // TBPassed represents a passed test. TBPassed // TBFailed represents a failed test. TBFailed // TBSkipped represents a skipped test. TBSkipped )
Variables ¶
var RunDurationMetric = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: "e2e", Subsystem: "tb", Name: RunDurationMetricName, Help: "Amount of time tests or benchmarks take.", }, []string{"name", "state"}, )
RunDurationMetric is the the metric for test and benchmark run durations.
var RunLastMetric = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: "e2e", Subsystem: "tb", Name: RunLastMetricName, Help: "Timestamp of the last run for a test or benchmark.", }, []string{"name", "state"}, )
RunLastMetric is the the metric for test and benchmark last run timestamps.
Functions ¶
func NewSSHKey ¶
func NewSSHKey() (ssh.PublicKey, *ssh.ClientConfig, error)
NewSSHKey generates a new SSH public/private key pair using the default registry.
func RandomString ¶
RandomString generates a random string using the default registry.
func RegisterCleaner ¶
func RegisterCleaner(cleaner Cleaner)
RegisterCleaner registers a cleaner with the default registry.
func RegisterMetric ¶
RegisterMetric registers a metric with the default registry.
Types ¶
type Benchmark ¶
type Benchmark struct { SubBenchmarks []*Benchmark `json:"sub_benchmarks,omitempty"` // contains filtered or unexported fields }
Benchmark is the API representation of a `testing.B`.
func (*Benchmark) LogsString ¶
func (c *Benchmark) LogsString() string
type Metric ¶
type Metric interface { prometheus.Collector }
Metric is the interface for a prometheus metric that can be registered with an `e2e.Registry`.
type Registry ¶
Registry is the collection of tests in a run along with the supporting systems for collecting metrics, submitting run results, and resource cleanup.
var DefaultRegistry *Registry
DefaultRegistry is the default exported package level registry. It is exported as a convenience so that individual registries do not need to be manually instatiated.
func (*Registry) RandomString ¶
RandomString generates a random string.
func (*Registry) RegisterCleaner ¶
RegisterCleaner registers a resource cleaner with the registry.
func (*Registry) RegisterMetric ¶
RegisterMetric registers a metric with the registry.
type ResultSubmitter ¶
type ResultSubmitter struct {
ServerAddr string
}
ResultSubmitter handles the submission of results to the e2e server.
func (*ResultSubmitter) SubmitTest ¶
func (r *ResultSubmitter) SubmitTest(ctx context.Context, test *Test) error
SubmitTest posts test results to the e2e server.
func (*ResultSubmitter) SubmitTestLogs ¶
SubmitTestLogs posts test logs to the e2e server.
type TBContext ¶
type TBContext struct {
// contains filtered or unexported fields
}
TBContext is context for `testing.TB`s` that is used for storing testing state.