correctness

package
v1.3.0-rc.1.0...-65594da Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2021 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Case

type Case interface {
	prometheus.Collector

	Name() string
	Query(ctx context.Context, client v1.API, selectors string, start time.Time, duration time.Duration) ([]model.SamplePair, error)
	ExpectedValueAt(time.Time) float64

	MinQueryTime() time.Time
	Test(ctx context.Context, client v1.API, selectors string, start time.Time, duration time.Duration) (bool, error)
	Stop()
}

Case is a metric that can be used for exporting a metric and querying it for tests.

func NewDeleteSeriesTest

func NewDeleteSeriesTest(name string, f func(time.Time) float64, cfg DeleteSeriesTestConfig, commonTestConfig CommonTestConfig) Case

func NewSimpleTestCase

func NewSimpleTestCase(name string, f func(time.Time) float64, cfg CommonTestConfig) Case

NewSimpleTestCase makes a new simpleTestCase

type CommonTestConfig

type CommonTestConfig struct {
	ScrapeInterval time.Duration
	// contains filtered or unexported fields
}

func (*CommonTestConfig) RegisterFlags

func (cfg *CommonTestConfig) RegisterFlags(f *flag.FlagSet)

type DeleteSeriesTest

type DeleteSeriesTest struct {
	Case
	// contains filtered or unexported fields
}

DeleteSeriesTest would keep deleting data for configured duration at configured interval. Test method would check whether we are getting expected data by eliminating deleted samples while non deleted ones stays untouched. For simplification it would not test samples from the start time of last sent delete request and just treat it as passed.

func (*DeleteSeriesTest) MinQueryTime

func (d *DeleteSeriesTest) MinQueryTime() time.Time

func (*DeleteSeriesTest) Stop

func (d *DeleteSeriesTest) Stop()

func (*DeleteSeriesTest) Test

func (d *DeleteSeriesTest) Test(ctx context.Context, client v1.API, selectors string, start time.Time, duration time.Duration) (bool, error)

type DeleteSeriesTestConfig

type DeleteSeriesTestConfig struct {
	PrometheusAddr string
	ExtraSelectors string
	UserID         string
	// contains filtered or unexported fields
}

func (*DeleteSeriesTestConfig) RegisterFlags

func (cfg *DeleteSeriesTestConfig) RegisterFlags(f *flag.FlagSet)

type Runner

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

Runner runs a bunch of test cases, periodically checking their value.

func NewRunner

func NewRunner(cfg RunnerConfig) (*Runner, error)

NewRunner makes a new Runner.

func (*Runner) Add

func (r *Runner) Add(tc Case)

Add a new TestCase.

func (*Runner) Collect

func (r *Runner) Collect(c chan<- prometheus.Metric)

Collect implements prometheus.Collector.

func (*Runner) Describe

func (r *Runner) Describe(c chan<- *prometheus.Desc)

Describe implements prometheus.Collector.

func (*Runner) Stop

func (r *Runner) Stop()

Stop the checking goroutine.

type RunnerConfig

type RunnerConfig struct {
	PrometheusAddr         string
	UserID                 string
	ExtraSelectors         string
	EnableDeleteSeriesTest bool
	CommonTestConfig       CommonTestConfig
	DeleteSeriesTestConfig DeleteSeriesTestConfig
	// contains filtered or unexported fields
}

RunnerConfig is config, for the runner.

func (*RunnerConfig) RegisterFlags

func (cfg *RunnerConfig) RegisterFlags(f *flag.FlagSet)

RegisterFlags does what it says.

type TimeValue

type TimeValue struct {
	time.Time
	// contains filtered or unexported fields
}

TimeValue is a model.Time that can be used as a flag.

func NewTimeValue

func NewTimeValue(t time.Time) TimeValue

NewTimeValue makes a new TimeValue; will round t down to the nearest midnight.

func (*TimeValue) Set

func (v *TimeValue) Set(s string) error

Set implements flag.Value

func (TimeValue) String

func (v TimeValue) String() string

String implements flag.Value

Jump to

Keyboard shortcuts

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